aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2018-01-19 16:18:41 +0200
committerEli Zaretskii2018-06-02 12:08:48 +0300
commitddd1b957e9406a4185e5a43ad3933b4e734d58f1 (patch)
treea915cd6c2f69d7517c2615e91ea26e7afe10f043 /src
parentaf82d1f4bd3c01786516c0d32cec4dc77a235778 (diff)
downloademacs-ddd1b957e9406a4185e5a43ad3933b4e734d58f1.tar.gz
emacs-ddd1b957e9406a4185e5a43ad3933b4e734d58f1.zip
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)
Diffstat (limited to 'src')
-rw-r--r--src/dispnew.c5
-rw-r--r--src/xdisp.c11
2 files changed, 15 insertions, 1 deletions
diff --git a/src/dispnew.c b/src/dispnew.c
index ae6799bb85c..a81d6f64d1e 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
5208#ifdef HAVE_WINDOW_SYSTEM 5208#ifdef HAVE_WINDOW_SYSTEM
5209 if (it.what == IT_IMAGE) 5209 if (it.what == IT_IMAGE)
5210 { 5210 {
5211 /* Note that this ignores images that are fringe bitmaps,
5212 because their image ID is zero, and so IMAGE_OPT_FROM_ID will
5213 return NULL. This is okay, since fringe bitmaps are not
5214 displayed in the text area, and so are never the object we
5215 are interested in. */
5211 img = IMAGE_OPT_FROM_ID (it.f, it.image_id); 5216 img = IMAGE_OPT_FROM_ID (it.f, it.image_id);
5212 if (img && !NILP (img->spec)) 5217 if (img && !NILP (img->spec))
5213 *object = img->spec; 5218 *object = img->spec;
diff --git a/src/xdisp.c b/src/xdisp.c
index d6aabd06189..479a4c5a311 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -8790,7 +8790,16 @@ move_it_in_display_line_to (struct it *it,
8790 8790
8791 if (it->line_wrap == TRUNCATE) 8791 if (it->line_wrap == TRUNCATE)
8792 { 8792 {
8793 if (BUFFER_POS_REACHED_P ()) 8793 /* If it->pixel_width is zero, the last PRODUCE_GLYPHS call
8794 produced something that doesn't consume any screen estate
8795 in the text area, so we don't want to exit the loop at
8796 TO_CHARPOS, before we produce the glyph for that buffer
8797 position. This happens, e.g., when there's an overlay at
8798 TO_CHARPOS that draws a fringe bitmap. */
8799 if (BUFFER_POS_REACHED_P ()
8800 && (it->pixel_width > 0
8801 || IT_CHARPOS (*it) > to_charpos
8802 || it->area != TEXT_AREA))
8794 { 8803 {
8795 result = MOVE_POS_MATCH_OR_ZV; 8804 result = MOVE_POS_MATCH_OR_ZV;
8796 break; 8805 break;