]> git.notmuchmail.org Git - notmuch/commitdiff
emacs: wash: word-wrap bugfix
authorMark Walters <markwalters1009@gmail.com>
Sat, 6 Aug 2016 15:29:33 +0000 (16:29 +0100)
committerDavid Bremner <david@tethera.net>
Tue, 9 Aug 2016 00:34:25 +0000 (09:34 +0900)
Previously notmuch-wash made the width of the text (approximately) the
window-width minus the depth in thread. This is correct for the
default indentation of 1 per message depth, but is incorrect for any
other setting of notmuch-show-indent-messages-width.

As notmuch-show-indent-messages-width is customisable, and notmuch-tree
sets it to zero to avoid indenting messages in the message pane, this
bug can show up in real use.

Two of the tests had to be updated: when
notmuch-show-indent-messages-width is 0, then the new (correct) word
wrapping happens later, when notmuch-show-indent-messages-width is 4,
then the new word wrapping happens sooner.

emacs/notmuch-wash.el
test/emacs.expected-output/notmuch-show-thread-maildir-storage-with-fourfold-indentation
test/emacs.expected-output/notmuch-show-thread-maildir-storage-without-indentation

index 57e6dfa3048d1fc41489e0fd166cc6d880eb4a37..07fc1a1f6325363df0e0a55268899851dd3cc109 100644 (file)
@@ -26,6 +26,7 @@
 (require 'coolj)
 
 (declare-function notmuch-show-insert-bodypart "notmuch-show" (msg part depth &optional hide))
 (require 'coolj)
 
 (declare-function notmuch-show-insert-bodypart "notmuch-show" (msg part depth &optional hide))
+(defvar notmuch-show-indent-messages-width)
 
 ;;
 
 
 ;;
 
@@ -335,12 +336,13 @@ message at the window width. When doing so, citation leaders in
 the wrapped text are maintained."
 
   (let* ((coolj-wrap-follows-window-size nil)
 the wrapped text are maintained."
 
   (let* ((coolj-wrap-follows-window-size nil)
+        (indent (* depth notmuch-show-indent-messages-width))
         (limit (if (numberp notmuch-wash-wrap-lines-length)
                    (min notmuch-wash-wrap-lines-length
                         (window-width))
                  (window-width)))
         (fill-column (- limit
         (limit (if (numberp notmuch-wash-wrap-lines-length)
                    (min notmuch-wash-wrap-lines-length
                         (window-width))
                  (window-width)))
         (fill-column (- limit
-                        depth
+                        indent
                         ;; 2 to avoid poor interaction with
                         ;; `word-wrap'.
                         2)))
                         ;; 2 to avoid poor interaction with
                         ;; `word-wrap'.
                         2)))
index 4721b8b0875d5267d7907d73f80f8165dc538fb6..3bbb114ab85e7d49896e018c7432c5086db8a2fb 100644 (file)
@@ -109,12 +109,14 @@ http://notmuchmail.org/mailman/listinfo/notmuch
            To: notmuch@notmuchmail.org
            Date: Wed, 18 Nov 2009 02:50:48 +0600
 
            To: notmuch@notmuchmail.org
            Date: Wed, 18 Nov 2009 02:50:48 +0600
 
-           Twas brillig at 15:33:01 17.11.2009 UTC-05 when lars at seas.harvard.edu
-           did gyre and gimble:
+           Twas brillig at 15:33:01 17.11.2009 UTC-05 when lars at
+           seas.harvard.edu did gyre and gimble:
 
             LK> Is the list archived anywhere?  The obvious archives
 
             LK> Is the list archived anywhere?  The obvious archives
-            LK> (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
-            LK> think I subscribed too late to get the patch (I only just saw the
+            LK> (http://notmuchmail.org/pipermail/notmuch/) aren't available,
+           and I
+            LK> think I subscribed too late to get the patch (I only just saw
+           the
             LK> discussion about it).
 
             LK> It doesn't look like the patch is in git yet.
             LK> discussion about it).
 
             LK> It doesn't look like the patch is in git yet.
@@ -141,7 +143,8 @@ http://notmuchmail.org/mailman/listinfo/notmuch
            seas.harvard.edu> wrote:
            > > See the patch just posted here.
 
            seas.harvard.edu> wrote:
            > > See the patch just posted here.
 
-           I've also pushed a slightly more complicated (and complete) fix to my
+           I've also pushed a slightly more complicated (and complete) fix to
+           my
            private notmuch repository
 
            git://keithp.com/git/notmuch
            private notmuch repository
 
            git://keithp.com/git/notmuch
@@ -164,10 +167,12 @@ http://notmuchmail.org/mailman/listinfo/notmuch
                [ multipart/signed ]
                [ Unknown signature status ]
                [ text/plain ]
                [ multipart/signed ]
                [ Unknown signature status ]
                [ text/plain ]
-               > I've also pushed a slightly more complicated (and complete) fix to my
+               > I've also pushed a slightly more complicated (and complete)
+               > fix to my
                > private notmuch repository
 
                > private notmuch repository
 
-               The version of lib/messages.cc in your repo doesn't build because it's
+               The version of lib/messages.cc in your repo doesn't build
+               because it's
                missing "#include <stdint.h>" (for the uint32_t on line 466).
 
                [ 4-line signature. Click/Enter to show. ]
                missing "#include <stdint.h>" (for the uint32_t on line 466).
 
                [ 4-line signature. Click/Enter to show. ]
index 62a463535e5bbe3231994959c8913be7731f668f..620caa0064f6440d75c26c705378e77089e5d609 100644 (file)
@@ -49,8 +49,8 @@ Date: Wed, 18 Nov 2009 01:02:38 +0600
 [ Unknown signature status ]
 [ text/plain ]
 
 [ Unknown signature status ]
 [ text/plain ]
 
-Twas brillig at 14:00:54 17.11.2009 UTC-05 when lars@seas.harvard.edu did
-gyre and gimble:
+Twas brillig at 14:00:54 17.11.2009 UTC-05 when lars@seas.harvard.edu did gyre
+and gimble:
 
  LK> Resulted in 4604 lines of errors along the lines of:
 
 
  LK> Resulted in 4604 lines of errors along the lines of:
 
@@ -109,8 +109,8 @@ Subject: [notmuch] Working with Maildir storage?
 To: notmuch@notmuchmail.org
 Date: Wed, 18 Nov 2009 02:50:48 +0600
 
 To: notmuch@notmuchmail.org
 Date: Wed, 18 Nov 2009 02:50:48 +0600
 
-Twas brillig at 15:33:01 17.11.2009 UTC-05 when lars at seas.harvard.edu
-did gyre and gimble:
+Twas brillig at 15:33:01 17.11.2009 UTC-05 when lars at seas.harvard.edu did
+gyre and gimble:
 
  LK> Is the list archived anywhere?  The obvious archives
  LK> (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
 
  LK> Is the list archived anywhere?  The obvious archives
  LK> (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I