From 4ed131510e5200f9c24155e0f1ceb61536981ee5 Mon Sep 17 00:00:00 2001
From: Chris Allegretta <chrisa@asty.org>
Date: Sat, 10 Feb 2001 17:50:50 +0000
Subject: [PATCH] do_delete() - Added check for current->next == fileptr, as we
 have a magic  line code again, fixes sillyness at the end of the last line
 before the magic line (reported by J.A. Neitzel)

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@525 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog | 4 ++++
 nano.c    | 6 ++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4fdab186..b57d3319 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,10 @@ CVS code -
   do_cut_text()
 	- marked text cut fixes (Rocco) (Fixes bug #54).
 - nano.c:
+  do_delete()
+	- Added check for current->next == fileptr, as we have a magic
+	  line code again, fixes sillyness at the end of the last line
+	  before the magic line (reported by J.A. Neitzel).
   do_justify()
 	- If the keystroke after the justify is not the unjustify key,
 	  blank the statsubar (bug reported by Neil Parks).
diff --git a/nano.c b/nano.c
index 76812b60..d133ab4d 100644
--- a/nano.c
+++ b/nano.c
@@ -1080,7 +1080,9 @@ int do_delete(void)
 
 	align(&current->data);
 
-    } else if (current->next != NULL) {
+    /* Now that we have a magic lnie again, we can check for both being
+       on the line before filebot as well as at filebot */
+    } else if (current->next != NULL && current->next != filebot) {
 	current->data = nrealloc(current->data,
 				 strlen(current->data) +
 				 strlen(current->next->data) + 1);
@@ -1096,7 +1098,7 @@ int do_delete(void)
 	delete_node(foo);
 	update_line(current, current_x);
 
-	/* Please see the comment in do_basckspace if you don't understand
+	/* Please see the comment in do_backspace if you don't understand
 	   this test */
 	if (current == filebot && strcmp(current->data, "")) {
 	    new_magicline();
-- 
GitLab