emacs-devel
[Top][All Lists]
Advanced

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

Re: Problems with move_it_in_display_line_to X when tabs exist.


From: Keith David Bershatsky
Subject: Re: Problems with move_it_in_display_line_to X when tabs exist.
Date: Sun, 14 Jan 2018 21:48:12 -0800

I am still working on troubleshooting how the value of it->pixel_width is 
determined.  In the current fact pattern, I am using the following settings:

  (setq display-line-numbers t)
  (setq buffer-display-table (make-display-table))
  (aset buffer-display-table
        ?\t
        (vector (make-glyph-code ?\u00BB 'font-lock-warning-face)
                (make-glyph-code ?\t 'highlight)))
  (setq tab-width 8)

I am placing a tab at flush-left and some text following the tab, such as:

        Hello-world.

I am calling interactively (scroll-left 1) to temporarily scroll the text to 
the left 1 column at a time.

I believe that x_produce_glyphs sets the it->pixel-width of the stretch tab 
incorrectly (while scrolling 2 or more columns to the left), which affects the 
ability to properly move by it.pixel_width when calling 
move_it_in_display_line_to.  As far as I can tell, this problem _only_ happens 
when displaying native line numbers.

The problem likely begins at line 28228 of xdisp.c where we have a comment:

/* i.e. (it->char_to_display == '\t') */

I am trying to understand that section of code.

QUESTION:  Is this line of code:

  int next_tab_x = ((1 + x + tab_width - 1) / tab_width) * tab_width;

the same thing as:

  int next_tab_x = x + tab_width;

If we add 1 and then subtract 1, we did not do anything meaningful.

If we divide something by tab_width and then multiply it by tab_width, then we 
are back again at where we started.

EXAMPLE #1:  (1 + 11 + 77 - 1) / 77) * 77 = 88

EXAMPLE #2:  11 + 77 = 88

Thanks,

Keith



reply via email to

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