[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-24 r116842: Fix bug #17047 with cursor motion when i
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] emacs-24 r116842: Fix bug #17047 with cursor motion when invisible text starts a line. |
Date: |
Sun, 23 Mar 2014 15:58:47 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 116842
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/17047
committer: Eli Zaretskii <address@hidden>
branch nick: emacs-24
timestamp: Sun 2014-03-23 17:57:25 +0200
message:
Fix bug #17047 with cursor motion when invisible text starts a line.
src/xdisp.c (redisplay_window): If all previous attempts to find the
cursor row failed, try a few alternatives before falling back to
the top-most row of the window. Use row_containing_pos.
modified:
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/xdisp.c xdisp.c-20091113204419-o5vbwnq5f7feedwu-240
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2014-03-23 06:07:54 +0000
+++ b/src/ChangeLog 2014-03-23 15:57:25 +0000
@@ -1,3 +1,9 @@
+2014-03-23 Eli Zaretskii <address@hidden>
+
+ * xdisp.c (redisplay_window): If all previous attempts to find the
+ cursor row failed, try a few alternatives before falling back to
+ the top-most row of the window. (Bug#17047)
+
2014-03-22 Daniel Colascione <address@hidden>
* process.c (conv_sockaddr_to_lisp): When extracting the string
=== modified file 'src/xdisp.c'
--- a/src/xdisp.c 2014-03-20 14:09:37 +0000
+++ b/src/xdisp.c 2014-03-23 15:57:25 +0000
@@ -16400,12 +16400,50 @@
/* Consider the following case: Window starts at BEGV, there is
invisible, intangible text at BEGV, so that display starts at
some point START > BEGV. It can happen that we are called with
- PT somewhere between BEGV and START. Try to handle that case. */
+ PT somewhere between BEGV and START. Try to handle that case,
+ and similar ones. */
if (w->cursor.vpos < 0)
{
- struct glyph_row *row = w->current_matrix->rows;
- if (row->mode_line_p)
- ++row;
+ /* First, try locating the proper glyph row for PT. */
+ struct glyph_row *row =
+ row_containing_pos (w, PT, w->current_matrix->rows, NULL, 0);
+
+ /* Sometimes point is at the beginning of invisible text that is
+ before the 1st character displayed in the row. In that case,
+ row_containing_pos fails to find the row, because no glyphs
+ with appropriate buffer positions are present in the row.
+ Therefore, we next try to find the row which shows the 1st
+ position after the invisible text. */
+ if (!row)
+ {
+ Lisp_Object val =
+ get_char_property_and_overlay (make_number (PT), Qinvisible,
+ Qnil, NULL);
+
+ if (TEXT_PROP_MEANS_INVISIBLE (val))
+ {
+ ptrdiff_t alt_pos;
+ Lisp_Object invis_end =
+ Fnext_single_char_property_change (make_number (PT), Qinvisible,
+ Qnil, Qnil);
+
+ if (NATNUMP (invis_end))
+ alt_pos = XFASTINT (invis_end);
+ else
+ alt_pos = ZV;
+ row = row_containing_pos (w, alt_pos, w->current_matrix->rows,
+ NULL, 0);
+ }
+ }
+ /* Finally, fall back on the first row of the window after the
+ header line (if any). This is slightly better than not
+ displaying the cursor at all. */
+ if (!row)
+ {
+ row = w->current_matrix->rows;
+ if (row->mode_line_p)
+ ++row;
+ }
set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs-24 r116842: Fix bug #17047 with cursor motion when invisible text starts a line.,
Eli Zaretskii <=