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

From: Eli Zaretskii <[email-masked]>
Date: Sat, 15 Feb 2025 13:55:27 +0200

> From: Rahul Martim Juliato <[email-masked]>
> Cc: [email-masked]
> Date: Sun, 09 Feb 2025 20:08:56 -0300
> 
> >> > +(defun icomplete-vertical--adjust-lines-for-column (lines buffer data)
> >> > +  "Adjust the LINES to align with the column in BUFFER based on DATA."
> >> > +  (if icomplete-vertical-in-buffer-adjust-list
> >> > +      (let ((column
> >> > +             (with-current-buffer buffer
> >> > +               (save-excursion
> >> > +                 (goto-char (car data))
> >> > +                 (current-column)))))
> >> > +        (dolist (l lines)
> >> > +          (add-text-properties
> >> > +           0 1 `(display ,(concat (make-string column ?\s) (substring l 0 1)))
> >> > +           l))
> >> > +        lines)
> >> > +    lines))
> >> 
> >> 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?

> 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.