aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2010-10-01 19:38:36 +0200
committerEli Zaretskii2010-10-01 19:38:36 +0200
commit54cc6a8387d4d59ae7a280a7e0adb05735a4aa8c (patch)
tree0a01bf312c030cb6f95f284fa7857e8c81ef0796 /src
parent82b9f9f5f4d356f49f76d60981a5925888205f12 (diff)
downloademacs-54cc6a8387d4d59ae7a280a7e0adb05735a4aa8c.tar.gz
emacs-54cc6a8387d4d59ae7a280a7e0adb05735a4aa8c.zip
Fix bug #6349 with cursor positioning in truncated lines.
xdisp.c (set_cursor_from_row): When the row is truncated and point is outside the range of displayed characters, position the cursor inside the scroll margin.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/xdisp.c18
2 files changed, 21 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 5e7ac0cc4b2..c7bdb0b2d84 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12010-10-01 Eli Zaretskii <eliz@gnu.org>
2
3 * xdisp.c (set_cursor_from_row): When the row is truncated and
4 point is outside the range of displayed characters, position the
5 cursor inside the scroll margin. (Bug#6349)
6
12010-10-01 Dan Nicolaescu <dann@ics.uci.edu> 72010-10-01 Dan Nicolaescu <dann@ics.uci.edu>
2 8
3 Do not include stdlib.h and string.h, config.h does it. 9 Do not include stdlib.h and string.h, config.h does it.
diff --git a/src/xdisp.c b/src/xdisp.c
index 9b0f94ef657..4c007e572ce 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -12494,8 +12494,10 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
12494 /* Non-zero means we've seen at least one glyph that came from a 12494 /* Non-zero means we've seen at least one glyph that came from a
12495 display string. */ 12495 display string. */
12496 int string_seen = 0; 12496 int string_seen = 0;
12497 /* Largest buffer position seen so far during scan of glyph row. */ 12497 /* Largest and smalles buffer positions seen so far during scan of
12498 EMACS_INT bpos_max = last_pos; 12498 glyph row. */
12499 EMACS_INT bpos_max = pos_before;
12500 EMACS_INT bpos_min = pos_after;
12499 /* Last buffer position covered by an overlay string with an integer 12501 /* Last buffer position covered by an overlay string with an integer
12500 `cursor' property. */ 12502 `cursor' property. */
12501 EMACS_INT bpos_covered = 0; 12503 EMACS_INT bpos_covered = 0;
@@ -12585,6 +12587,8 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
12585 12587
12586 if (glyph->charpos > bpos_max) 12588 if (glyph->charpos > bpos_max)
12587 bpos_max = glyph->charpos; 12589 bpos_max = glyph->charpos;
12590 if (glyph->charpos < bpos_min)
12591 bpos_min = glyph->charpos;
12588 if (!glyph->avoid_cursor_p) 12592 if (!glyph->avoid_cursor_p)
12589 { 12593 {
12590 /* If we hit point, we've found the glyph on which to 12594 /* If we hit point, we've found the glyph on which to
@@ -12659,6 +12663,8 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
12659 12663
12660 if (glyph->charpos > bpos_max) 12664 if (glyph->charpos > bpos_max)
12661 bpos_max = glyph->charpos; 12665 bpos_max = glyph->charpos;
12666 if (glyph->charpos < bpos_min)
12667 bpos_min = glyph->charpos;
12662 if (!glyph->avoid_cursor_p) 12668 if (!glyph->avoid_cursor_p)
12663 { 12669 {
12664 if (dpos == 0) 12670 if (dpos == 0)
@@ -12745,7 +12751,13 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
12745 } 12751 }
12746 } 12752 }
12747 else if (match_with_avoid_cursor 12753 else if (match_with_avoid_cursor
12748 /* zero-width characters produce no glyphs */ 12754 /* A truncated row may not include PT among its
12755 character positions. Setting the cursor inside the
12756 scroll margin will trigger recalculation of hscroll
12757 in hscroll_window_tree. */
12758 || (row->truncated_on_left_p && pt_old < bpos_min)
12759 || (row->truncated_on_right_p && pt_old > bpos_max)
12760 /* Zero-width characters produce no glyphs. */
12749 || ((row->reversed_p 12761 || ((row->reversed_p
12750 ? glyph_after > glyphs_end 12762 ? glyph_after > glyphs_end
12751 : glyph_after < glyphs_end) 12763 : glyph_after < glyphs_end)