Skip to content

Commit 769a129

Browse files
authored
Doc wrap now adjusts to text scale (#699)
1 parent 96b1ecb commit 769a129

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lsp-ui-doc.el

+6-2
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,10 @@ We don't extract the string that `lps-line' is already displaying."
460460
(xwidget-resize (lsp-ui-doc--webkit-get-xwidget) offset-width offset-height))
461461
(lsp-ui-doc--move-frame (lsp-ui-doc--get-frame)))
462462

463+
(defun lsp-ui-doc--scale-column-width (width)
464+
"Return WIDTH adjusted relative to the text scale."
465+
(floor (/ width (expt 1.1 lsp-ui-doc-text-scale-level))))
466+
463467
(defun lsp-ui-doc--resize-buffer ()
464468
"If the buffer's width is larger than the current frame, resize it."
465469
(if lsp-ui-doc-use-webkit
@@ -468,7 +472,7 @@ We don't extract the string that `lps-line' is already displaying."
468472
'lsp-ui-doc--webkit-resize-callback)
469473

470474
(let* ((frame-width (frame-width))
471-
(fill-column (min lsp-ui-doc-max-width (- frame-width 5))))
475+
(fill-column (lsp-ui-doc--scale-column-width (min lsp-ui-doc-max-width (- frame-width 5)))))
472476
(when (> (lsp-ui-doc--buffer-width) (min lsp-ui-doc-max-width frame-width))
473477
(lsp-ui-doc--with-buffer
474478
(fill-region (point-min) (point-max)))))))
@@ -618,7 +622,7 @@ FN is the function to call on click."
618622

619623
(defun lsp-ui-doc--fill-document ()
620624
"Better wrap the document so it fits the doc window."
621-
(let ((fill-column (- lsp-ui-doc-max-width 5))
625+
(let ((fill-column (lsp-ui-doc--scale-column-width (- lsp-ui-doc-max-width 5)))
622626
start ; record start for `fill-region'
623627
first-line) ; first line in paragraph
624628
(save-excursion

0 commit comments

Comments
 (0)