nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 37eccd3117cfed0e05b2c35f9f76509371e1e770
parent b9dd572a679b61da5e4e1da89e87e76b73199c8c
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Sun, 28 Apr 2019 11:01:51 +0200

tweaks: rename a function, to be more fitting

Also, adjust some whitespace, for esthetics.

Diffstat:
Msrc/cut.c | 2+-
Msrc/files.c | 2+-
Msrc/proto.h | 2+-
Msrc/search.c | 4++--
Msrc/text.c | 19+++++++++----------
Msrc/utils.c | 4++--
Msrc/winio.c | 2+-
7 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/src/cut.c b/src/cut.c @@ -230,7 +230,7 @@ void cut_marked(bool *right_side_up) linestruct *top, *bot; size_t top_x, bot_x; - mark_order((const linestruct **)&top, &top_x, + get_region((const linestruct **)&top, &top_x, (const linestruct **)&bot, &bot_x, right_side_up); extract_buffer(&cutbuffer, &cutbottom, top, top_x, bot, bot_x); diff --git a/src/files.c b/src/files.c @@ -2058,7 +2058,7 @@ bool write_marked_file(const char *name, FILE *f_open, bool tmp, size_t top_x, bot_x; /* Partition the buffer so that it contains only the marked text. */ - mark_order((const linestruct **)&top, &top_x, + get_region((const linestruct **)&top, &top_x, (const linestruct **)&bot, &bot_x, NULL); filepart = partition_buffer(top, top_x, bot, bot_x); diff --git a/src/proto.h b/src/proto.h @@ -587,7 +587,7 @@ void new_magicline(void); void remove_magicline(void); #endif #ifndef NANO_TINY -void mark_order(const linestruct **top, size_t *top_x, +void get_region(const linestruct **top, size_t *top_x, const linestruct **bot, size_t *bot_x, bool *right_side_up); void get_range(const linestruct **top, const linestruct **bot); #endif diff --git a/src/search.c b/src/search.c @@ -529,8 +529,8 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only, /* If the mark is on, frame the region, and turn the mark off. */ if (openfile->mark) { - mark_order((const linestruct **)&top, &top_x, - (const linestruct **)&bot, &bot_x, &right_side_up); + get_region((const linestruct **)&top, &top_x, + (const linestruct **)&bot, &bot_x, &right_side_up); openfile->mark = NULL; modus = INREGION; diff --git a/src/text.c b/src/text.c @@ -1963,11 +1963,10 @@ void do_justify(bool full_justify) if (openfile->mark) { size_t quote_len; - mark_order((const linestruct **)&first_par_line, &top_x, - (const linestruct **)&last_par_line, &bot_x, - &right_side_up); + get_region((const linestruct **)&first_par_line, &top_x, + (const linestruct **)&last_par_line, &bot_x, &right_side_up); - /* Save the coordinates of the mark. */ + /* Save the starting point of the marked region. */ was_top_lineno = first_par_line->lineno; was_top_x = top_x; @@ -2266,8 +2265,8 @@ bool fix_spello(const char *word) #ifndef NANO_TINY /* If the mark is on, start at the beginning of the marked region. */ if (openfile->mark) { - mark_order((const linestruct **)&top, &top_x, - (const linestruct **)&bot, &bot_x, &right_side_up); + get_region((const linestruct **)&top, &top_x, + (const linestruct **)&bot, &bot_x, &right_side_up); /* If the region is marked normally, swap the end points, so that * (current, current_x) (where searching starts) is at the top. */ if (right_side_up) { @@ -2611,8 +2610,8 @@ const char *do_alt_speller(char *tempfile_name) bool right_side_up; ssize_t was_mark_lineno = openfile->mark->lineno; - mark_order((const linestruct **)&top, &top_x, - (const linestruct **)&bot, &bot_x, &right_side_up); + get_region((const linestruct **)&top, &top_x, + (const linestruct **)&bot, &bot_x, &right_side_up); replace_marked_buffer(tempfile_name); @@ -3072,8 +3071,8 @@ void do_wordlinechar_count(void) /* If the mark is on, partition the buffer so that it * contains only the marked text, and turn the mark off. */ if (was_mark) { - mark_order((const linestruct **)&top, &top_x, - (const linestruct **)&bot, &bot_x, NULL); + get_region((const linestruct **)&top, &top_x, + (const linestruct **)&bot, &bot_x, NULL); filepart = partition_buffer(top, top_x, bot, bot_x); openfile->mark = NULL; } diff --git a/src/utils.c b/src/utils.c @@ -453,7 +453,7 @@ void remove_magicline(void) /* Set (top, top_x) and (bot, bot_x) to the start and end "coordinates" of * the marked region. If right_side_up isn't NULL, set it to TRUE when the * mark is at the top of the marked region, and to FALSE otherwise. */ -void mark_order(const linestruct **top, size_t *top_x, +void get_region(const linestruct **top, size_t *top_x, const linestruct **bot, size_t *bot_x, bool *right_side_up) { if ((openfile->current->lineno == openfile->mark->lineno && @@ -486,7 +486,7 @@ void get_range(const linestruct **top, const linestruct **bot) } else { size_t top_x, bot_x; - mark_order(top, &top_x, bot, &bot_x, NULL); + get_region(top, &top_x, bot, &bot_x, NULL); if (bot_x == 0 && *bot != *top && !also_the_last) *bot = (*bot)->prev; diff --git a/src/winio.c b/src/winio.c @@ -2739,7 +2739,7 @@ void edit_draw(linestruct *fileptr, const char *converted, int paintlen = -1; /* The number of characters to paint. Negative means "all". */ - mark_order(&top, &top_x, &bot, &bot_x, NULL); + get_region(&top, &top_x, &bot, &bot_x, NULL); if (top->lineno < fileptr->lineno || top_x < from_x) top_x = from_x;