Subject: bug#31716: move_it_in_display_line / horizontal scrolling / tab stretch

From: Keith David Bershatsky <[email-masked]>
Date: Thu, 07 Jun 2018 22:12:34 -0700

I have had an opportunity to further study your write-up regarding issue 31716, and I really appreciate the help you have given.  Using the theory that the increase in current_x translates into a new display element and a corresponding increase in the HPOS once the first visible x is reached, I have come up with (what appears to be) a working method to reliably calculate RELATIVE_X and HPOS when tabs are present with horizontal scrolling.  However, I am essentially incrementing font->space_width from the far left of the display elements to the end of the line in order to make all of the relevant determinations along the current line (where I am drawing multiple fake cursors to achieve the visible horizontal line for crosshairs).  In a nutshell, the method I am using is somewhat akin to pgrowx in .gdbinit (in that RELATIVE_X is determined based upon the preceding element/determination).

The method I am using to calculate RELATIVE_X and HPOS (when tabs are present with horizontal scrolling) is undoubtedly less efficient than using nifty general methods such as:

A.  RELATIVE_X = it.current_x - it.first_visible_x.

B.  RELATIVE_X = it.current_x - (window_hscroll_limited (w, f) * frame_char_width).

C.  HPOS = it.hpos.

D.  HPOS = t.hpos - window_hscroll_limited (w, f).

More efficient ways to calculate RELATIVE_X and HPOS (when tabs are present with horizontal scrolling) can be dealt with in the future on the Emacs devel mailing list since they are not directly related to the reason that #31716 was launched.  Please feel free to close out #31716 at your convenience.

Thank you again for all your help.

Keith