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: Sat, 02 Dec 2017 11:52:33 -0800	[thread overview]
Message-ID: <m2d13wsy9q.wl%esq@lawlist.com> (raw)

The test assumes:

* The variable word-wrap is non-nil.

* The variable tab-width is 2.

* The buffer-display table entry for a tab is:  [(187 . 120) (9 . 121)].

* Native line numbers are _not_ enabled.

I have a long line that wraps at the window edge and I put a space to simulate a new word that should be wrapped to the following line.  To make it easier to read, I am using the backslash symbol (below) to signify a word-wrap with a space at the window edge.  The next line has three "x" followed by a tab and then the word "hello-world".  The STRETCH glyph is 22 pixels wide; however, it.pixel_width is erroneously (?) reporting that it is 11 pixels wide.

I have hard-coded an emacs_abort () when it.c == '\t', which means that we have just moved passed character 187 (aka "»") and we are now on a STRETCH tab-width.

Here is a link to a screen-shot of this particular issue:

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

What would be the next step(s), please, to continue working on debugging this particular issue?

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \
xxx	hello-world


(gdb) pgrowx glyph_row
[New Thread 0x1c0b of process 16745]
TEXT: 18 glyphs
  0    0: CHAR[x] pos=1197 blev=0,btyp=UNDEF w=11 a+d=16+4 MB
  1   11: CHAR[x] pos=1198 blev=0,btyp=UNDEF w=11 a+d=16+4 MB
  2   22: CHAR[x] pos=1199 blev=0,btyp=UNDEF w=11 a+d=16+4 MB
  3   33: CHAR[0xbb] pos=1200 blev=0,btyp=UNDEF w=11 a+d=16+4 face=31 MB
  4   44: STRETCH[20+16] pos=1200 w=22 a+d=16+4 face=30 MB
  5   66: CHAR[h] pos=1201 blev=0,btyp=UNDEF w=11 a+d=16+4 MB
  6   77: CHAR[e] pos=1202 blev=0,btyp=UNDEF w=11 a+d=16+4 MB
  7   88: CHAR[l] pos=1203 blev=0,btyp=UNDEF w=11 a+d=16+4 MB
  8   99: CHAR[l] pos=1204 blev=0,btyp=UNDEF w=11 a+d=16+4 MB
  9  110: CHAR[o] pos=1205 blev=0,btyp=UNDEF w=11 a+d=16+4 MB
 10  121: CHAR[-] pos=1206 blev=0,btyp=UNDEF w=11 a+d=16+4 MB
 11  132: CHAR[w] pos=1207 blev=0,btyp=UNDEF w=11 a+d=16+4 MB
 12  143: CHAR[o] pos=1208 blev=0,btyp=UNDEF w=11 a+d=16+4 MB
 13  154: CHAR[r] pos=1209 blev=0,btyp=UNDEF w=11 a+d=16+4 MB
 14  165: CHAR[l] pos=1210 blev=0,btyp=UNDEF w=11 a+d=16+4 MB
 15  176: CHAR[d] pos=1211 blev=0,btyp=UNDEF w=11 a+d=16+4 MB
 16  187: CHAR[0xb6] pos=1212 blev=0,btyp=UNDEF w=11 a+d=16+4 face=26 MB
 17  198: CHAR[ ] pos=0 blev=0,btyp=UNDEF w=11 a+d=16+4 MB

(gdb) print it.c
$1 = 9

(gdb) print it.pixel_width
$2 = 11

Thanks,

Keith

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

DATE:  [11-29-2017 10:04:14] <29 Nov 2017 20:04:14 +0200>
FROM:  Eli Zaretskii <eliz@gnu.org>
> 
> > Date: Tue, 28 Nov 2017 22:12:35 -0800
> > From: Keith David Bershatsky <esq@lawlist.com>
> > 
> > I can see that X and/or HPOS are wrong when tabs are present on the current line because I get superimposed letters and double of the same word slightly off to the left and/or the right of where the word should be.
> > 
> > HYPOTHESIS:  I would venture to say that what is displayed on screen does _not_ coincide with what IT reports when running move_it_in_display_line_to.
> 
> Does this happen only when line numbers are displayed?
> 
> In any case, your description provides a lot of details that are hard
> to reason about, because most of the code is not shown.  OTOH, if
> indeed there's a bug in move_it_in_display_line_to, then presenting
> evidence for it is very simple: show a line of text and its line
> number, and then show the X and HPOS values for each tab in that line
> as calculated by move_it_in_display_line_to vs the same values in a
> displayed line.  (For the latter, you can use the pgrowx command
> defined in src/.gdbinit, or manually display the values using the
> debugger.)
> 
> If you do that, any mismatches between displaying a line and moving
> through it with move_it_in_display_line_to will be immediately
> apparent, and it should be easy to fix them.



             reply	other threads:[~2017-12-02 19:52 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-02 19:52 Keith David Bershatsky [this message]
2017-12-02 21:14 ` 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-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-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=m2d13wsy9q.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).