Files
zed/crates/vim/test_data/test_temporary_mode.json
Dino cdcc068906 vim: Fix temporary mode exit on end of line (#42742)
When using the end of line motion ($) while in temporary mode, the
cursor would be placed in insert mode just before the last character
instead of after, just like in NeoVim.

This happens because `EndOfLine` kind of assumes that we're in `Normal`
mode and simply places the cursor in the last character instead of the
newline character.

This commit moves the cursor one position to the right when exiting
temporary mode and the motion used was `Motion::EndOfLine`

- Update `vim::normal::Vim.exit_temporary_normal` to now accept a
`Option<&Motion>` argument, in case callers want this new logic to
potentially be applied

Closes #42278 

Release Notes:

- Fixed temporary mode exit when using `$` to move to the end of the
line
2025-11-17 11:14:49 +00:00

28 lines
685 B
JSON

{"Put":{"state":"lorem ˇipsum"}}
{"Key":"i"}
{"Get":{"state":"lorem ˇipsum","mode":"Insert"}}
{"Key":"ctrl-o"}
{"Key":"$"}
{"Get":{"state":"lorem ipsumˇ","mode":"Insert"}}
{"Put":{"state":"loremˇ ipsum dolor"}}
{"Key":"a"}
{"Get":{"state":"lorem ˇipsum dolor","mode":"Insert"}}
{"Key":"a"}
{"Key":"n"}
{"Key":"d"}
{"Key":"space"}
{"Key":"ctrl-o"}
{"Key":"w"}
{"Get":{"state":"lorem and ipsum ˇdolor","mode":"Insert"}}
{"Put":{"state":"lorem ˇipsum dolor"}}
{"Key":"i"}
{"Get":{"state":"lorem ˇipsum dolor","mode":"Insert"}}
{"Key":"a"}
{"Key":"n"}
{"Key":"d"}
{"Key":"space"}
{"Key":"ctrl-o"}
{"Key":"y"}
{"Key":"$"}
{"Get":{"state":"lorem and ˇipsum dolor","mode":"Insert"}}