emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 7792f7b: Fix 'window-text-pixel-size' when there's after-string a


From: Eli Zaretskii
Subject: master 7792f7b: Fix 'window-text-pixel-size' when there's after-string at EOB
Date: Thu, 22 Apr 2021 07:00:38 -0400 (EDT)

branch: master
commit 7792f7b3f3cdc40cf8636096fd5966eecebad1b5
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Fix 'window-text-pixel-size' when there's after-string at EOB
    
    * src/xdisp.c (move_it_to): Fix logic of reaching TO_CHARPOS when
    there's a display or overlay string(s) at EOB.  (Bug#47860)
---
 src/xdisp.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/xdisp.c b/src/xdisp.c
index 8ffec93..7a89089 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -10064,8 +10064,20 @@ move_it_to (struct it *it, ptrdiff_t to_charpos, int 
to_x, int to_y, int to_vpos
          if ((op & MOVE_TO_POS) != 0
              && (IT_CHARPOS (*it) > to_charpos
                  || (IT_CHARPOS (*it) == to_charpos
+                     /* Consider TO_CHARPOS as REACHED if we are at
+                        EOB that ends in something other than a newline.  */
                      && to_charpos == ZV
-                     && (ZV_BYTE <= 1 || FETCH_BYTE (ZV_BYTE - 1) != '\n'))))
+                     && (ZV_BYTE <= 1 || FETCH_BYTE (ZV_BYTE - 1) != '\n')
+                     /* But if we have a display or an overlay string
+                        at EOB, keep going until we exhaust all the
+                        characters of the string(s).  */
+                     && (it->sp == 0
+                         || (STRINGP (it->string)
+                             && (it->current.overlay_string_index < 0
+                                 || (it->current.overlay_string_index >= 0
+                                     && it->current.overlay_string_index
+                                        >= it->n_overlay_strings - 1))
+                             && IT_STRING_CHARPOS (*it) >= it->end_charpos)))))
            {
              reached = 9;
              goto out;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]