(t
"")))))
-(defun visual-wrap--apply-to-line (position)
- "Apply visual-wrapping properties to the logical line starting at POSITION."
- (save-excursion
- (goto-char position)
- (when-let ((first-line-prefix (fill-match-adaptive-prefix))
- (next-line-prefix (visual-wrap--content-prefix
- first-line-prefix position)))
- (when (numberp next-line-prefix)
- ;; Set a minimum width for the prefix so it lines up correctly
- ;; with subsequent lines. Make sure not to do this past the end
- ;; of the line though! (`fill-match-adaptive-prefix' could
- ;; potentially return a prefix longer than the current line in
- ;; the buffer.)
- (add-display-text-property
- position (min (+ position (length first-line-prefix))
- (pos-eol))
- 'min-width `((,next-line-prefix . width))))
- (setq next-line-prefix (visual-wrap--adjust-prefix next-line-prefix))
- (put-text-property
- position (pos-eol) 'wrap-prefix
- (if (numberp next-line-prefix)
- `(space :align-to (,next-line-prefix . width))
- next-line-prefix)))))
+(defun visual-wrap--apply-to-line ()
+ "Apply visual-wrapping properties to the logical line starting at point."
+ (when-let* ((first-line-prefix (fill-match-adaptive-prefix))
+ (next-line-prefix (visual-wrap--content-prefix
+ first-line-prefix (point))))
+ (when (numberp next-line-prefix)
+ ;; Set a minimum width for the prefix so it lines up correctly
+ ;; with subsequent lines. Make sure not to do this past the end
+ ;; of the line though! (`fill-match-adaptive-prefix' could
+ ;; potentially return a prefix longer than the current line in the
+ ;; buffer.)
+ (add-display-text-property
+ (point) (min (+ (point) (length first-line-prefix))
+ (pos-eol))
+ 'min-width `((,next-line-prefix . width))))
+ (setq next-line-prefix (visual-wrap--adjust-prefix next-line-prefix))
+ (put-text-property
+ (point) (pos-eol) 'wrap-prefix
+ (if (numberp next-line-prefix)
+ `(space :align-to (,next-line-prefix . width))
+ next-line-prefix))))
(defun visual-wrap--content-prefix (prefix position)
"Get the next-line prefix for the specified first-line PREFIX.
;; If so, we can apply our visual wrapping properties to this
;; line and continue to the next line.
(progn
- (visual-wrap--apply-to-line (point))
+ (visual-wrap--apply-to-line)
(forward-line))
;; Otherwise, skip ahead until the end of any unsafe display
;; properties. NOTE: We do this out of an abundance of caution to