emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] scratch/line-numbers a06dd3b 6/9: Fix hscrolling with line


From: Eli Zaretskii
Subject: [Emacs-diffs] scratch/line-numbers a06dd3b 6/9: Fix hscrolling with line numbers on TTY frames
Date: Fri, 30 Jun 2017 10:41:20 -0400 (EDT)

branch: scratch/line-numbers
commit a06dd3b9187489b61f08256d9e9a07745302dc4e
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Fix hscrolling with line numbers on TTY frames
    
    * src/xdisp.c (hscroll_window_tree): Correct the X offset
    calculations on TTY frames.
    * src/term.c (produce_glyphs): Use it->lnum_pixel_width instead of
    a kludge using it->lnum_width.
---
 src/term.c  | 10 ++++++----
 src/xdisp.c |  9 ++++++++-
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/src/term.c b/src/term.c
index 46d8bff..00a272c 100644
--- a/src/term.c
+++ b/src/term.c
@@ -1584,14 +1584,16 @@ produce_glyphs (struct it *it)
     {
       int absolute_x = (it->current_x
                        + it->continuation_lines_width);
-      /* Adjust for line numbers.  Kludge alert: the "2" below is
-        because we add 2 blanks to the actual line number.  */
+      int x0 = absolute_x;
+      /* Adjust for line numbers.  */
       if (!NILP (Vdisplay_line_numbers))
-       absolute_x -= it->lnum_width + 2 - it->w->hscroll;
+       absolute_x -= it->lnum_pixel_width;
       int next_tab_x
        = (((1 + absolute_x + it->tab_width - 1)
            / it->tab_width)
           * it->tab_width);
+      if (!NILP (Vdisplay_line_numbers))
+       next_tab_x += it->lnum_pixel_width;
       int nspaces;
 
       /* If part of the TAB has been displayed on the previous line
@@ -1599,7 +1601,7 @@ produce_glyphs (struct it *it)
         been incremented already by the part that fitted on the
         continued line.  So, we will get the right number of spaces
         here.  */
-      nspaces = next_tab_x - absolute_x;
+      nspaces = next_tab_x - x0;
 
       if (it->glyph_row)
        {
diff --git a/src/xdisp.c b/src/xdisp.c
index 3fc5f29..26b19eb 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -13100,6 +13100,12 @@ hscroll_window_tree (Lisp_Object window)
                    }
                }
            }
+         if (cursor_row->truncated_on_left_p)
+           {
+             /* On TTY frames, don't count the left truncation glyph.  */
+             struct frame *f = XFRAME (WINDOW_FRAME (w));
+             x_offset -= (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f));
+           }
 
          text_area_width = window_box_width (w, TEXT_AREA);
 
@@ -28004,7 +28010,8 @@ x_produce_glyphs (struct it *it)
                x -= it->lnum_pixel_width;
              int next_tab_x = ((1 + x + tab_width - 1) / tab_width) * 
tab_width;
              if (!NILP (Vdisplay_line_numbers))
-               next_tab_x += it->lnum_pixel_width;
+               next_tab_x += (it->lnum_pixel_width
+                              - it->w->hscroll * font->space_width);
 
              /* If the distance from the current position to the next tab
                 stop is less than a space character width, use the



reply via email to

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