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
parent
afab65e8a8
commit
125cc0cd74
11
src/cut.c
11
src/cut.c
|
@ -24,15 +24,6 @@
|
||||||
|
|
||||||
#include <string.h>
|
#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
|
/* 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
|
* 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
|
* 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;
|
size_t is_current_x = openfile->current_x;
|
||||||
|
|
||||||
if (mark_is_set || openfile->current != next_contiguous_line)
|
if (mark_is_set || openfile->current != next_contiguous_line)
|
||||||
cutbuffer_reset();
|
keep_cutbuffer = FALSE;
|
||||||
|
|
||||||
do_cut_text(TRUE, mark_is_set, FALSE, FALSE);
|
do_cut_text(TRUE, mark_is_set, FALSE, FALSE);
|
||||||
|
|
||||||
|
|
|
@ -116,6 +116,9 @@ filestruct *cutbuffer = NULL;
|
||||||
/* The buffer where we store cut text. */
|
/* The buffer where we store cut text. */
|
||||||
filestruct *cutbottom = NULL;
|
filestruct *cutbottom = NULL;
|
||||||
/* The last line in the cutbuffer. */
|
/* The last line in the cutbuffer. */
|
||||||
|
bool keep_cutbuffer = FALSE;
|
||||||
|
/* Whether to add to the cutbuffer instead of clearing it first. */
|
||||||
|
|
||||||
partition *filepart = NULL;
|
partition *filepart = NULL;
|
||||||
/* The "partition" where we store a portion of the current file. */
|
/* The "partition" where we store a portion of the current file. */
|
||||||
openfilestruct *openfile = NULL;
|
openfilestruct *openfile = NULL;
|
||||||
|
|
|
@ -1618,7 +1618,7 @@ int do_mouse(void)
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
/* The cursor moved; clean the cutbuffer on the next cut. */
|
/* The cursor moved; clean the cutbuffer on the next cut. */
|
||||||
cutbuffer_reset();
|
keep_cutbuffer = FALSE;
|
||||||
|
|
||||||
edit_redraw(current_save, CENTERING);
|
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,
|
/* 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. */
|
* blow away the text in the cutbuffer upon the next cutting action. */
|
||||||
if (!retain_cuts)
|
if (!retain_cuts)
|
||||||
cutbuffer_reset();
|
keep_cutbuffer = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The user typed output_len multibyte characters. Add them to the edit
|
/* The user typed output_len multibyte characters. Add them to the edit
|
||||||
|
|
|
@ -91,6 +91,8 @@ extern int margin;
|
||||||
|
|
||||||
extern filestruct *cutbuffer;
|
extern filestruct *cutbuffer;
|
||||||
extern filestruct *cutbottom;
|
extern filestruct *cutbottom;
|
||||||
|
extern bool keep_cutbuffer;
|
||||||
|
|
||||||
extern partition *filepart;
|
extern partition *filepart;
|
||||||
extern openfilestruct *openfile;
|
extern openfilestruct *openfile;
|
||||||
extern openfilestruct *firstfile;
|
extern openfilestruct *firstfile;
|
||||||
|
@ -241,7 +243,6 @@ void precalc_multicolorinfo(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Most functions in cut.c. */
|
/* Most functions in cut.c. */
|
||||||
void cutbuffer_reset(void);
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
void cut_marked(bool *right_side_up);
|
void cut_marked(bool *right_side_up);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue