emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] scratch/line-numbers 55a9298 07/14: Fix tab stops when lin


From: Eli Zaretskii
Subject: [Emacs-diffs] scratch/line-numbers 55a9298 07/14: Fix tab stops when line numbers are displayed
Date: Sat, 24 Jun 2017 13:12:52 -0400 (EDT)

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

    Fix tab stops when line numbers are displayed
    
    * src/xdisp.c (x_produce_glyphs):
    * src/term.c (produce_glyphs): Adjust tab stops for the horizontal
    space taken by the line-number display.
---
 src/term.c  | 4 ++++
 src/xdisp.c | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/src/term.c b/src/term.c
index 8770aff..b0e7e05 100644
--- a/src/term.c
+++ b/src/term.c
@@ -1584,6 +1584,10 @@ 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.  */
+      if (!NILP (Vdisplay_line_numbers))
+       absolute_x -= it->lnum_width + 2;
       int next_tab_x
        = (((1 + absolute_x + it->tab_width - 1)
            / it->tab_width)
diff --git a/src/xdisp.c b/src/xdisp.c
index f98e7a9..5f86f0b 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -27865,6 +27865,10 @@ x_produce_glyphs (struct it *it)
            {
              int tab_width = it->tab_width * font->space_width;
              int 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.  */
+             if (!NILP (Vdisplay_line_numbers))
+               x -= (it->lnum_width + 2) * font->space_width;
              int next_tab_x = ((1 + x + tab_width - 1) / tab_width) * 
tab_width;
 
              /* If the distance from the current position to the next tab



reply via email to

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