From 45dfda97d858f58263b4752c91774994bc9a0aa6 Mon Sep 17 00:00:00 2001
From: Chris Allegretta <chrisa@asty.org>
Date: Tue, 25 Jul 2000 03:20:07 +0000
Subject: [PATCH] slightly better cut to end behavior, still doesn't preserve
 cutbuffer w/multi line cuts

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@127 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 cut.c       | 28 +++++++++++++++++++++++-----
 po/nano.pot | 46 +++++++++++++++++++++++-----------------------
 2 files changed, 46 insertions(+), 28 deletions(-)

diff --git a/cut.c b/cut.c
index 02a4762a..c0b5c5dd 100644
--- a/cut.c
+++ b/cut.c
@@ -133,7 +133,8 @@ int do_cut_text(void)
     filestruct *tmp, *fileptr = current;
 #ifndef NANO_SMALL
     char *tmpstr;
-    int newsize;
+    int newsize, cuttingtoend = 0;
+
 #endif
 
     if (fileptr == NULL || fileptr->data == NULL)
@@ -150,9 +151,23 @@ int do_cut_text(void)
     }
 #ifndef NANO_SMALL
     if (ISSET(CUT_TO_END) && !ISSET(MARK_ISSET)) {
-	SET(MARK_ISSET);
-	mark_beginbuf = current;
-	mark_beginx = strlen(current->data);
+	if (current_x == strlen(current->data))
+	{
+
+	    /* FIXME - We really need to put this data into the
+	       cutbuffer, not delete it and forget about it. */
+	    do_delete();
+	    return 1;
+	}
+	else
+	{
+	    SET(MARK_ISSET);
+	    SET(KEEP_CUTBUFFER);
+
+	    mark_beginx = strlen(current->data);
+	    mark_beginbuf = current;
+	    cuttingtoend = 1;
+	}
     }
     if (ISSET(MARK_ISSET)) {
 	if (current->lineno == mark_beginbuf->lineno) {
@@ -190,7 +205,10 @@ int do_cut_text(void)
 	UNSET(MARK_ISSET);
 	marked_cut = 1;
 	set_modified();
-	edit_update(current);
+	if (cuttingtoend)
+	    edit_refresh();
+	else
+	    edit_update(current);
 	return 1;
 #else
     if (0) {
diff --git a/po/nano.pot b/po/nano.pot
index a024f468..7ff81c24 100644
--- a/po/nano.pot
+++ b/po/nano.pot
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2000-07-24 18:10-0400\n"
+"POT-Creation-Date: 2000-07-24 23:24-0400\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -19,7 +19,7 @@ msgstr ""
 msgid "add_to_cutbuffer called with inptr->data = %s\n"
 msgstr ""
 
-#: cut.c:148
+#: cut.c:149
 msgid "Blew away cutbuffer =)\n"
 msgstr ""
 
@@ -55,7 +55,7 @@ msgstr ""
 msgid "File to insert [from ./] "
 msgstr ""
 
-#: files.c:272 files.c:296 files.c:486 nano.c:1147
+#: files.c:272 files.c:296 files.c:486 nano.c:1149
 msgid "Cancelled"
 msgstr ""
 
@@ -571,90 +571,90 @@ msgstr ""
 msgid "Mark UNset"
 msgstr ""
 
-#: nano.c:873
+#: nano.c:875
 #, c-format
 msgid "check_wrap called with inptr->data=\"%s\"\n"
 msgstr ""
 
-#: nano.c:933
+#: nano.c:935
 #, c-format
 msgid "current->data now = \"%s\"\n"
 msgstr ""
 
-#: nano.c:986
+#: nano.c:988
 #, c-format
 msgid "After, data = \"%s\"\n"
 msgstr ""
 
-#: nano.c:1056
+#: nano.c:1058
 msgid "Error deleting tempfile, ack!"
 msgstr ""
 
-#: nano.c:1074
+#: nano.c:1076
 #, c-format
 msgid "Could not create a temporary filename: %s"
 msgstr ""
 
-#: nano.c:1097
+#: nano.c:1099
 #, c-format
 msgid "Could not invoke spell program \"%s\""
 msgstr ""
 
 #. Why 32512? I dont know!
-#: nano.c:1103
+#: nano.c:1105
 msgid "Could not invoke \"ispell\""
 msgstr ""
 
-#: nano.c:1116
+#: nano.c:1118
 msgid "Finished checking spelling"
 msgstr ""
 
-#: nano.c:1134
+#: nano.c:1136
 msgid "Save modified buffer (ANSWERING \"No\" WILL DESTROY CHANGES) ? "
 msgstr ""
 
-#: nano.c:1257
+#: nano.c:1259
 msgid "Cannot resize top win"
 msgstr ""
 
-#: nano.c:1259
+#: nano.c:1261
 msgid "Cannot move top win"
 msgstr ""
 
-#: nano.c:1261
+#: nano.c:1263
 msgid "Cannot resize edit win"
 msgstr ""
 
-#: nano.c:1263
+#: nano.c:1265
 msgid "Cannot move edit win"
 msgstr ""
 
-#: nano.c:1265
+#: nano.c:1267
 msgid "Cannot resize bottom win"
 msgstr ""
 
-#: nano.c:1267
+#: nano.c:1269
 msgid "Cannot move bottom win"
 msgstr ""
 
-#: nano.c:1736
+#: nano.c:1742
 msgid "Main: set up windows\n"
 msgstr ""
 
-#: nano.c:1758
+#: nano.c:1764
 msgid "Main: bottom win\n"
 msgstr ""
 
-#: nano.c:1764
+#: nano.c:1770
 msgid "Main: open file\n"
 msgstr ""
 
-#: nano.c:1837
+#: nano.c:1843
 #, c-format
 msgid "I got Alt-[-%c! (%d)\n"
 msgstr ""
 
-#: nano.c:1853
+#: nano.c:1859
 #, c-format
 msgid "I got Alt-%c! (%d)\n"
 msgstr ""
-- 
GitLab