From 43000929199bbb8e610bad7a9ecb5bef3e38f569 Mon Sep 17 00:00:00 2001
From: Chris Allegretta <chrisa@asty.org>
Date: Sat, 21 Sep 2002 15:41:33 +0000
Subject: [PATCH] Newer version of DLR's patch based on DB's tab thing

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

diff --git a/ChangeLog b/ChangeLog
index 8cdbb708..193dba82 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -95,7 +95,9 @@ CVS code -
 	  characters on the line is exactly one over the limit. (David
 	  Benbennick)
 	- Restore the previous wrapping point behavior (pre 1.1.10)
-	  (David Benbennick, fixes by DLR).
+	  (David Benbennick).  Minor fix by DLR to prevent spaces from
+	  being added to the ends of lines ending in spaces or lines
+	  ending in tabs (the latter case found by David Benbennick).
   do_alt_speller()
   	- Readd DLR's fix to preserve marking when using the alternate
   	  spell checker; it was accidentally dropped. (David
diff --git a/nano.c b/nano.c
index 0cfdb709..fe7b767b 100644
--- a/nano.c
+++ b/nano.c
@@ -1510,9 +1510,9 @@ int do_wrap(filestruct *inptr)
     if (wrapping) {
 	/* In this case, totsize increases by 1 since we add a space
 	 * between after_break and wrap_line.  If the line already ends
-	 * in a space, we don't add a space and decrement totsize to
-	 * account for that. */
-	if (newline[strlen(newline) - 1] != ' ')
+	 * in a tab or a space, we don't add a space and decrement
+	 * totsize to account for that. */
+	if (newline[strlen(newline) - 1] != '\t' && newline[strlen(newline) - 1] != ' ')
 	    strcat(newline, " ");
 	else
 	    totsize--;
-- 
GitLab