aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2015-03-15 19:17:46 +0200
committerEli Zaretskii2015-03-15 19:17:46 +0200
commit4e5eb85425214d62cd3962914565b281b74504ce (patch)
tree542dc87552c84a87eea0b97cbd560bacd81f3280 /src
parent28caedba0f5c387d9c8e8fc8de26b5399afeb68b (diff)
downloademacs-4e5eb85425214d62cd3962914565b281b74504ce.tar.gz
emacs-4e5eb85425214d62cd3962914565b281b74504ce.zip
Fix subtle problems with linum-mode and invisible text
src/xdisp.c (handle_invisible_prop): Fix up it->position even when we are going to load overlays at the beginning of the invisible text. (setup_for_ellipsis): Reset the ignore_overlay_strings_at_pos_p flag also here. (next_overlay_string): Set the overlay_strings_at_end_processed_p flag only if the overlays just processed were actually loaded at EOB.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog11
-rw-r--r--src/xdisp.c56
2 files changed, 48 insertions, 19 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index cb4aad6ec95..e328afcde8f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,14 @@
12015-03-15 Eli Zaretskii <eliz@gnu.org>
2
3 * xdisp.c (handle_invisible_prop): Fix up it->position even when
4 we are going to load overlays at the beginning of the invisible
5 text.
6 (setup_for_ellipsis): Reset the ignore_overlay_strings_at_pos_p
7 flag also here.
8 (next_overlay_string): Set the overlay_strings_at_end_processed_p
9 flag only if the overlays just processed were actually loaded at
10 EOB.
11
12015-03-14 Daniel Colascione <dancol@dancol.org> 122015-03-14 Daniel Colascione <dancol@dancol.org>
2 13
3 * emacs.c (standard_args): Add --no-x-resources. 14 * emacs.c (standard_args): Add --no-x-resources.
diff --git a/src/xdisp.c b/src/xdisp.c
index ce685fd6e22..a17f5a9c34f 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -4412,6 +4412,27 @@ handle_invisible_prop (struct it *it)
4412 IT_BYTEPOS (*it) = CHAR_TO_BYTE (newpos); 4412 IT_BYTEPOS (*it) = CHAR_TO_BYTE (newpos);
4413 } 4413 }
4414 4414
4415 if (display_ellipsis_p)
4416 {
4417 /* Make sure that the glyphs of the ellipsis will get
4418 correct `charpos' values. If we would not update
4419 it->position here, the glyphs would belong to the
4420 last visible character _before_ the invisible
4421 text, which confuses `set_cursor_from_row'.
4422
4423 We use the last invisible position instead of the
4424 first because this way the cursor is always drawn on
4425 the first "." of the ellipsis, whenever PT is inside
4426 the invisible text. Otherwise the cursor would be
4427 placed _after_ the ellipsis when the point is after the
4428 first invisible character. */
4429 if (!STRINGP (it->object))
4430 {
4431 it->position.charpos = newpos - 1;
4432 it->position.bytepos = CHAR_TO_BYTE (it->position.charpos);
4433 }
4434 }
4435
4415 /* If there are before-strings at the start of invisible 4436 /* If there are before-strings at the start of invisible
4416 text, and the text is invisible because of a text 4437 text, and the text is invisible because of a text
4417 property, arrange to show before-strings because 20.x did 4438 property, arrange to show before-strings because 20.x did
@@ -4443,23 +4464,6 @@ handle_invisible_prop (struct it *it)
4443 } 4464 }
4444 else if (display_ellipsis_p) 4465 else if (display_ellipsis_p)
4445 { 4466 {
4446 /* Make sure that the glyphs of the ellipsis will get
4447 correct `charpos' values. If we would not update
4448 it->position here, the glyphs would belong to the
4449 last visible character _before_ the invisible
4450 text, which confuses `set_cursor_from_row'.
4451
4452 We use the last invisible position instead of the
4453 first because this way the cursor is always drawn on
4454 the first "." of the ellipsis, whenever PT is inside
4455 the invisible text. Otherwise the cursor would be
4456 placed _after_ the ellipsis when the point is after the
4457 first invisible character. */
4458 if (!STRINGP (it->object))
4459 {
4460 it->position.charpos = newpos - 1;
4461 it->position.bytepos = CHAR_TO_BYTE (it->position.charpos);
4462 }
4463 it->ellipsis_p = true; 4467 it->ellipsis_p = true;
4464 /* Let the ellipsis display before 4468 /* Let the ellipsis display before
4465 considering any properties of the following char. 4469 considering any properties of the following char.
@@ -4504,6 +4508,11 @@ setup_for_ellipsis (struct it *it, int len)
4504 if (it->saved_face_id < 0 || it->saved_face_id != it->face_id) 4508 if (it->saved_face_id < 0 || it->saved_face_id != it->face_id)
4505 it->saved_face_id = it->face_id = DEFAULT_FACE_ID; 4509 it->saved_face_id = it->face_id = DEFAULT_FACE_ID;
4506 4510
4511 /* If the ellipsis represents buffer text, it means we advanced in
4512 the buffer, so we should no longer ignore overlay strings. */
4513 if (it->method == GET_FROM_BUFFER)
4514 it->ignore_overlay_strings_at_pos_p = false;
4515
4507 it->method = GET_FROM_DISPLAY_VECTOR; 4516 it->method = GET_FROM_DISPLAY_VECTOR;
4508 it->ellipsis_p = true; 4517 it->ellipsis_p = true;
4509} 4518}
@@ -5427,7 +5436,6 @@ next_overlay_string (struct it *it)
5427 && it->stop_charpos <= it->end_charpos)); 5436 && it->stop_charpos <= it->end_charpos));
5428 it->current.overlay_string_index = -1; 5437 it->current.overlay_string_index = -1;
5429 it->n_overlay_strings = 0; 5438 it->n_overlay_strings = 0;
5430 it->overlay_strings_charpos = -1;
5431 /* If there's an empty display string on the stack, pop the 5439 /* If there's an empty display string on the stack, pop the
5432 stack, to resync the bidi iterator with IT's position. Such 5440 stack, to resync the bidi iterator with IT's position. Such
5433 empty strings are pushed onto the stack in 5441 empty strings are pushed onto the stack in
@@ -5444,8 +5452,18 @@ next_overlay_string (struct it *it)
5444 /* If we're at the end of the buffer, record that we have 5452 /* If we're at the end of the buffer, record that we have
5445 processed the overlay strings there already, so that 5453 processed the overlay strings there already, so that
5446 next_element_from_buffer doesn't try it again. */ 5454 next_element_from_buffer doesn't try it again. */
5447 if (NILP (it->string) && IT_CHARPOS (*it) >= it->end_charpos) 5455 if (NILP (it->string)
5456 && IT_CHARPOS (*it) >= it->end_charpos
5457 && it->overlay_strings_charpos >= it->end_charpos)
5448 it->overlay_strings_at_end_processed_p = true; 5458 it->overlay_strings_at_end_processed_p = true;
5459 /* Note: we reset overlay_strings_charpos only here, to make
5460 sure the just-processed overlays were indeed at EOB.
5461 Otherwise, overlays on text with invisible text property,
5462 which are processed with IT's position past the invisible
5463 text, might fool us into thinking the overlays at EOB were
5464 already processed (linum-mode can cause this, for
5465 example). */
5466 it->overlay_strings_charpos = -1;
5449 } 5467 }
5450 else 5468 else
5451 { 5469 {