diff options
| author | Eli Zaretskii | 2012-03-31 10:45:33 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2012-03-31 10:45:33 +0300 |
| commit | 8427ddd200656d210b73881607adddc5f87078b0 (patch) | |
| tree | 5c54504ae9008023fe76882589b5e29378a0bd6d /src | |
| parent | 650b6d0b9e4b001ee750c3feb3ce8b98798a51f7 (diff) | |
| download | emacs-8427ddd200656d210b73881607adddc5f87078b0.tar.gz emacs-8427ddd200656d210b73881607adddc5f87078b0.zip | |
Fix cursor positioning in rows completely covered by display strings.
src/xdisp.c (set_cursor_from_row): If `cursor' property on a display
string comes from a `display' text property, use the buffer
position of that property as if we actually saw that position in
the row's glyphs.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/xdisp.c | 34 |
2 files changed, 36 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index cbf9abd0ea1..189a7e4e775 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2012-03-31 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * xdisp.c (set_cursor_from_row): If `cursor' property on a display | ||
| 4 | string comes from a `display' text property, use the buffer | ||
| 5 | position of that property as if we actually saw that position in | ||
| 6 | the row's glyphs. | ||
| 7 | |||
| 1 | 2012-03-30 Eli Zaretskii <eliz@gnu.org> | 8 | 2012-03-30 Eli Zaretskii <eliz@gnu.org> |
| 2 | 9 | ||
| 3 | * xdisp.c (append_space_for_newline): If the default face was | 10 | * xdisp.c (append_space_for_newline): If the default face was |
diff --git a/src/xdisp.c b/src/xdisp.c index 118480a20ae..302a09dd974 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -13800,16 +13800,31 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, | |||
| 13800 | 13800 | ||
| 13801 | chprop = Fget_char_property (make_number (glyph_pos), Qcursor, | 13801 | chprop = Fget_char_property (make_number (glyph_pos), Qcursor, |
| 13802 | glyph->object); | 13802 | glyph->object); |
| 13803 | if (!NILP (chprop)) | ||
| 13804 | { | ||
| 13805 | /* If the string came from a `display' text property, | ||
| 13806 | look up the buffer position of that property and | ||
| 13807 | use that position to update bpos_max, as if we | ||
| 13808 | actually saw such a position in one of the row's | ||
| 13809 | glyphs. This helps with supporting integer values | ||
| 13810 | of `cursor' property on the display string in | ||
| 13811 | situations where most or all of the row's buffer | ||
| 13812 | text is completely covered by display properties, | ||
| 13813 | so that no glyph with valid buffer positions is | ||
| 13814 | ever seen in the row. */ | ||
| 13815 | EMACS_INT prop_pos = | ||
| 13816 | string_buffer_position_lim (glyph->object, pos_before, | ||
| 13817 | pos_after, 0); | ||
| 13818 | |||
| 13819 | if (prop_pos >= pos_before) | ||
| 13820 | bpos_max = prop_pos - 1; | ||
| 13821 | } | ||
| 13803 | if (INTEGERP (chprop)) | 13822 | if (INTEGERP (chprop)) |
| 13804 | { | 13823 | { |
| 13805 | bpos_covered = bpos_max + XINT (chprop); | 13824 | bpos_covered = bpos_max + XINT (chprop); |
| 13806 | /* If the `cursor' property covers buffer positions up | 13825 | /* If the `cursor' property covers buffer positions up |
| 13807 | to and including point, we should display cursor on | 13826 | to and including point, we should display cursor on |
| 13808 | this glyph. Note that overlays and text properties | 13827 | this glyph. Note that, if a `cursor' property on one |
| 13809 | with string values stop bidi reordering, so every | ||
| 13810 | buffer position to the left of the string is always | ||
| 13811 | smaller than any position to the right of the | ||
| 13812 | string. Therefore, if a `cursor' property on one | ||
| 13813 | of the string's characters has an integer value, we | 13828 | of the string's characters has an integer value, we |
| 13814 | will break out of the loop below _before_ we get to | 13829 | will break out of the loop below _before_ we get to |
| 13815 | the position match above. IOW, integer values of | 13830 | the position match above. IOW, integer values of |
| @@ -13869,6 +13884,15 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, | |||
| 13869 | 13884 | ||
| 13870 | chprop = Fget_char_property (make_number (glyph_pos), Qcursor, | 13885 | chprop = Fget_char_property (make_number (glyph_pos), Qcursor, |
| 13871 | glyph->object); | 13886 | glyph->object); |
| 13887 | if (!NILP (chprop)) | ||
| 13888 | { | ||
| 13889 | EMACS_INT prop_pos = | ||
| 13890 | string_buffer_position_lim (glyph->object, pos_before, | ||
| 13891 | pos_after, 0); | ||
| 13892 | |||
| 13893 | if (prop_pos >= pos_before) | ||
| 13894 | bpos_max = prop_pos - 1; | ||
| 13895 | } | ||
| 13872 | if (INTEGERP (chprop)) | 13896 | if (INTEGERP (chprop)) |
| 13873 | { | 13897 | { |
| 13874 | bpos_covered = bpos_max + XINT (chprop); | 13898 | bpos_covered = bpos_max + XINT (chprop); |