unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Keith David Bershatsky <esq@lawlist.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Problems with move_it_in_display_line_to X when tabs exist.
Date: Mon, 15 Jan 2018 20:41:52 -0800	[thread overview]
Message-ID: <m21siq76un.wl%esq@lawlist.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2774 bytes --]

Thank you, Eli, for teaching me about "integer division".  I have added that concept to my learning "todo list" and anticipate having a handle on that in the next couple of days.

GOAL:  The goal is to interactively call (scroll-left 1) -- one or more times in a row -- and obtain the beginning _visible_ X and HPOS of the STRETCH tab; and, also obtain its _visible_ pixel-width.

The following screenshots with stderr results were obtained by calling the function debug-tab-pixel-width, which is contained in the attached patch.diff.  I saw that x_produce_glyphs is able to achieve the correct it->pixel_width for the STRETCH tab when x0 >= it->lnum_pixel_width; however, it is run subsequent in time to when we call move_it_in_display_line_to.


0.  Opening screenshot -- just setting up the test buffer.

  https://www.lawlist.com/images/tab_width_bug_00.png


1.  Place the cursor on the line that begins with a tab, and press the f5 key once.

  https://www.lawlist.com/images/tab_width_bug_01.png

  OBSERVATIONS (w->hscroll == 1):  The expected result is that the STRETCH tab will have an it.pixel_width of 42.  The third (3rd) iteration/loop has the wrong value; i.e., 49.  The fourth (4th) iteration/loop has the correct value; i.e., 42.  x_produce_glyphs runs subsequent in time and contains the desired value of 42 when x0 >= it->lnum_pixel_width.


2.  With the cursor still on the line that began with a tab, Press the f5 key once.

  https://www.lawlist.com/images/tab_width_bug_02.png

  OBSERVATIONS (w->hscroll == 2):  The expected result is that the STRETCH tab will have an it.pixel_width of 35; however, it has a value of 49 instead.  x_produce_glyphs runs subsequent in time and contains the desired value of 35 when x0 >= it->lnum_pixel_width.


3. With the cursor still on the line that began with a tab, Press the f5 key once.

  https://www.lawlist.com/images/tab_width_bug_03.png

  OBSERVATIONS (w->hscroll == 3):  The expected result is that the STRETCH tab will have an it.pixel_width of 28; however, it has a value of 49 instead.  x_produce_glyphs runs subsequent in time and contains the desired value of 28 when x0 >= it->lnum_pixel_width.


LISP CODE (buffer-local):

(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)
(global-set-key [f5] (lambda () (interactive) (debug-tab-pixel-width)))


TEST TEXT (a tab, followed by some arbitrary letters such Hello-world) -- the text begins on line 13:

	Hello-world.


C CODE:  Apply the attached patch.diff to Emacs 26 as of 01/15/2018 bearing last commit 9f22b7d2317eff65897355dcf68ba10d521cfa5a.



[-- Attachment #2: patch.diff --]
[-- Type: application/diff, Size: 7581 bytes --]

             reply	other threads:[~2018-01-16  4:41 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-16  4:41 Keith David Bershatsky [this message]
2018-01-16 17:00 ` Problems with move_it_in_display_line_to X when tabs exist Eli Zaretskii
  -- 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-15  5:48 Keith David Bershatsky
2018-01-15 12:06 ` 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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=m21siq76un.wl%esq@lawlist.com \
    --to=esq@lawlist.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).