commit 125cc0cd748600a4bcbcc53c57c5f8ef4291cf7c
parent afab65e8a838a0fb19522f334c847afc4cc0812f
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sun, 30 Dec 2018 13:36:29 +0100
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.
Diffstat:
4 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/src/cut.c b/src/cut.c
@@ -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);
diff --git a/src/global.c b/src/global.c
@@ -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;
diff --git a/src/nano.c b/src/nano.c
@@ -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
diff --git a/src/proto.h b/src/proto.h
@@ -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