diff options
| author | Eli Zaretskii | 2013-05-08 20:59:38 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2013-05-08 20:59:38 +0300 |
| commit | 07525f7737602af36afe40f85f229fee9887f232 (patch) | |
| tree | 4a3141cdbf5b0727e4abd0b33d121edb10cb348a /src | |
| parent | 1d5963cc63979c4a19b5de3b9b537c1b3b61dda3 (diff) | |
| download | emacs-07525f7737602af36afe40f85f229fee9887f232.tar.gz emacs-07525f7737602af36afe40f85f229fee9887f232.zip | |
Fix vertical cursor motion when there's a display string with newline at EOL.
src/xdisp.c (row_for_charpos_p): New function, with code of
cursor_row_p, but accepts an additional argument CHARPOS instead
of using a hardcoded PT.
(cursor_row_p): Call row_for_charpos_p with 2nd argument PT.
(row_containing_pos): Call row_for_charpos_p instead of partially
doing the same. Fixes cursor positioning under longlines-mode
when longlines-show-effect includes more than one newline, when
moving the cursor vertically up.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 11 | ||||
| -rw-r--r-- | src/xdisp.c | 35 |
2 files changed, 33 insertions, 13 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 64b76af0b85..c8e2abf3bec 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 2013-05-08 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * xdisp.c (row_for_charpos_p): New function, with code of | ||
| 4 | cursor_row_p, but accepts an additional argument CHARPOS instead | ||
| 5 | of using a hardcoded PT. | ||
| 6 | (cursor_row_p): Call row_for_charpos_p with 2nd argument PT. | ||
| 7 | (row_containing_pos): Call row_for_charpos_p instead of partially | ||
| 8 | doing the same. Fixes cursor positioning under longlines-mode | ||
| 9 | when longlines-show-effect includes more than one newline, when | ||
| 10 | moving the cursor vertically up. | ||
| 11 | |||
| 1 | 2013-05-08 Juanma Barranquero <lekktu@gmail.com> | 12 | 2013-05-08 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 13 | ||
| 3 | * makefile.w32-in (ACL_H): New macro. | 14 | * makefile.w32-in (ACL_H): New macro. |
diff --git a/src/xdisp.c b/src/xdisp.c index c7a25873272..0a79e6fd891 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -794,6 +794,7 @@ static void set_iterator_to_next (struct it *, int); | |||
| 794 | static void mark_window_display_accurate_1 (struct window *, int); | 794 | static void mark_window_display_accurate_1 (struct window *, int); |
| 795 | static int single_display_spec_string_p (Lisp_Object, Lisp_Object); | 795 | static int single_display_spec_string_p (Lisp_Object, Lisp_Object); |
| 796 | static int display_prop_string_p (Lisp_Object, Lisp_Object); | 796 | static int display_prop_string_p (Lisp_Object, Lisp_Object); |
| 797 | static int row_for_charpos_p (struct glyph_row *, ptrdiff_t); | ||
| 797 | static int cursor_row_p (struct glyph_row *); | 798 | static int cursor_row_p (struct glyph_row *); |
| 798 | static int redisplay_mode_lines (Lisp_Object, int); | 799 | static int redisplay_mode_lines (Lisp_Object, int); |
| 799 | static char *decode_mode_spec_coding (Lisp_Object, char *, int); | 800 | static char *decode_mode_spec_coding (Lisp_Object, char *, int); |
| @@ -16909,10 +16910,9 @@ row_containing_pos (struct window *w, ptrdiff_t charpos, | |||
| 16909 | || (MATRIX_ROW_END_CHARPOS (row) == charpos | 16910 | || (MATRIX_ROW_END_CHARPOS (row) == charpos |
| 16910 | /* The end position of a row equals the start | 16911 | /* The end position of a row equals the start |
| 16911 | position of the next row. If CHARPOS is there, we | 16912 | position of the next row. If CHARPOS is there, we |
| 16912 | would rather display it in the next line, except | 16913 | would rather consider it displayed in the next |
| 16913 | when this line ends in ZV. */ | 16914 | line, except when this line ends in ZV. */ |
| 16914 | && !row->ends_at_zv_p | 16915 | && !row_for_charpos_p (row, charpos))) |
| 16915 | && !MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row))) | ||
| 16916 | && charpos >= MATRIX_ROW_START_CHARPOS (row)) | 16916 | && charpos >= MATRIX_ROW_START_CHARPOS (row)) |
| 16917 | { | 16917 | { |
| 16918 | struct glyph *g; | 16918 | struct glyph *g; |
| @@ -16920,10 +16920,10 @@ row_containing_pos (struct window *w, ptrdiff_t charpos, | |||
| 16920 | if (NILP (BVAR (XBUFFER (w->contents), bidi_display_reordering)) | 16920 | if (NILP (BVAR (XBUFFER (w->contents), bidi_display_reordering)) |
| 16921 | || (!best_row && !row->continued_p)) | 16921 | || (!best_row && !row->continued_p)) |
| 16922 | return row; | 16922 | return row; |
| 16923 | /* In bidi-reordered rows, there could be several rows | 16923 | /* In bidi-reordered rows, there could be several rows whose |
| 16924 | occluding point, all of them belonging to the same | 16924 | edges surround CHARPOS, all of these rows belonging to |
| 16925 | continued line. We need to find the row which fits | 16925 | the same continued line. We need to find the row which |
| 16926 | CHARPOS the best. */ | 16926 | fits CHARPOS the best. */ |
| 16927 | for (g = row->glyphs[TEXT_AREA]; | 16927 | for (g = row->glyphs[TEXT_AREA]; |
| 16928 | g < row->glyphs[TEXT_AREA] + row->used[TEXT_AREA]; | 16928 | g < row->glyphs[TEXT_AREA] + row->used[TEXT_AREA]; |
| 16929 | g++) | 16929 | g++) |
| @@ -18727,15 +18727,15 @@ highlight_trailing_whitespace (struct frame *f, struct glyph_row *row) | |||
| 18727 | 18727 | ||
| 18728 | 18728 | ||
| 18729 | /* Value is non-zero if glyph row ROW should be | 18729 | /* Value is non-zero if glyph row ROW should be |
| 18730 | used to hold the cursor. */ | 18730 | considered to hold the buffer position CHARPOS. */ |
| 18731 | 18731 | ||
| 18732 | static int | 18732 | static int |
| 18733 | cursor_row_p (struct glyph_row *row) | 18733 | row_for_charpos_p (struct glyph_row *row, ptrdiff_t charpos) |
| 18734 | { | 18734 | { |
| 18735 | int result = 1; | 18735 | int result = 1; |
| 18736 | 18736 | ||
| 18737 | if (PT == CHARPOS (row->end.pos) | 18737 | if (charpos == CHARPOS (row->end.pos) |
| 18738 | || PT == MATRIX_ROW_END_CHARPOS (row)) | 18738 | || charpos == MATRIX_ROW_END_CHARPOS (row)) |
| 18739 | { | 18739 | { |
| 18740 | /* Suppose the row ends on a string. | 18740 | /* Suppose the row ends on a string. |
| 18741 | Unless the row is continued, that means it ends on a newline | 18741 | Unless the row is continued, that means it ends on a newline |
| @@ -18761,7 +18761,7 @@ cursor_row_p (struct glyph_row *row) | |||
| 18761 | if (STRINGP (glyph->object)) | 18761 | if (STRINGP (glyph->object)) |
| 18762 | { | 18762 | { |
| 18763 | Lisp_Object prop | 18763 | Lisp_Object prop |
| 18764 | = Fget_char_property (make_number (PT), | 18764 | = Fget_char_property (make_number (charpos), |
| 18765 | Qdisplay, Qnil); | 18765 | Qdisplay, Qnil); |
| 18766 | result = | 18766 | result = |
| 18767 | (!NILP (prop) | 18767 | (!NILP (prop) |
| @@ -18815,6 +18815,15 @@ cursor_row_p (struct glyph_row *row) | |||
| 18815 | return result; | 18815 | return result; |
| 18816 | } | 18816 | } |
| 18817 | 18817 | ||
| 18818 | /* Value is non-zero if glyph row ROW should be | ||
| 18819 | used to hold the cursor. */ | ||
| 18820 | |||
| 18821 | static int | ||
| 18822 | cursor_row_p (struct glyph_row *row) | ||
| 18823 | { | ||
| 18824 | return row_for_charpos_p (row, PT); | ||
| 18825 | } | ||
| 18826 | |||
| 18818 | 18827 | ||
| 18819 | 18828 | ||
| 18820 | /* Push the property PROP so that it will be rendered at the current | 18829 | /* Push the property PROP so that it will be rendered at the current |