VSCodeVim / VSCodeVim/Vim

Undo history is lost when highlighting text (with mouse) in insert mode

Open
#4,854 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
15.2k
Forks
1.5k
Avg merge
3d 18h
Merged PRs (30d)
6

Description

Describe the bug

Did a sequence of operations that deleted the text without storing it in history.

To Reproduce

It reproduces every time. I did something like this:

  • Entered the text in insert mode
  • Highlighted text with mouse, without exiting insert mode
  • After highlighting the text, I was still in insert mode, so I typed something - e.g. "x" - and it replaced my highlighted text.
  • When I tried to undo, I went to state from before my first bullet point.

Consequences:

  • If I highlight the text I was typing, it's deleted permanently with no way to recover.
  • It's not something user usually wants, but it happened by accident - I typed "x" because I wanted to delete the highlighted text, not noticing I'm still in insert mode.
  • VS Code undo history is identical to Vim history, so I can't fallback to VS Code controls.

Expected behavior
I want the undo history to be 100% reliable - to be saved every time I'm deleting more than one character at a time, e.g. deleting highlighted text. This is my expectation, because it's true for text editors I know, including native Vim and native VS Code.

Environment (please complete the following information):

  • Extension (VsCodeVim) version: 1.14.2
  • VSCode version: 1.45.0
  • OS: Ubuntu 19.10

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. First reproduce the sequence in VSCode with VSCodeVim 1.14.2: type in insert mode, highlight text with the mouse, replace it, and undo; then locate the insert-mode mouse-selection and undo-history entry points. Done means the replacement of highlighted text can be undone without losing the preceding insert history.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.