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

REQUEST: Option for "Backspace as Undo" #20

Open
mblais opened this issue May 10, 2021 · 5 comments
Open

REQUEST: Option for "Backspace as Undo" #20

mblais opened this issue May 10, 2021 · 5 comments

Comments

@mblais
Copy link

mblais commented May 10, 2021

Please add a Settings option for "Backspace as Undo in Overtype mode" - so when in Overtype mode, hitting Backspace would simply undo the last character insertion, which would leave the line structure/spacing undisturbed.

@stkb
Copy link

stkb commented Nov 29, 2021

Yeah I'd like to see this too. Yes you can just use ctrl-z or left arrow, but your brain is so wired to hitting the backspace key after making a typo that I do this all the time.

@blaumeise20
Copy link

I would rather like a new setting called "overtype.backspaceAction" setting:

  • "delete": default behavior
  • "undo": undo last character insertion
  • "replace": separate setting "overtype.backspaceChar" where you can set the character to get inserted

@DominoPivot
Copy link

DominoPivot commented Mar 2, 2022

That would indeed be great. The "replace" option would actually replace the character currently in front of the caret, then move the caret back by 1 position. Example:

12345  becomes 1 345
12█45          1█345

Bikeshedding a little considering nobody seems to be working on this, but this might be worth considering:

  • Should the extension use different terminology to avoid confusion between the "undo" action and the undo/redo commands?
  • How would the undo/redo stack (Ctrl+Z) be affected by this operation?

@jkyeung
Copy link

jkyeung commented Nov 17, 2022

There are three possible meanings for the backspace key in overtype mode that make sense to me personally:

  1. Behave the same as backspace in insert mode (which is what it does now).
  2. Behave the same as left arrow (which would be my preference).
  3. Replace the character to the left of the cursor with a space, and then move the cursor left. (Or equivalently, do a backspace like in insert mode, and then insert a space but without moving the cursor.)

I really hate 1, because to me the entire point of overtype mode is that everything to the right of the cursor stays where it is. Though I hate the existing behavior, I think it makes sense to at least keep it as an option so that people who are used to it can continue to use it like that.

The difference between 2 and 3 is that 3 is "destructive", which at least conceptually makes some sense to me. It literally would be like typing a space, except moving backward instead of forward.

While I think I understand the appeal of a single-character-undo behavior for the backspace key, I suspect it might be a little tricky to implement (because it's different than Ctrl+Z, which will undo an entire "batch" of keystrokes that VS Code has deemed to be one operation); and if you move the cursor using the arrow keys or mouse, and then press backspace, what should happen? The only sensible thing at that point would be one of the three choices I presented above.

@MaddyGuthridge
Copy link

Building upon this, the one feature I had mentioned in #32 (which I closed since it is similar to this one) was having a similar option for the delete character (ie move the cursor forwards, since replacing with a space is covered by the spacebar)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants