Function: icomplete--adjust-lines-for-column
icomplete--adjust-lines-for-column is a byte-compiled function defined
in icomplete.el.gz.
Signature
(icomplete--adjust-lines-for-column LINES BUFFER DATA)
Documentation
Adjust the LINES to align with the column in BUFFER based on DATA.
Source Code
;; Defined in /usr/src/emacs/lisp/icomplete.el.gz
(defun icomplete--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 (current-column))
(prefix-indicator-width
(if icomplete-vertical-render-prefix-indicator
(max (length icomplete-vertical-selected-prefix-indicator)
(length icomplete-vertical-unselected-prefix-indicator))
0))
(wrapped-line (with-current-buffer buffer
(save-excursion
(goto-char (car data))
(beginning-of-line)
(count-screen-lines (point) (car data)))))
(window-width (+ (window-hscroll) (window-body-width)))
(longest-line-width (apply #'max (mapcar #'length lines)))
(spaces-to-add
(if (> wrapped-line 1)
(- column (* (- wrapped-line 1) (- window-width 5)))
column))
(spaces-to-add-avoiding-scrolling
(if (>= (+ spaces-to-add longest-line-width prefix-indicator-width) window-width)
(- spaces-to-add longest-line-width)
spaces-to-add)))
(mapcar (lambda (line)
(concat (make-string spaces-to-add-avoiding-scrolling ?\s) line))
lines))
lines))