]> git.wh0rd.org Git - nano.git/commitdiff
Tweak KILL_TRAILING_SPACES. Still deciding on name...
authorChris Allegretta <chrisa@asty.org>
Wed, 24 Feb 2016 04:46:44 +0000 (04:46 +0000)
committerChris Allegretta <chrisa@asty.org>
Wed, 24 Feb 2016 04:46:44 +0000 (04:46 +0000)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5675 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

ChangeLog
src/text.c

index eacfe3cacbf3bb7344fad6ce9cf4218317f3e803..0fea0a7e737b132326ea968344119c6916de79be 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,7 +10,8 @@
 2016-02-22  Chris Allegretta  <chrisa@asty.org>
        * Add the ability to kill the trailing spaces when justifying text,
        by adding a new nanorc option 'kill_spaces_on_justify' -- we'll see
-       whether this warrants a command-line flag or not.
+       whether this warrants a command-line flag or not.  Now with slightly
+       better logic for multi-spaced lines.
 
 2016-02-22  Benno Schulenberg  <bensberg@justemail.net>
        * src/nano.c (free_openfilestruct): Elide this function.
index ac12f351d9ded174cd1813d4d31008c5ff5780b2..e419616a7b2121d35a4423be6968f9c2c0bccfcb 100644 (file)
@@ -2176,10 +2176,13 @@ void do_justify(bool full_justify)
 #endif
 
            /* Break the current line. */
-            if (ISSET(KILL_TRAILING_SPACES))
-               null_at(&openfile->current->data, break_pos - 1);
-           else
-               null_at(&openfile->current->data, break_pos);
+            if (ISSET(KILL_TRAILING_SPACES)) {
+                while (break_pos > 0 &&
+                       is_blank_mbchar(&openfile->current->data[break_pos-1])) {
+                   break_pos--;
+               }
+           }
+           null_at(&openfile->current->data, break_pos);
 
            /* Go to the next line. */
            par_len--;