diff options
| author | Chong Yidong | 2012-08-20 00:19:05 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-08-20 00:19:05 +0800 |
| commit | 450809af98c857e5161aa28f31871e52a22dacad (patch) | |
| tree | 156c14718baa8be7dd9f866af3b959e33eb8be38 /src | |
| parent | 6b1319cec2cc1753ca527533f78fe45069342dfa (diff) | |
| download | emacs-450809af98c857e5161aa28f31871e52a22dacad.tar.gz emacs-450809af98c857e5161aa28f31871e52a22dacad.zip | |
* src/xdisp.c (handle_invisible_prop): Fix ellipses at overlay string ends.
* test/redisplay-testsuite.el (test-redisplay): Use switch-to-buffer.
Fixes: debbugs:3874
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/xdisp.c | 21 |
2 files changed, 15 insertions, 11 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index a287474ec06..63b968c8bb5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-08-19 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * xdisp.c (handle_invisible_prop): Fix ellipses at overlay string | ||
| 4 | ends (Bug#3874). | ||
| 5 | |||
| 1 | 2012-08-19 Andreas Schwab <schwab@linux-m68k.org> | 6 | 2012-08-19 Andreas Schwab <schwab@linux-m68k.org> |
| 2 | 7 | ||
| 3 | * .gdbinit: Use call instead of set when calling a function in the | 8 | * .gdbinit: Use call instead of set when calling a function in the |
diff --git a/src/xdisp.c b/src/xdisp.c index ff74af98304..aab643f9fe8 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -4088,35 +4088,33 @@ handle_invisible_prop (struct it *it) | |||
| 4088 | /* Record whether we have to display an ellipsis for the | 4088 | /* Record whether we have to display an ellipsis for the |
| 4089 | invisible text. */ | 4089 | invisible text. */ |
| 4090 | int display_ellipsis_p = (invis_p == 2); | 4090 | int display_ellipsis_p = (invis_p == 2); |
| 4091 | ptrdiff_t endpos; | 4091 | ptrdiff_t len, endpos; |
| 4092 | 4092 | ||
| 4093 | handled = HANDLED_RECOMPUTE_PROPS; | 4093 | handled = HANDLED_RECOMPUTE_PROPS; |
| 4094 | 4094 | ||
| 4095 | /* Get the position at which the next visible text can be | 4095 | /* Get the position at which the next visible text can be |
| 4096 | found in IT->string, if any. */ | 4096 | found in IT->string, if any. */ |
| 4097 | XSETINT (limit, SCHARS (it->string)); | 4097 | len = SCHARS (it->string); |
| 4098 | XSETINT (limit, len); | ||
| 4098 | do | 4099 | do |
| 4099 | { | 4100 | { |
| 4100 | end_charpos = Fnext_single_property_change (charpos, Qinvisible, | 4101 | end_charpos = Fnext_single_property_change (charpos, Qinvisible, |
| 4101 | it->string, limit); | 4102 | it->string, limit); |
| 4102 | if (!NILP (end_charpos)) | 4103 | if (INTEGERP (end_charpos)) |
| 4103 | { | 4104 | { |
| 4105 | endpos = XFASTINT (end_charpos); | ||
| 4104 | prop = Fget_text_property (end_charpos, Qinvisible, it->string); | 4106 | prop = Fget_text_property (end_charpos, Qinvisible, it->string); |
| 4105 | invis_p = TEXT_PROP_MEANS_INVISIBLE (prop); | 4107 | invis_p = TEXT_PROP_MEANS_INVISIBLE (prop); |
| 4106 | if (invis_p == 2) | 4108 | if (invis_p == 2) |
| 4107 | display_ellipsis_p = 1; | 4109 | display_ellipsis_p = 1; |
| 4108 | } | 4110 | } |
| 4109 | } | 4111 | } |
| 4110 | while (!NILP (end_charpos) && invis_p); | 4112 | while (invis_p && INTEGERP (end_charpos) && endpos < len); |
| 4111 | 4113 | ||
| 4112 | if (display_ellipsis_p) | 4114 | if (display_ellipsis_p) |
| 4113 | { | 4115 | it->ellipsis_p = 1; |
| 4114 | it->ellipsis_p = 1; | ||
| 4115 | handled = HANDLED_RETURN; | ||
| 4116 | } | ||
| 4117 | 4116 | ||
| 4118 | if (INTEGERP (end_charpos) | 4117 | if (INTEGERP (end_charpos) && endpos < len) |
| 4119 | && (endpos = XFASTINT (end_charpos)) < XFASTINT (limit)) | ||
| 4120 | { | 4118 | { |
| 4121 | /* Text at END_CHARPOS is visible. Move IT there. */ | 4119 | /* Text at END_CHARPOS is visible. Move IT there. */ |
| 4122 | struct text_pos old; | 4120 | struct text_pos old; |
| @@ -4154,7 +4152,8 @@ handle_invisible_prop (struct it *it) | |||
| 4154 | /* The rest of the string is invisible. If this is an | 4152 | /* The rest of the string is invisible. If this is an |
| 4155 | overlay string, proceed with the next overlay string | 4153 | overlay string, proceed with the next overlay string |
| 4156 | or whatever comes and return a character from there. */ | 4154 | or whatever comes and return a character from there. */ |
| 4157 | if (it->current.overlay_string_index >= 0) | 4155 | if (it->current.overlay_string_index >= 0 |
| 4156 | && !display_ellipsis_p) | ||
| 4158 | { | 4157 | { |
| 4159 | next_overlay_string (it); | 4158 | next_overlay_string (it); |
| 4160 | /* Don't check for overlay strings when we just | 4159 | /* Don't check for overlay strings when we just |