-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Hey, great package by the way! I'm really enjoying a finally proper approach to cursor manipulation in the terminal. I found a bug though.
Since you support buffer-local variant of the mode with term-cursor-mode, it should stay truly local without side effects from other buffers. Check out add-variable-watcher again. I believe in term-cursor-watcher, you need to check the last argument _watch (which is according to documentation should be called where by the way). The logic should be as follows:
(when (and (eq operation 'set) ; A new value must be set to the variable
(bufferp where)
(with-current-buffer where
term-cursor-mode))
(term-cursor--eval cursor blink-cursor-mode)))It ensures that the buffer, where the buffer-local value of cursor-type is about to change, has term-cursor-mode still enabled.
Otherwise, if you enable global-term-cursor-mode and then enter some "first" buffer where term-cursor-mode is now enabled, you run term-cursor-mode again to disable it, but if you now create some new "second" buffer (where global-term-cursor-mode would enable term-cursor-mode too) and switch back to the "first" buffer, you will see that even though term-cursor-mode is still disabled there according the buffer-local value of variable term-cursor-mode, the cursor will be morphing regardless as if it would have been enabled. This is exactly the side effect from the "second" buffer enabling term-cursor-mode not only for itself but also for the "first" buffer (and any other as well) due to incorrect implementation of term-cursor-watcher.