Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undoStopBefore:false in TextEditor.edit stopped working in 1.18 #38535

Closed
Cardinal90 opened this issue Nov 16, 2017 · 2 comments
Closed

undoStopBefore:false in TextEditor.edit stopped working in 1.18 #38535

Cardinal90 opened this issue Nov 16, 2017 · 2 comments
Assignees
Labels
editor-core Editor basic functionality info-needed Issue requires more information from poster undo-redo Issues around undo/redo
Milestone

Comments

@Cardinal90
Copy link

  • VSCode Version: 1.18.0
  • OS Version: Windows 10

Steps to Reproduce:

I am the author of this extension. The gif on the extension page clearly shows what it does - it modifies text on every keystroke when you have multiple ranges selected. To prevent unnecessary undo stops I pass

{
  undoStopAfter: false,
  undoStopBefore: false
}

to the TextEditor.Edit method, which worked before.

Since 1.18 VSCode creates two undo steps for every keystroke. I traced the problem to #29036 and the commit that fixes it. That commit introduces the concept of EditOperationType to create undo stops between different types of edits. What happens is every character is typed with operation type Typing, and then my extension does its work with operation type Other. That creates two unnecessary undo stops, while I clearly indicate that I don't need any by passing undoStopBefore: false.

Reproduces without extensions: Yes

@vscodebot vscodebot bot added new release editor-core Editor basic functionality labels Nov 16, 2017
@alexdima alexdima added this to the November 2017 milestone Nov 17, 2017
@alexdima alexdima added the bug Issue identified by VS Code Team member as probable bug label Nov 27, 2017
@alexdima alexdima modified the milestones: November 2017, On Deck Dec 7, 2017
@alexdima alexdima added the undo-redo Issues around undo/redo label Feb 26, 2020
@alexdima
Copy link
Member

alexdima commented Mar 6, 2020

@Cardinal90 Is this still a real problem for your extension? I have to say that I don't really know how to tackle this issue given the work from #29036

@alexdima alexdima added info-needed Issue requires more information from poster and removed bug Issue identified by VS Code Team member as probable bug labels Mar 6, 2020
@Cardinal90
Copy link
Author

Well, it still requires two undo actions instead of one in most cases and one undo per symbol in case of ALLCAPS (which is almost nonexistent in my personal practice). I found some workarounds, so it's not a big problem anymore. The extension is very much usable and does not break undo/redo history.

The fact that undoStopBefore: false doesn't work as expected is unfortunate. But it seems to be a rare scenario, so it's probably not worth it to tackle this just to fix my issue.

@alexdima alexdima closed this as completed Mar 9, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Apr 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
editor-core Editor basic functionality info-needed Issue requires more information from poster undo-redo Issues around undo/redo
Projects
None yet
Development

No branches or pull requests

3 participants