tweaks: rename a function, to be a bit more expressive

master
Benno Schulenberg 2020-01-08 16:13:04 +01:00
parent 72e5c15110
commit a4eae770ce
3 changed files with 11 additions and 10 deletions

View File

@ -212,7 +212,7 @@ void chop_next_word(void)
/* Move all text between (top, top_x) and (bot, bot_x) from the current buffer /* Move all text between (top, top_x) and (bot, bot_x) from the current buffer
* into the cutbuffer. */ * into the cutbuffer. */
void extract(linestruct *top, size_t top_x, linestruct *bot, size_t bot_x) void extract_segment(linestruct *top, size_t top_x, linestruct *bot, size_t bot_x)
{ {
bool edittop_inside; bool edittop_inside;
#ifndef NANO_TINY #ifndef NANO_TINY
@ -393,9 +393,9 @@ void cut_line(void)
* head of this line to the head of the next line into the cutbuffer; * head of this line to the head of the next line into the cutbuffer;
* otherwise, move all of the text of this line into the cutbuffer. */ * otherwise, move all of the text of this line into the cutbuffer. */
if (openfile->current != openfile->filebot) if (openfile->current != openfile->filebot)
extract(openfile->current, 0, openfile->current->next, 0); extract_segment(openfile->current, 0, openfile->current->next, 0);
else else
extract(openfile->current, 0, extract_segment(openfile->current, 0,
openfile->current, strlen(openfile->current->data)); openfile->current, strlen(openfile->current->data));
openfile->placewewant = 0; openfile->placewewant = 0;
@ -413,10 +413,10 @@ void cut_to_eol(void)
* the cutbuffer. Otherwise, when not at the end of the buffer, * the cutbuffer. Otherwise, when not at the end of the buffer,
* move the line separation into the cutbuffer. */ * move the line separation into the cutbuffer. */
if (openfile->current_x < data_len) if (openfile->current_x < data_len)
extract(openfile->current, openfile->current_x, extract_segment(openfile->current, openfile->current_x,
openfile->current, data_len); openfile->current, data_len);
else if (openfile->current != openfile->filebot) { else if (openfile->current != openfile->filebot) {
extract(openfile->current, openfile->current_x, extract_segment(openfile->current, openfile->current_x,
openfile->current->next, 0); openfile->current->next, 0);
openfile->placewewant = xplustabs(); openfile->placewewant = xplustabs();
} }
@ -431,7 +431,7 @@ void cut_marked(bool *right_side_up)
get_region((const linestruct **)&top, &top_x, get_region((const linestruct **)&top, &top_x,
(const linestruct **)&bot, &bot_x, right_side_up); (const linestruct **)&bot, &bot_x, right_side_up);
extract(top, top_x, bot, bot_x); extract_segment(top, top_x, bot, bot_x);
openfile->placewewant = xplustabs(); openfile->placewewant = xplustabs();
} }
@ -439,7 +439,7 @@ void cut_marked(bool *right_side_up)
/* Move all text from the cursor position to end-of-file into the cutbuffer. */ /* Move all text from the cursor position to end-of-file into the cutbuffer. */
void cut_to_eof(void) void cut_to_eof(void)
{ {
extract(openfile->current, openfile->current_x, extract_segment(openfile->current, openfile->current_x,
openfile->filebot, strlen(openfile->filebot->data)); openfile->filebot, strlen(openfile->filebot->data));
} }
#endif /* !NANO_TINY */ #endif /* !NANO_TINY */

View File

@ -258,7 +258,8 @@ void do_backspace(void);
void chop_previous_word(void); void chop_previous_word(void);
void chop_next_word(void); void chop_next_word(void);
#endif #endif
void extract(linestruct *top, size_t top_x, linestruct *bot, size_t bot_x); void extract_segment(linestruct *top, size_t top_x,
linestruct *bot, size_t bot_x);
void ingraft_buffer(linestruct *somebuffer); void ingraft_buffer(linestruct *somebuffer);
void copy_from_buffer(linestruct *somebuffer); void copy_from_buffer(linestruct *somebuffer);
#ifndef NANO_TINY #ifndef NANO_TINY
@ -400,7 +401,7 @@ linestruct *copy_buffer(const linestruct *src);
void free_lines(linestruct *src); void free_lines(linestruct *src);
void renumber_from(linestruct *line); void renumber_from(linestruct *line);
void partition_buffer(linestruct *top, size_t top_x, void partition_buffer(linestruct *top, size_t top_x,
linestruct *bot, size_t bot_x); linestruct *bot, size_t bot_x);
void unpartition_buffer(void); void unpartition_buffer(void);
void print_view_warning(void); void print_view_warning(void);
bool in_restricted_mode(void); bool in_restricted_mode(void);

View File

@ -2050,7 +2050,7 @@ void do_justify(bool full_justify)
/* Do the equivalent of a marked cut into an empty cutbuffer. */ /* Do the equivalent of a marked cut into an empty cutbuffer. */
cutbuffer = NULL; cutbuffer = NULL;
extract(first_par_line, top_x, last_par_line, bot_x); extract_segment(first_par_line, top_x, last_par_line, bot_x);
#ifndef NANO_TINY #ifndef NANO_TINY
update_undo(CUT); update_undo(CUT);