aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChong Yidong2007-04-16 15:12:24 +0000
committerChong Yidong2007-04-16 15:12:24 +0000
commit9292c85bc37a116dece4cf6a0b597c650d07f852 (patch)
tree420d03a792fc261c11742a88e6ed0bdd248e0165 /src
parent837751ae73d009fd7fdb4f8f776231c263cff835 (diff)
downloademacs-9292c85bc37a116dece4cf6a0b597c650d07f852.tar.gz
emacs-9292c85bc37a116dece4cf6a0b597c650d07f852.zip
(cursor_row_p): Only end row on newline if it's a display string.
Suggested by Lennart Borgman.
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 9c8f7b6a814..3e6d488cef3 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -15865,13 +15865,37 @@ cursor_row_p (w, row)
15865 15865
15866 if (PT == MATRIX_ROW_END_CHARPOS (row)) 15866 if (PT == MATRIX_ROW_END_CHARPOS (row))
15867 { 15867 {
15868 /* If the row ends with a newline from a string, we don't want 15868 /* Suppose the row ends on a string.
15869 the cursor there, but we still want it at the start of the 15869 Unless the row is continued, that means it ends on a newline
15870 string if the string starts in this row. 15870 in the string. If it's anything other than a display string
15871 If the row is continued it doesn't end in a newline. */ 15871 (e.g. a before-string from an overlay), we don't want the
15872 cursor there. (This heuristic seems to give the optimal
15873 behavior for the various types of multi-line strings.) */
15872 if (CHARPOS (row->end.string_pos) >= 0) 15874 if (CHARPOS (row->end.string_pos) >= 0)
15873 cursor_row_p = (row->continued_p 15875 {
15874 || PT >= MATRIX_ROW_START_CHARPOS (row)); 15876 if (row->continued_p)
15877 cursor_row_p = 1;
15878 else
15879 {
15880 /* Check for `display' property. */
15881 struct glyph *beg = row->glyphs[TEXT_AREA];
15882 struct glyph *end = beg + row->used[TEXT_AREA] - 1;
15883 struct glyph *glyph;
15884
15885 cursor_row_p = 0;
15886 for (glyph = end; glyph >= beg; --glyph)
15887 if (STRINGP (glyph->object))
15888 {
15889 Lisp_Object prop
15890 = Fget_char_property (make_number (PT),
15891 Qdisplay, Qnil);
15892 cursor_row_p =
15893 (!NILP (prop)
15894 && display_prop_string_p (prop, glyph->object));
15895 break;
15896 }
15897 }
15898 }
15875 else if (MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row)) 15899 else if (MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row))
15876 { 15900 {
15877 /* If the row ends in middle of a real character, 15901 /* If the row ends in middle of a real character,