emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/capf-autosuggest 54e9d1f 42/63: Fix cursor display issu


From: ELPA Syncer
Subject: [elpa] externals/capf-autosuggest 54e9d1f 42/63: Fix cursor display issues if overlay text ends with a newline
Date: Wed, 27 Oct 2021 14:58:01 -0400 (EDT)

branch: externals/capf-autosuggest
commit 54e9d1f559fe08f3f7004e4d0f961847c4b4d579
Author: jakanakaevangeli <jakanakaevangeli@chiru.no>
Commit: jakanakaevangeli <jakanakaevangeli@chiru.no>

    Fix cursor display issues if overlay text ends with a newline
---
 capf-autosuggest.el | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/capf-autosuggest.el b/capf-autosuggest.el
index 2074808..9512181 100644
--- a/capf-autosuggest.el
+++ b/capf-autosuggest.el
@@ -196,8 +196,12 @@ Otherwise, return nil."
                  capf-autosuggest--str (copy-sequence str)
                  capf-autosuggest--tick (buffer-modified-tick))
            (move-overlay capf-autosuggest--overlay end end)
+           ;; Make sure the overlay after-string doesn't start or end with a
+           ;; newline, otherwise it can behave badly with cursor placement
            (when (eq ?\n (aref str 0))
              (setq str (concat " " str)))
+           (when (eq ?\n (aref str (1- (length str))))
+             (setq str (concat str (propertize " " 'display ""))))
            (add-text-properties 0 1 (list 'cursor (length str)) str)
            (put-text-property 0 (length str) 'face 'capf-autosuggest-face str)
            (overlay-put capf-autosuggest--overlay 'after-string str)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]