summaryrefslogtreecommitdiff
path: root/src/xdisp.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2010-11-17 21:15:24 +0200
committerEli Zaretskii <eliz@gnu.org>2010-11-17 21:15:24 +0200
commit146d267b8b8ef2c1823d54eb8a056bb6c443a22d (patch)
tree3c0feb862315b9394c7cd460444af1d4ea5553f7 /src/xdisp.c
parentfad0d5651923be042a38d89dfbd67c97dfd92a56 (diff)
downloademacs-146d267b8b8ef2c1823d54eb8a056bb6c443a22d.tar.gz
Fix bug #7417 with cursor positioning on empty lines.
xdisp.c (set_cursor_from_row): Fix cursor positioning in empty lines on text-mode terminals.
Diffstat (limited to 'src/xdisp.c')
-rw-r--r--src/xdisp.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index d3ebc1a4a8a..e02abf6a5b5 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -12839,6 +12839,15 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
&& BUFFERP (glyph->object) && glyph->charpos == pt_old)
&& bpos_covered < pt_old)
{
+ /* An empty line has a single glyph whose OBJECT is zero and
+ whose CHARPOS is the position of a newline on that line.
+ Note that on a TTY, there are more glyphs after that, which
+ were produced by extend_face_to_end_of_line, but their
+ CHARPOS is zero or negative. */
+ int empty_line_p =
+ (row->reversed_p ? glyph > glyphs_end : glyph < glyphs_end)
+ && INTEGERP (glyph->object) && glyph->charpos > 0;
+
if (row->ends_in_ellipsis_p && pos_after == last_pos)
{
EMACS_INT ellipsis_pos;
@@ -12875,6 +12884,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
|| (row->truncated_on_right_p && pt_old > bpos_max)
/* Zero-width characters produce no glyphs. */
|| (!string_seen
+ && !empty_line_p
&& (row->reversed_p
? glyph_after > glyphs_end
: glyph_after < glyphs_end)))