tweaks: rename a function, to be more fitting
Also, adjust some whitespace, for esthetics.
Этот коммит содержится в:
родитель
b9dd572a67
Коммит
37eccd3117
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
||||
|
19
src/text.c
19
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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user