aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2018-01-19 16:18:41 +0200
committerEli Zaretskii2018-01-19 16:18:41 +0200
commitc0154ac7c3423f68d8f3a2e85a756c9759219039 (patch)
tree720fabe4946a1560636e15050edefc06e3c76c16 /src
parent35e4a0def90d2a9b50baac81361c001c85c47e05 (diff)
downloademacs-c0154ac7c3423f68d8f3a2e85a756c9759219039.tar.gz
emacs-c0154ac7c3423f68d8f3a2e85a756c9759219039.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.
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 6b39c12f910..56f125218dc 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -5214,6 +5214,11 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p
5214#ifdef HAVE_WINDOW_SYSTEM 5214#ifdef HAVE_WINDOW_SYSTEM
5215 if (it.what == IT_IMAGE) 5215 if (it.what == IT_IMAGE)
5216 { 5216 {
5217 /* Note that this ignores images that are fringe bitmaps,
5218 because their image ID is zero, and so IMAGE_OPT_FROM_ID will
5219 return NULL. This is okay, since fringe bitmaps are not
5220 displayed in the text area, and so are never the object we
5221 are interested in. */
5217 img = IMAGE_OPT_FROM_ID (it.f, it.image_id); 5222 img = IMAGE_OPT_FROM_ID (it.f, it.image_id);
5218 if (img && !NILP (img->spec)) 5223 if (img && !NILP (img->spec))
5219 *object = img->spec; 5224 *object = img->spec;
diff --git a/src/xdisp.c b/src/xdisp.c
index d2bb47fdabd..fd8aad04121 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -8775,7 +8775,16 @@ move_it_in_display_line_to (struct it *it,
8775 8775
8776 if (it->line_wrap == TRUNCATE) 8776 if (it->line_wrap == TRUNCATE)
8777 { 8777 {
8778 if (BUFFER_POS_REACHED_P ()) 8778 /* If it->pixel_width is zero, the last PRODUCE_GLYPHS call
8779 produced something that doesn't consume any screen estate
8780 in the text area, so we don't want to exit the loop at
8781 TO_CHARPOS, before we produce the glyph for that buffer
8782 position. This happens, e.g., when there's an overlay at
8783 TO_CHARPOS that draws a fringe bitmap. */
8784 if (BUFFER_POS_REACHED_P ()
8785 && (it->pixel_width > 0
8786 || IT_CHARPOS (*it) > to_charpos
8787 || it->area != TEXT_AREA))
8779 { 8788 {
8780 result = MOVE_POS_MATCH_OR_ZV; 8789 result = MOVE_POS_MATCH_OR_ZV;
8781 break; 8790 break;