fix: border column number under `display-line-number-mode'master
authorMeow King <[email protected]>
Thu, 6 Jul 2023 15:49:27 +0000 (6 23:49 +0800)
committerstardiviner <[email protected]>
Sat, 8 Jul 2023 02:22:27 +0000 (8 10:22 +0800)
Also remove quote inside `cl-case' since the compiler warns it.

I notice when I enable `display-line-number-mode', there are characters
overflowing. I did some research and fix the problem.

inline-docs.el

index 9679e6e..2a256ca 100644 (file)
@@ -87,7 +87,11 @@ Set `inline-docs-position' to `up' to fix issue that `inline-docs' does not show
 
 (defun inline-docs--string-display (string apply-face)
   "Show STRING contents below point line until next command with APPLY-FACE."
-  (let* ((border-line (make-string (- (window-body-width) 2) inline-docs-border-symbol))
+  ;; note that `display-line-numbers-mode' takes 2 + `line-number-display-width' columns
+  (let* ((total-column-number (if display-line-numbers-mode
+                                  (- (window-body-width) (+ 2 (line-number-display-width)))
+                                (window-body-width)))
+         (border-line (make-string total-column-number inline-docs-border-symbol))
          (offset (make-string
                   (if (= (current-indentation) 0) ; fix (wrong-type-argument wholenump -1) when current indentation is 0 minus 1 will caused wholenump exception.
                       (current-indentation)
@@ -112,8 +116,8 @@ Set `inline-docs-position' to `up' to fix issue that `inline-docs' does not show
           (inline-docs--clear-overlay)
           ;; decide overlay positions
           (cl-case inline-docs-position
-            ('above (forward-line 0))
-            ('below (forward-line)))
+            (above (forward-line 0))
+            (below (forward-line)))
           (setq start-pos (point))
           (end-of-line)
           (setq end-pos (point))