Skip to content

Commit deeefa0

Browse files
authored
Do not truncate lines, make content more impact (#633)
* Do not truncate lines, make content more impact * Fix ci * Hide frame immediately after each command
1 parent 240a7de commit deeefa0

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

lsp-ui-doc.el

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -265,19 +265,13 @@ Because some variables are buffer local.")
265265
"*"))
266266

267267
;; ‘markdown-fontify-code-block-default-mode’ isn’t yet available in
268-
;; Markdown 2.3.
268+
;; Markdown 2.3.
269269
(defvar markdown-fontify-code-block-default-mode)
270270

271271
(defun lsp-ui-doc--inline-wrapped-line (string)
272272
"Wraps a line of text (STRING) for inline display."
273-
(let ((doc-max-width (lsp-ui-doc--inline-window-width)))
274-
(cond ((string-empty-p string) "")
275-
((< (length string) doc-max-width) string)
276-
(t (concat (substring string 0 (- doc-max-width 4))
277-
"\n"
278-
(string-trim-left
279-
(lsp-ui-doc--inline-wrapped-line
280-
(substring string (- doc-max-width 4)))))))))
273+
(cond ((string-empty-p string) "")
274+
(t string)))
281275

282276
(defun lsp-ui-doc--inline-formatted-string (string)
283277
"Formats STRING for inline rendering."
@@ -661,6 +655,8 @@ FN is the function to call on click."
661655
'lsp-ui-doc--webkit-resize-callback))
662656
(erase-buffer)
663657
(insert (s-trim string))
658+
(let ((fill-column (- lsp-ui-doc-max-width 5)))
659+
(fill-region (point-min) (point-max)))
664660
(unless (lsp-ui-doc--inline-p)
665661
(lsp-ui-doc--make-smaller-empty-lines)
666662
(lsp-ui-doc--handle-hr-lines))
@@ -901,6 +897,8 @@ HEIGHT is the documentation number of lines."
901897

902898
(defun lsp-ui-doc--post-command ()
903899
"Post command hook for UI doc."
900+
(unless (memq this-command lsp-ui-doc--ignore-commands)
901+
(lsp-ui-doc--hide-frame))
904902
(lsp-ui-util-safe-kill-timer lsp-ui-doc--post-timer)
905903
(setq lsp-ui-doc--post-timer (run-with-timer lsp-ui-doc-post-delay nil #'lsp-ui-doc--make-request)))
906904

0 commit comments

Comments
 (0)