emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-26 ddd1b95 1/2: Fix posn-at-point in Flycheck buffer


From: Eli Zaretskii
Subject: [Emacs-diffs] emacs-26 ddd1b95 1/2: Fix posn-at-point in Flycheck buffers
Date: Sat, 2 Jun 2018 05:10:53 -0400 (EDT)

branch: emacs-26
commit ddd1b957e9406a4185e5a43ad3933b4e734d58f1
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Fix posn-at-point in Flycheck buffers
    
    * src/dispnew.c (buffer_posn_from_coords): Improve commentary.
    
    * src/xdisp.c (move_it_in_display_line_to): Don't exit the loop
    under truncate-lines if the glyph at TO_CHARPOS was not yet
    produced.  This avoids bailing out too early when we are at
    TO_CHARPOS, but didn't yet produce glyphs for that buffer
    position, because the last call to PRODUCE_GLYPHS at this position
    was for an object other than the buffer.  For further details, see
    http://lists.gnu.org/archive/html/emacs-devel/2018-01/msg00537.html.
    
    (cherry picked from commit c0154ac7c3423f68d8f3a2e85a756c9759219039)
---
 src/dispnew.c |  5 +++++
 src/xdisp.c   | 11 ++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/dispnew.c b/src/dispnew.c
index ae6799b..a81d6f6 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -5208,6 +5208,11 @@ buffer_posn_from_coords (struct window *w, int *x, int 
*y, struct display_pos *p
 #ifdef HAVE_WINDOW_SYSTEM
   if (it.what == IT_IMAGE)
     {
+      /* Note that this ignores images that are fringe bitmaps,
+        because their image ID is zero, and so IMAGE_OPT_FROM_ID will
+        return NULL.  This is okay, since fringe bitmaps are not
+        displayed in the text area, and so are never the object we
+        are interested in.  */
       img = IMAGE_OPT_FROM_ID (it.f, it.image_id);
       if (img && !NILP (img->spec))
        *object = img->spec;
diff --git a/src/xdisp.c b/src/xdisp.c
index d6aabd0..479a4c5 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -8790,7 +8790,16 @@ move_it_in_display_line_to (struct it *it,
 
       if (it->line_wrap == TRUNCATE)
        {
-         if (BUFFER_POS_REACHED_P ())
+         /* If it->pixel_width is zero, the last PRODUCE_GLYPHS call
+            produced something that doesn't consume any screen estate
+            in the text area, so we don't want to exit the loop at
+            TO_CHARPOS, before we produce the glyph for that buffer
+            position.  This happens, e.g., when there's an overlay at
+            TO_CHARPOS that draws a fringe bitmap.  */
+         if (BUFFER_POS_REACHED_P ()
+             && (it->pixel_width > 0
+                 || IT_CHARPOS (*it) > to_charpos
+                 || it->area != TEXT_AREA))
            {
              result = MOVE_POS_MATCH_OR_ZV;
              break;



reply via email to

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