emacs-evil / evil-collection

A set of keybindings for evil-mode
GNU General Public License v3.0
1.21k stars 275 forks source link

vterm: Visual consistency for append #777

Closed miguebox closed 7 months ago

miguebox commented 8 months ago

evil-collection-vterm-append doesn't work, and evil-collection-vterm-append-line doesn't correctly display where the cursor is located. This fixes both issues.

The problem with both commands lies in the fact that evil-append doesn't accurately place the insert-mode cursor in front of the cursor displayed in normal-mode; instead acting in a functionally identical way as evil-insert, but moving only the displayed cursor forward one character until a character is placed.

Moving the cursor forward one character before entering insert mode solves evil-collection-vterm-append's issues. I haven't encountered any unexpected behaviour with the edge-case scenario of moving the cursor forward at the end of a line, which is the only situation I thought might be problematic with this solution.

The only fault with evil-collection-vterm-append-line is where the cursor is displayed, not where it actually is at the time of editing, contrary to what happened with evil-collection-vterm-append. Therefore, all that is necessary is to move backwards one character the displayed cursor when entering insert-mode, which can be easily achieved by swapping evil-append for evil-insert.

Direct link to the package repository

https://github.com/miguebox/evil-collection/tree/pull-request

condy0919 commented 7 months ago

Very detailed explanation.