all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Keith David Bershatsky <esq@lawlist.com>
Cc: emacs-devel@gnu.org
Subject: Re: Problems with move_it_in_display_line_to X when tabs exist.
Date: Mon, 15 Jan 2018 14:06:35 +0200	[thread overview]
Message-ID: <83d12bz5pw.fsf@gnu.org> (raw)
In-Reply-To: <m2k1wjk6zn.wl%esq@lawlist.com> (message from Keith David Bershatsky on Sun, 14 Jan 2018 21:48:12 -0800)

> Date:  Sun, 14 Jan 2018 21:48:12 -0800
> From:  Keith David Bershatsky <esq@lawlist.com>
> Cc:  emacs-devel@gnu.org
> 
> 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.

As previously, please provide a complete recipe, with text that needs
to be inserted into a buffer, and the commands that show why you think
the pixel_width is calculated incorrectly.  The above Lisp snippet is
a good start, but the main part, i.e. the text to insert, the commands
to perform, and the values you see produced -- that part is missing.

> 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;

No, it isn't, see below.

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

True.  The code does that to make more explicitly clear how the value
of 'x + tab_width' was arrived to.  Omitting the two 1's could leave
the reader wondering where did those one-pixel adjustment disappear.

> 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

No, this is integer division, so 88/77 yields 1, and the overall
result is 77, not 88.



  reply	other threads:[~2018-01-15 12:06 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-15  5:48 Problems with move_it_in_display_line_to X when tabs exist Keith David Bershatsky
2018-01-15 12:06 ` Eli Zaretskii [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-01-23  7:38 Keith David Bershatsky
2018-01-21 20:32 Keith David Bershatsky
2018-01-16 17:53 Keith David Bershatsky
2018-01-16  4:41 Keith David Bershatsky
2018-01-16 17:00 ` Eli Zaretskii
2017-12-06 16:24 Keith David Bershatsky
2017-12-04  8:03 Keith David Bershatsky
2017-12-04  3:01 Keith David Bershatsky
2017-12-04 16:26 ` Eli Zaretskii
2017-12-03 20:56 Keith David Bershatsky
2017-12-04 15:48 ` Eli Zaretskii
2017-12-03  3:38 Keith David Bershatsky
2017-12-03 14:29 ` Eli Zaretskii
2017-12-02 22:28 Keith David Bershatsky
2017-12-03  3:32 ` Eli Zaretskii
2017-12-02 19:52 Keith David Bershatsky
2017-12-02 21:14 ` Eli Zaretskii
2017-11-30  4:29 Keith David Bershatsky
2017-11-29  6:12 Keith David Bershatsky
2017-11-29 18:04 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83d12bz5pw.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=esq@lawlist.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.