Subject: Re: bug#75794: [PATCH] feat(icomplete): markers and vertical alignment

From: Rahul Martim Juliato <[email-masked]>
Date: Tue, 18 Feb 2025 17:17:07 -0300

>> >> Did you test this with a window horizontally scrolled (when
>> >> truncate-lines is non-nil)?  What about continuation lines?  In both
>> >> these cases, current-column is different from the visual column on the
>> >> screen, counted from the left edge of the window.
>> >> 
>> 
>> I think you meant when `truncate-lines' is `nil'. When it is 't, no
>> problems.
>
> Including when the window is horizontally scrolled?

If I understood what you meant, yes, more below:

>> When it is nil and we're dealing with wrapped lines, this
>> "works" with the annoying addition of a 'blank wrapped line' between
>> candidates.
>> 
>> I could not figure out how to fix it properly. Any tips?
>
> If you need to know whether a line is continued or not, you can use
> the function display--line-is-continued-p.  If that's not what you
> need, please tell more details.

Thanks! More details below:

--

Let me add some images so we're on the same page:

With the latest patch, here’s what we currently have in "normal" usage:

1 - Normal usage
https://0x0.st/8bOz.png

2 - In the middle of the buffer:
https://0x0.st/8bOH.png

3 - At the end of the buffer:
https://0x0.st/8bOX.png

4 - With scrolling:
https://0x0.st/8bO8.png

Now after `toogle-truncate-lines`:

5 - In the middle of the buffer:
https://0x0.st/8bO8.png

6 - At the end of the buffer:
https://0x0.st/8bOP.png

7 - In the middle of a wrapped line:
https://0x0.st/8bOZ.png

As you see this is not yet very good with 'wrapped' lines. But the
overall idea is that anyone could easily override the
`icomplete-vertical--adjust-lines-for-column' function to make its own
implementation. 

Given current `icomplete-vertical--adjust-lines-for-column', I think we
could fix:

- 3) maybe with some "align to the right". Is there a any helper
  function that would take some content and print it fitting
  right-aligned or I'd have to implement it myself?

- 6, 7) Here I think the trick is having a way to check current column position,
  vs. visual total columns (I mean the total columns of any line wrapped
  or not fitting the current window), if current column is greater than
  the later, we subtract the visual total columns, so it is aligned.
  Again, are there helper functions to make this positioning of the
  cursor and window,column,width querying easier?

Thanks!

-- 

Rahul Martim Juliato