#include "proto.h"
#include "nano.h"
-static int marked_cut; /* Is the cutbuffer from a mark?
- * 0 means whole-line cut, 1 means mark,
- * 2 means cut-from-cursor. */
-
+static int keep_cutbuffer = FALSE;
+ /* Should we keep the contents of the cutbuffer? */
+static int marked_cut;
+ /* Is the cutbuffer from a mark? 0 means whole-line cut, 1
+ * means mark, and 2 means cut-from-cursor. */
#ifndef NANO_SMALL
-static int concatenate_cut; /* Should we add this cut string to the
- * end of the last one? */
+static int concatenate_cut;
+ /* Should we add this cut string to the end of the last one? */
#endif
-
static filestruct *cutbottom = NULL;
- /* Pointer to end of cutbuffer. */
+ /* Pointer to end of cutbuffer. */
+
+void cutbuffer_reset(void)
+{
+ keep_cutbuffer = FALSE;
+}
filestruct *get_cutbottom(void)
{
check_statblank();
- if (!ISSET(KEEP_CUTBUFFER)) {
+ if (!keep_cutbuffer) {
free_filestruct(cutbuffer);
cutbuffer = NULL;
marked_cut = 0;
}
/* You can't cut the magicline except with the mark. But trying
- * does clear the cutbuffer if KEEP_CUTBUFFER is not set. */
+ * does clear the cutbuffer if keep_cutbuffer is FALSE. */
if (current == filebot
#ifndef NANO_SMALL
&& !ISSET(MARK_ISSET)
)
return 0;
- SET(KEEP_CUTBUFFER);
+ keep_cutbuffer = TRUE;
#ifndef NANO_SMALL
if (ISSET(CUT_TO_END) && !ISSET(MARK_ISSET)) {
/* Bitwise flags so we can save space (or more correctly, not waste
* it). */
#define MODIFIED (1<<0)
-#define KEEP_CUTBUFFER (1<<1)
-#define CASE_SENSITIVE (1<<2)
-#define MARK_ISSET (1<<3)
-#define CONSTUPDATE (1<<4)
-#define NO_HELP (1<<5)
-#define NOFOLLOW_SYMLINKS (1<<6)
-#define SUSPEND (1<<7)
-#define NO_WRAP (1<<8)
-#define AUTOINDENT (1<<9)
-#define VIEW_MODE (1<<10)
-#define USE_MOUSE (1<<11)
-#define USE_REGEXP (1<<12)
-#define TEMP_OPT (1<<13)
-#define CUT_TO_END (1<<14)
-#define REVERSE_SEARCH (1<<15)
-#define MULTIBUFFER (1<<16)
-#define DOS_FILE (1<<17)
-#define MAC_FILE (1<<18)
-#define SMOOTHSCROLL (1<<19)
-#define DISABLE_CURPOS (1<<20) /* Damn, we still need it. */
-#define REBIND_DELETE (1<<21)
-#define NO_CONVERT (1<<22)
-#define BACKUP_FILE (1<<23)
-#define NO_RCFILE (1<<24)
-#define COLOR_SYNTAX (1<<25)
-#define PRESERVE (1<<26)
-#define HISTORY_CHANGED (1<<27)
-#define HISTORYLOG (1<<28)
-#define RESTRICTED (1<<29)
-#define SMART_HOME (1<<30)
+#define CASE_SENSITIVE (1<<1)
+#define MARK_ISSET (1<<2)
+#define CONSTUPDATE (1<<3)
+#define NO_HELP (1<<4)
+#define NOFOLLOW_SYMLINKS (1<<5)
+#define SUSPEND (1<<6)
+#define NO_WRAP (1<<7)
+#define AUTOINDENT (1<<8)
+#define VIEW_MODE (1<<9)
+#define USE_MOUSE (1<<10)
+#define USE_REGEXP (1<<11)
+#define TEMP_OPT (1<<12)
+#define CUT_TO_END (1<<13)
+#define REVERSE_SEARCH (1<<14)
+#define MULTIBUFFER (1<<15)
+#define DOS_FILE (1<<16)
+#define MAC_FILE (1<<17)
+#define SMOOTHSCROLL (1<<18)
+#define DISABLE_CURPOS (1<<19) /* Damn, we still need it. */
+#define REBIND_DELETE (1<<20)
+#define NO_CONVERT (1<<21)
+#define BACKUP_FILE (1<<22)
+#define NO_RCFILE (1<<23)
+#define COLOR_SYNTAX (1<<24)
+#define PRESERVE (1<<25)
+#define HISTORY_CHANGED (1<<26)
+#define HISTORYLOG (1<<27)
+#define RESTRICTED (1<<28)
+#define SMART_HOME (1<<29)
/* Control key sequences, changing these would be very very bad. */
#define NANO_CONTROL_SPACE 0