all messages for Emacs-related lists mirrored at yhetil.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: Tue, 16 Jan 2018 09:53:04 -0800	[thread overview]
Message-ID: <m21sipy9kv.wl%esq@lawlist.com> (raw)

x_produce_glyphs runs multiple times on the line containing the STRETCH tab.  The value for it->pixel_width of the STRETCH tab (in this example) is _only_ correct when it->current_x is >= it->lnum_pixel_width.  Inasmuch as move_it_in_display_line_to is reporting that it.pixel_width remains at 49 even though the STRETCH shrinks (as we call scroll-left 1) to 42 to 35 to 28, it appears that x_produce_glyphs may be overwriting the correct value with the wrong value.  I restricted the floodgate of STDERR messages coming from x_produce_glyphs to only the situation when x0 >= it->lnum_pixel_width.  x_produce_glyphs probably runs _again_ when x0 < it->lnum_pixel_width, which overwrites the good value with the bad value.  Then, when I run move_it_in_display_line_to in screenshots 02 and 03, the err
 oneous value of 49 is returned -- the correct value in screenshot 02 should be 35, and the correct value in screenshot 03 should be 28.  If the previous value of it->pixel_width for the prior comman
 d loop were correct, then we would not see a consistent value of 49 in schreenshots 02 and 03 -- instead, we would see a value of 42 in screenshot 02 [which is really 35] and we would see a value 35 in screenshot 03 [which is really 28].

It may be the case that it is presently impossible to know the prospective _new_ value of it->pixel_width for a STRETCH tab (in this example) when calling move_it_in_display_line_to.  Since x_produce_glyphs knows how to calculate the correct value of it->pixel_width (when x0 >= it->lnum_pixel_width), perhaps there is a way to teach move_it_in_display_line_to how to do this?

Keith

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

DATE:  [01-16-2018 09:00:43] <16 Jan 2018 19:00:43 +0200>
FROM:  Eli Zaretskii <eliz@gnu.org>
> 
> > Date:  Mon, 15 Jan 2018 20:41:52 -0800
> > From:  Keith David Bershatsky <esq@lawlist.com>
> > Cc:  emacs-devel@gnu.org
> > 
> > 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.
> 
> What do you mean by "x_produce_glyphs runs subsequent in time"?  The
> value of it->pixel_width is updated by x_produce_glyphs, so before it
> was called, that value is outdated (belongs to the previous glyph).
> If that is what you observe, then it's the expected behavior, and not
> a bug.



             reply	other threads:[~2018-01-16 17:53 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-16 17:53 Keith David Bershatsky [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-01-23  7:38 Problems with move_it_in_display_line_to X when tabs exist Keith David Bershatsky
2018-01-21 20:32 Keith David Bershatsky
2018-01-16  4:41 Keith David Bershatsky
2018-01-16 17:00 ` Eli Zaretskii
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

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

  git send-email \
    --in-reply-to=m21sipy9kv.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 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.