tweaks: elide two parameters from the get_region() function
parent
4b8a387529
commit
25b1114e03
|
@ -609,8 +609,7 @@ void remove_magicline(void);
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
void mark_order(const filestruct **top, size_t *top_x, const filestruct
|
void mark_order(const filestruct **top, size_t *top_x, const filestruct
|
||||||
**bot, size_t *bot_x, bool *right_side_up);
|
**bot, size_t *bot_x, bool *right_side_up);
|
||||||
void get_region(const filestruct **top, size_t *top_x,
|
void get_region(const filestruct **top, const filestruct **bot);
|
||||||
const filestruct **bot, size_t *bot_x);
|
|
||||||
#endif
|
#endif
|
||||||
size_t get_totsize(const filestruct *begin, const filestruct *end);
|
size_t get_totsize(const filestruct *begin, const filestruct *end);
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
|
|
12
src/text.c
12
src/text.c
|
@ -296,12 +296,10 @@ void do_indent(void)
|
||||||
char *indentation = charalloc(tabsize + 1);
|
char *indentation = charalloc(tabsize + 1);
|
||||||
/* The whitespace added to each line in order to indent it. */
|
/* The whitespace added to each line in order to indent it. */
|
||||||
filestruct *top, *bot, *line;
|
filestruct *top, *bot, *line;
|
||||||
size_t top_x, bot_x;
|
|
||||||
|
|
||||||
/* Use either all the marked lines or just the current line. */
|
/* Use either all the marked lines or just the current line. */
|
||||||
if (openfile->mark)
|
if (openfile->mark)
|
||||||
get_region((const filestruct **)&top, &top_x,
|
get_region((const filestruct **)&top, (const filestruct **)&bot);
|
||||||
(const filestruct **)&bot, &bot_x);
|
|
||||||
else {
|
else {
|
||||||
top = openfile->current;
|
top = openfile->current;
|
||||||
bot = top;
|
bot = top;
|
||||||
|
@ -401,12 +399,10 @@ void unindent_a_line(filestruct *line, size_t indent_len)
|
||||||
void do_unindent(void)
|
void do_unindent(void)
|
||||||
{
|
{
|
||||||
filestruct *top, *bot, *line;
|
filestruct *top, *bot, *line;
|
||||||
size_t top_x, bot_x;
|
|
||||||
|
|
||||||
/* Use either all the marked lines or just the current line. */
|
/* Use either all the marked lines or just the current line. */
|
||||||
if (openfile->mark)
|
if (openfile->mark)
|
||||||
get_region((const filestruct **)&top, &top_x,
|
get_region((const filestruct **)&top, (const filestruct **)&bot);
|
||||||
(const filestruct **)&bot, &bot_x);
|
|
||||||
else {
|
else {
|
||||||
top = openfile->current;
|
top = openfile->current;
|
||||||
bot = top;
|
bot = top;
|
||||||
|
@ -494,7 +490,6 @@ void do_comment(void)
|
||||||
const char *comment_seq = GENERAL_COMMENT_CHARACTER;
|
const char *comment_seq = GENERAL_COMMENT_CHARACTER;
|
||||||
undo_type action = UNCOMMENT;
|
undo_type action = UNCOMMENT;
|
||||||
filestruct *top, *bot, *line;
|
filestruct *top, *bot, *line;
|
||||||
size_t top_x, bot_x;
|
|
||||||
bool empty, all_empty = TRUE;
|
bool empty, all_empty = TRUE;
|
||||||
|
|
||||||
#ifdef ENABLE_COLOR
|
#ifdef ENABLE_COLOR
|
||||||
|
@ -509,8 +504,7 @@ void do_comment(void)
|
||||||
|
|
||||||
/* Determine which lines to work on. */
|
/* Determine which lines to work on. */
|
||||||
if (openfile->mark)
|
if (openfile->mark)
|
||||||
get_region((const filestruct **)&top, &top_x,
|
get_region((const filestruct **)&top, (const filestruct **)&bot);
|
||||||
(const filestruct **)&bot, &bot_x);
|
|
||||||
else {
|
else {
|
||||||
top = openfile->current;
|
top = openfile->current;
|
||||||
bot = top;
|
bot = top;
|
||||||
|
|
|
@ -534,12 +534,13 @@ void mark_order(const filestruct **top, size_t *top_x, const filestruct
|
||||||
|
|
||||||
/* Get the start and end points of the marked region, but
|
/* Get the start and end points of the marked region, but
|
||||||
* push the end point back if it's at the start of a line. */
|
* push the end point back if it's at the start of a line. */
|
||||||
void get_region(const filestruct **top, size_t *top_x,
|
void get_region(const filestruct **top, const filestruct **bot)
|
||||||
const filestruct **bot, size_t *bot_x)
|
|
||||||
{
|
{
|
||||||
mark_order(top, top_x, bot, bot_x, NULL);
|
size_t top_x, bot_x;
|
||||||
|
|
||||||
if (*bot_x == 0)
|
mark_order(top, &top_x, bot, &bot_x, NULL);
|
||||||
|
|
||||||
|
if (bot_x == 0)
|
||||||
*bot = (*bot)->prev;
|
*bot = (*bot)->prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue