emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r101714: Fix bug #6349 with cursor po


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r101714: Fix bug #6349 with cursor positioning in truncated lines.
Date: Fri, 01 Oct 2010 19:38:36 +0200
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 101714
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Fri 2010-10-01 19:38:36 +0200
message:
  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.
modified:
  src/ChangeLog
  src/xdisp.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2010-10-01 13:56:33 +0000
+++ b/src/ChangeLog     2010-10-01 17:38:36 +0000
@@ -1,3 +1,9 @@
+2010-10-01  Eli Zaretskii  <address@hidden>
+
+       * 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.  (Bug#6349)
+
 2010-10-01  Dan Nicolaescu  <address@hidden>
 
        Do not include stdlib.h and string.h, config.h does it.

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2010-09-29 09:52:43 +0000
+++ b/src/xdisp.c       2010-10-01 17:38:36 +0000
@@ -12494,8 +12494,10 @@
   /* Non-zero means we've seen at least one glyph that came from a
      display string.  */
   int string_seen = 0;
-  /* Largest buffer position seen so far during scan of glyph row.  */
-  EMACS_INT bpos_max = last_pos;
+  /* Largest and smalles buffer positions seen so far during scan of
+     glyph row.  */
+  EMACS_INT bpos_max = pos_before;
+  EMACS_INT bpos_min = pos_after;
   /* Last buffer position covered by an overlay string with an integer
      `cursor' property.  */
   EMACS_INT bpos_covered = 0;
@@ -12585,6 +12587,8 @@
 
            if (glyph->charpos > bpos_max)
              bpos_max = glyph->charpos;
+           if (glyph->charpos < bpos_min)
+             bpos_min = glyph->charpos;
            if (!glyph->avoid_cursor_p)
              {
                /* If we hit point, we've found the glyph on which to
@@ -12659,6 +12663,8 @@
 
            if (glyph->charpos > bpos_max)
              bpos_max = glyph->charpos;
+           if (glyph->charpos < bpos_min)
+             bpos_min = glyph->charpos;
            if (!glyph->avoid_cursor_p)
              {
                if (dpos == 0)
@@ -12745,7 +12751,13 @@
            }
        }
       else if (match_with_avoid_cursor
-              /* zero-width characters produce no glyphs */
+              /* A truncated row may not include PT among its
+                 character positions.  Setting the cursor inside the
+                 scroll margin will trigger recalculation of hscroll
+                 in hscroll_window_tree.  */
+              || (row->truncated_on_left_p && pt_old < bpos_min)
+              || (row->truncated_on_right_p && pt_old > bpos_max)
+              /* Zero-width characters produce no glyphs.  */
               || ((row->reversed_p
                    ? glyph_after > glyphs_end
                    : glyph_after < glyphs_end)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]