]> git.wh0rd.org Git - nano.git/commitdiff
Don't keep cutbufer on reset, fix -k cut on first line if blank
authorChris Allegretta <chrisa@asty.org>
Mon, 11 Jun 2001 06:56:10 +0000 (06:56 +0000)
committerChris Allegretta <chrisa@asty.org>
Mon, 11 Jun 2001 06:56:10 +0000 (06:56 +0000)
git-svn-id: svn://svn.savannah.gnu.org/nano/branches/nano_1_0_branch/nano@682 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

ChangeLog
cut.c
move.c

index 77e03c0644245a4dda9b8d6b4d8823c8ccd1ac1f..e4c5a3b6da5eb92ad2ff7a0a79f82a65781b538d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,9 @@ CVS code -
   do_browser()
        - Don't shift the size of the file is it's less than 1K. Fixed
          files less than 1K being displayed as 0B (Rocco).
+- move.c:
+  do_home(), do_end()
+       - Don't keep cutbuffer.
 - nano.c:
   do_alt_speller()
        - Try to go to the same line we were on before before spell check
diff --git a/cut.c b/cut.c
index 3debe206cea58198fa320af3bf4c2f213b4c6ddd..1fbb0a29f6795234b5a6431f383cde522016a84e 100644 (file)
--- a/cut.c
+++ b/cut.c
@@ -167,10 +167,15 @@ int do_cut_text(void)
 
            /* If the next line is empty, create a dummy line and add it
                to the cutbuffer */
-           if (current->next != NULL && strlen(current->next->data) == 0) {
+           if ((current->next != NULL && strlen(current->next->data) == 0) ||
+               (current == fileage && strlen(current->data) == 0)) {
                filestruct *junk;
 
-               junk = copy_node(current->next);
+               if (current == fileage)
+                   junk = copy_node(current);
+               else
+                   junk = copy_node(current->next);
+
                add_to_cutbuffer(junk);
            }
            do_delete();
diff --git a/move.c b/move.c
index 42927a94ed66afce686a72e498ebe80eb40bdbe7..a5ba5f0e235ad284eeb136cfe968e0b60e3538e8 100644 (file)
--- a/move.c
+++ b/move.c
@@ -86,6 +86,7 @@ int page_down(void)
 
 int do_home(void)
 {
+    UNSET(KEEP_CUTBUFFER);
     current_x = 0;
     placewewant = 0;
     update_line(current, current_x);
@@ -94,6 +95,7 @@ int do_home(void)
 
 int do_end(void)
 {
+    UNSET(KEEP_CUTBUFFER);
     current_x = strlen(current->data);
     placewewant = xplustabs();
     update_line(current, current_x);