]> git.eshelyaron.com Git - emacs.git/commitdiff
Be more careful when making xref summaries
authorJoão Távora <joaotavora@gmail.com>
Sun, 16 Dec 2018 14:33:14 +0000 (14:33 +0000)
committerJoão Távora <joaotavora@gmail.com>
Sun, 16 Dec 2018 14:33:14 +0000 (14:33 +0000)
* eglot.el (eglot--xref-make): Only highlight to end-of-line at
most.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/187

lisp/progmodes/eglot.el

index ee40329ca1b81768c517f5dcfcdb20e6296a9ba3..60dad452d687ce63c56051f875bf89ff8e84a803 100644 (file)
@@ -1667,8 +1667,10 @@ Try to visit the target file for a richer summary line."
                   (eglot--widening
                    (pcase-let* ((`(,beg . ,end) (eglot--range-region range))
                                 (bol (progn (goto-char beg) (point-at-bol)))
-                                (substring (buffer-substring bol (point-at-eol))))
-                     (add-face-text-property (- beg bol) (- end bol) 'highlight
+                                (substring (buffer-substring bol (point-at-eol)))
+                                (hi-beg (- beg bol))
+                                (hi-end (- (min (point-at-eol) end) bol)))
+                     (add-face-text-property hi-beg hi-end 'highlight
                                              t substring)
                      (list substring (1+ (current-line)) (eglot-current-column))))))
        (`(,summary ,line ,column)