Fix cursor positioning in partial width windows on TTY.
authorEli Zaretskii <eliz@gnu.org>
Sat, 1 May 2010 15:53:35 +0000 (18:53 +0300)
committerEli Zaretskii <eliz@gnu.org>
Sat, 1 May 2010 15:53:35 +0000 (18:53 +0300)
 xdisp.c (set_cursor_from_row): Don't place cursor on the vertical border
 glyph between adjacent windows.
 (try_cursor_movement): Don't assume that row->end == (row+1)->start,
 test for that explicitly.

src/ChangeLog
src/xdisp.c

index 7becf77..4de1618 100644 (file)
@@ -7,6 +7,10 @@
        (display_line): Fix prepending of truncation glyphs to R2L rows.
        (insert_left_trunc_glyphs): Support addition of left truncation
        glyphs to R2L rows.
+       (set_cursor_from_row): Don't place cursor on the vertical border
+       glyph between adjacent windows.
+       (try_cursor_movement): Don't assume that row->end == (row+1)->start,
+       test for that explicitly.
 
 2010-04-27  Eli Zaretskii  <eliz@gnu.org>
 
index 6d0683b..6d90682 100644 (file)
@@ -12776,6 +12776,13 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
         rightmost glyph.  Case in point: an empty last line that is
         part of an R2L paragraph.  */
       cursor = end - 1;
+      /* Avoid placing the cursor on the last glyph of the row, where
+        on terminal frames we hold the vertical border between
+        adjacent windows.  */
+      if (!FRAME_WINDOW_P (WINDOW_XFRAME (w))
+         && !WINDOW_RIGHTMOST_P (w)
+         && cursor == row->glyphs[LAST_AREA] - 1)
+       cursor--;
       x = -1;  /* will be computed below, at label compute_x */
     }
 
@@ -13716,11 +13723,14 @@ try_cursor_movement (window, startp, scroll_step)
                  ++row;
                }
 
-             /* The end position of a row equals the start position
-                of the next row.  If PT is there, we would rather
-                display it in the next line.  */
+             /* If the end position of a row equals the start
+                position of the next row, and PT is at that position,
+                we would rather display cursor in the next line.  */
              while (MATRIX_ROW_BOTTOM_Y (row) < last_y
                     && MATRIX_ROW_END_CHARPOS (row) == PT
+                    && row < w->current_matrix->rows
+                               + w->current_matrix->nrows - 1
+                    && MATRIX_ROW_START_CHARPOS (row+1) == PT
                     && !cursor_row_p (w, row))
                ++row;