aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChong Yidong2012-08-18 15:23:30 +0800
committerChong Yidong2012-08-18 15:23:30 +0800
commita999ce26e90babdc212085a06fbd84c176200d84 (patch)
treeaa19406bc25112f4ff66cb419360672d7fac550f /src
parent39eb03f1b023ae3d94e311f6f5d9f913f75c42c4 (diff)
downloademacs-a999ce26e90babdc212085a06fbd84c176200d84.tar.gz
emacs-a999ce26e90babdc212085a06fbd84c176200d84.zip
Make display strings obey buffer-invisibility-spec.
* src/xdisp.c (handle_invisible_prop): Obey TEXT_PROP_MEANS_INVISIBLE for the string case. * redisplay-testsuite.el (test-redisplay-4): New test. Fixes: debbugs:3874
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/xdisp.c47
2 files changed, 37 insertions, 15 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 28143d43b23..beb47d6c998 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12012-08-18 Chong Yidong <cyd@gnu.org>
2
3 * xdisp.c (handle_invisible_prop): Obey TEXT_PROP_MEANS_INVISIBLE
4 for the string case (Bug#3874).
5
12012-08-18 Paul Eggert <eggert@cs.ucla.edu> 62012-08-18 Paul Eggert <eggert@cs.ucla.edu>
2 7
3 * buffer.h (BSET): Remove (Bug#12215). 8 * buffer.h (BSET): Remove (Bug#12215).
diff --git a/src/xdisp.c b/src/xdisp.c
index 03fb94ca1b3..ff74af98304 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -4069,38 +4069,56 @@ static enum prop_handled
4069handle_invisible_prop (struct it *it) 4069handle_invisible_prop (struct it *it)
4070{ 4070{
4071 enum prop_handled handled = HANDLED_NORMALLY; 4071 enum prop_handled handled = HANDLED_NORMALLY;
4072 int invis_p;
4073 Lisp_Object prop;
4072 4074
4073 if (STRINGP (it->string)) 4075 if (STRINGP (it->string))
4074 { 4076 {
4075 Lisp_Object prop, end_charpos, limit, charpos; 4077 Lisp_Object end_charpos, limit, charpos;
4076 4078
4077 /* Get the value of the invisible text property at the 4079 /* Get the value of the invisible text property at the
4078 current position. Value will be nil if there is no such 4080 current position. Value will be nil if there is no such
4079 property. */ 4081 property. */
4080 charpos = make_number (IT_STRING_CHARPOS (*it)); 4082 charpos = make_number (IT_STRING_CHARPOS (*it));
4081 prop = Fget_text_property (charpos, Qinvisible, it->string); 4083 prop = Fget_text_property (charpos, Qinvisible, it->string);
4084 invis_p = TEXT_PROP_MEANS_INVISIBLE (prop);
4082 4085
4083 if (!NILP (prop) 4086 if (invis_p && IT_STRING_CHARPOS (*it) < it->end_charpos)
4084 && IT_STRING_CHARPOS (*it) < it->end_charpos)
4085 { 4087 {
4088 /* Record whether we have to display an ellipsis for the
4089 invisible text. */
4090 int display_ellipsis_p = (invis_p == 2);
4086 ptrdiff_t endpos; 4091 ptrdiff_t endpos;
4087 4092
4088 handled = HANDLED_RECOMPUTE_PROPS; 4093 handled = HANDLED_RECOMPUTE_PROPS;
4089 4094
4090 /* Get the position at which the next change of the 4095 /* Get the position at which the next visible text can be
4091 invisible text property can be found in IT->string. 4096 found in IT->string, if any. */
4092 Value will be nil if the property value is the same for
4093 all the rest of IT->string. */
4094 XSETINT (limit, SCHARS (it->string)); 4097 XSETINT (limit, SCHARS (it->string));
4095 end_charpos = Fnext_single_property_change (charpos, Qinvisible, 4098 do
4096 it->string, limit); 4099 {
4100 end_charpos = Fnext_single_property_change (charpos, Qinvisible,
4101 it->string, limit);
4102 if (!NILP (end_charpos))
4103 {
4104 prop = Fget_text_property (end_charpos, Qinvisible, it->string);
4105 invis_p = TEXT_PROP_MEANS_INVISIBLE (prop);
4106 if (invis_p == 2)
4107 display_ellipsis_p = 1;
4108 }
4109 }
4110 while (!NILP (end_charpos) && invis_p);
4111
4112 if (display_ellipsis_p)
4113 {
4114 it->ellipsis_p = 1;
4115 handled = HANDLED_RETURN;
4116 }
4097 4117
4098 /* Text at current position is invisible. The next
4099 change in the property is at position end_charpos.
4100 Move IT's current position to that position. */
4101 if (INTEGERP (end_charpos) 4118 if (INTEGERP (end_charpos)
4102 && (endpos = XFASTINT (end_charpos)) < XFASTINT (limit)) 4119 && (endpos = XFASTINT (end_charpos)) < XFASTINT (limit))
4103 { 4120 {
4121 /* Text at END_CHARPOS is visible. Move IT there. */
4104 struct text_pos old; 4122 struct text_pos old;
4105 ptrdiff_t oldpos; 4123 ptrdiff_t oldpos;
4106 4124
@@ -4153,9 +4171,8 @@ handle_invisible_prop (struct it *it)
4153 } 4171 }
4154 else 4172 else
4155 { 4173 {
4156 int invis_p;
4157 ptrdiff_t newpos, next_stop, start_charpos, tem; 4174 ptrdiff_t newpos, next_stop, start_charpos, tem;
4158 Lisp_Object pos, prop, overlay; 4175 Lisp_Object pos, overlay;
4159 4176
4160 /* First of all, is there invisible text at this position? */ 4177 /* First of all, is there invisible text at this position? */
4161 tem = start_charpos = IT_CHARPOS (*it); 4178 tem = start_charpos = IT_CHARPOS (*it);
@@ -6032,7 +6049,7 @@ back_to_previous_visible_line_start (struct it *it)
6032 { 6049 {
6033 Lisp_Object prop; 6050 Lisp_Object prop;
6034 prop = Fget_char_property (make_number (IT_CHARPOS (*it) - 1), 6051 prop = Fget_char_property (make_number (IT_CHARPOS (*it) - 1),
6035 Qinvisible, it->window); 6052 Qinvisible, it->window);
6036 if (TEXT_PROP_MEANS_INVISIBLE (prop)) 6053 if (TEXT_PROP_MEANS_INVISIBLE (prop))
6037 continue; 6054 continue;
6038 } 6055 }