tweaks: elide a tiny function by making a variable global

And in the bargain it makes things clearer, because the name
cutbuffer_reset() is misleading.
master
Benno Schulenberg 2018-12-30 13:36:29 +01:00
parent afab65e8a8
commit 125cc0cd74
4 changed files with 8 additions and 13 deletions

View File

@ -24,15 +24,6 @@
#include <string.h>
static bool keep_cutbuffer = FALSE;
/* Should we keep the contents of the cutbuffer? */
/* Indicate that we should no longer keep the contents of the cutbuffer. */
void cutbuffer_reset(void)
{
keep_cutbuffer = FALSE;
}
/* If we aren't on the last line of the file, move all the text of the
* current line, plus the newline at the end, into the cutbuffer. If we
* are, move all of the text of the current line into the cutbuffer. In
@ -217,7 +208,7 @@ void do_copy_text(void)
size_t is_current_x = openfile->current_x;
if (mark_is_set || openfile->current != next_contiguous_line)
cutbuffer_reset();
keep_cutbuffer = FALSE;
do_cut_text(TRUE, mark_is_set, FALSE, FALSE);

View File

@ -116,6 +116,9 @@ filestruct *cutbuffer = NULL;
/* The buffer where we store cut text. */
filestruct *cutbottom = NULL;
/* The last line in the cutbuffer. */
bool keep_cutbuffer = FALSE;
/* Whether to add to the cutbuffer instead of clearing it first. */
partition *filepart = NULL;
/* The "partition" where we store a portion of the current file. */
openfilestruct *openfile = NULL;

View File

@ -1618,7 +1618,7 @@ int do_mouse(void)
else
#endif
/* The cursor moved; clean the cutbuffer on the next cut. */
cutbuffer_reset();
keep_cutbuffer = FALSE;
edit_redraw(current_save, CENTERING);
}
@ -1823,7 +1823,7 @@ void do_input(void)
/* If we aren't cutting or copying text, and the key wasn't a toggle,
* blow away the text in the cutbuffer upon the next cutting action. */
if (!retain_cuts)
cutbuffer_reset();
keep_cutbuffer = FALSE;
}
/* The user typed output_len multibyte characters. Add them to the edit

View File

@ -91,6 +91,8 @@ extern int margin;
extern filestruct *cutbuffer;
extern filestruct *cutbottom;
extern bool keep_cutbuffer;
extern partition *filepart;
extern openfilestruct *openfile;
extern openfilestruct *firstfile;
@ -241,7 +243,6 @@ void precalc_multicolorinfo(void);
#endif
/* Most functions in cut.c. */
void cutbuffer_reset(void);
#ifndef NANO_TINY
void cut_marked(bool *right_side_up);
#endif