[求助] 输入内容和光标如何不被 after-string overlay 隔断

正常情况下,光标应该紧随输入内容

但在输入文本中插入 after-string overlay 后,输入内容和光标被 overlay 隔断了,出现了"质壁分离"现象 :joy:

网上没查到好的解决方案,根据下面连接给第一个字符设置了 'cursor t,还是有问题

https://lists.gnu.org/archive/html/bug-gnu-emacs/2013-03/msg00080.html

截图录屏_选择区域_20201112144430

窗口 2,光标没能置于 overlay 上

窗口 3,在overlay中插入换行符后成功了

没搞明白这个原理,如何做到无需换行符输入内容和光标不被overlay隔断

(defun overlay-test (overlay-str buffer-name)
  (let ((buf (get-buffer-create buffer-name))
        (content "let ab = sth"))
    (with-current-buffer buf
      (remove-overlays)
      (erase-buffer)
      (goto-char (point-min))
      (insert content)
      (let ((o (make-overlay 7 7 nil t t))
            (s overlay-str))
        (put-text-property 0 (length s) 'face '(:background "#aaaaaa") s)
        (put-text-property 0 1 'cursor t s)
        (overlay-put o 'after-string s)
        ;; s
        ))
    (pop-to-buffer buf)))

(overlay-test ": hello" "*cursor-on-overlay-failed*")
;; #(": hello" 0 1 (face (:background "#aaaaaa") cursor t) 1 7 (face (:background "#aaaaaa")))

(overlay-test ":\n hello" "*cursor-on-overlay-succeeded*")
;; #(":
;;  hello" 0 1 (face (:background "#aaaaaa") cursor t) 1 8 (face (:background "#aaaaaa")))

测试环境:

emacs 28 native-comp 分支

2435c10 * feature/native-comp origin/feature/native-comp grafted * Nativecomp testsuite rework for derived return type specifiers