diff options
| author | Eli Zaretskii | 2010-08-28 12:32:44 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2010-08-28 12:32:44 +0300 |
| commit | 544bbc31d93719ca7419f6da97809ad5eef1c378 (patch) | |
| tree | f5ffedff94868d2c11c70b24da0382487f54d184 /src | |
| parent | efb6b75c91427015e4cf7c0fc0492e56a41b2c61 (diff) | |
| download | emacs-544bbc31d93719ca7419f6da97809ad5eef1c378.tar.gz emacs-544bbc31d93719ca7419f6da97809ad5eef1c378.zip | |
Fix L2R code using bug #1220 as a test case.
xdisp.c (mouse_face_from_buffer_pos): before_string and after_string
are also relevant when they come from an overlay.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/xdisp.c | 21 |
2 files changed, 17 insertions, 9 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 242018c4061..9b7c11d3bde 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2010-08-28 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * xdisp.c (mouse_face_from_buffer_pos): Fix code using bug#1220 as | ||
| 4 | test case. | ||
| 5 | |||
| 1 | 2010-08-21 Eli Zaretskii <eliz@gnu.org> | 6 | 2010-08-21 Eli Zaretskii <eliz@gnu.org> |
| 2 | 7 | ||
| 3 | * xdisp.c (mouse_face_from_buffer_pos): Support mouse highlight in | 8 | * xdisp.c (mouse_face_from_buffer_pos): Support mouse highlight in |
diff --git a/src/xdisp.c b/src/xdisp.c index 7fcbab718b1..c6d441fa6c1 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -23897,7 +23897,7 @@ mouse_face_from_buffer_pos (Lisp_Object window, | |||
| 23897 | between START_CHARPOS and END_CHARPOS, and highlight all the | 23897 | between START_CHARPOS and END_CHARPOS, and highlight all the |
| 23898 | glyphs between those two. This may cover more than just the | 23898 | glyphs between those two. This may cover more than just the |
| 23899 | text between START_CHARPOS and END_CHARPOS if the range of | 23899 | text between START_CHARPOS and END_CHARPOS if the range of |
| 23900 | characters strides the the bidi level boundary, e.g. if the | 23900 | characters strides the bidi level boundary, e.g. if the |
| 23901 | beginning is in R2L text while the end is in L2R text or vice | 23901 | beginning is in R2L text while the end is in L2R text or vice |
| 23902 | versa. */ | 23902 | versa. */ |
| 23903 | if (!row->reversed_p) | 23903 | if (!row->reversed_p) |
| @@ -23929,18 +23929,21 @@ mouse_face_from_buffer_pos (Lisp_Object window, | |||
| 23929 | { | 23929 | { |
| 23930 | /* BEFORE_STRING or AFTER_STRING are only relevant if | 23930 | /* BEFORE_STRING or AFTER_STRING are only relevant if |
| 23931 | they are present at buffer positions between | 23931 | they are present at buffer positions between |
| 23932 | START_CHARPOS and END_CHARPOS. */ | 23932 | START_CHARPOS and END_CHARPOS, or if they come from |
| 23933 | an overlay. */ | ||
| 23933 | if (EQ (glyph->object, before_string)) | 23934 | if (EQ (glyph->object, before_string)) |
| 23934 | { | 23935 | { |
| 23935 | pos = string_buffer_position (w, before_string, | 23936 | pos = string_buffer_position (w, before_string, |
| 23936 | start_charpos); | 23937 | start_charpos); |
| 23937 | if (pos && pos >= start_charpos && pos < end_charpos) | 23938 | /* If pos == 0, it means before_string came from an |
| 23939 | overlay, not from a buffer position. */ | ||
| 23940 | if (!pos || pos >= start_charpos && pos < end_charpos) | ||
| 23938 | break; | 23941 | break; |
| 23939 | } | 23942 | } |
| 23940 | else if (EQ (glyph->object, after_string)) | 23943 | else if (EQ (glyph->object, after_string)) |
| 23941 | { | 23944 | { |
| 23942 | pos = string_buffer_position (w, after_string, end_charpos); | 23945 | pos = string_buffer_position (w, after_string, end_charpos); |
| 23943 | if (pos && pos >= start_charpos && pos < end_charpos) | 23946 | if (!pos || pos >= start_charpos && pos < end_charpos) |
| 23944 | break; | 23947 | break; |
| 23945 | } | 23948 | } |
| 23946 | x += glyph->pixel_width; | 23949 | x += glyph->pixel_width; |
| @@ -24001,19 +24004,19 @@ mouse_face_from_buffer_pos (Lisp_Object window, | |||
| 24001 | && end->charpos < end_charpos)); | 24004 | && end->charpos < end_charpos)); |
| 24002 | --end) | 24005 | --end) |
| 24003 | { | 24006 | { |
| 24004 | /* BEFORE_STRING or AFTER_STRING are only relevant if | 24007 | /* BEFORE_STRING or AFTER_STRING are only relevant if they |
| 24005 | they are present at buffer positions between | 24008 | are present at buffer positions between START_CHARPOS and |
| 24006 | START_CHARPOS and END_CHARPOS. */ | 24009 | END_CHARPOS, or if they come from an overlay. */ |
| 24007 | if (EQ (end->object, before_string)) | 24010 | if (EQ (end->object, before_string)) |
| 24008 | { | 24011 | { |
| 24009 | pos = string_buffer_position (w, before_string, start_charpos); | 24012 | pos = string_buffer_position (w, before_string, start_charpos); |
| 24010 | if (pos && pos >= start_charpos && pos < end_charpos) | 24013 | if (!pos || pos >= start_charpos && pos < end_charpos) |
| 24011 | break; | 24014 | break; |
| 24012 | } | 24015 | } |
| 24013 | else if (EQ (end->object, after_string)) | 24016 | else if (EQ (end->object, after_string)) |
| 24014 | { | 24017 | { |
| 24015 | pos = string_buffer_position (w, after_string, end_charpos); | 24018 | pos = string_buffer_position (w, after_string, end_charpos); |
| 24016 | if (pos && pos >= start_charpos && pos < end_charpos) | 24019 | if (!pos || pos >= start_charpos && pos < end_charpos) |
| 24017 | break; | 24020 | break; |
| 24018 | } | 24021 | } |
| 24019 | } | 24022 | } |