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

Adding overtype mode #233188

Merged
merged 45 commits into from
Nov 29, 2024
Merged

Adding overtype mode #233188

merged 45 commits into from
Nov 29, 2024

Conversation

aiday-mar
Copy link
Contributor

@aiday-mar aiday-mar commented Nov 6, 2024

fixes #1012

@aiday-mar aiday-mar self-assigned this Nov 6, 2024
@aiday-mar aiday-mar changed the title Adding setting to enable overtype mode [DRAFT]: Adding setting to enable overtype mode Nov 6, 2024
@aiday-mar aiday-mar changed the title [DRAFT]: Adding setting to enable overtype mode Adding overtype mode Nov 13, 2024
@aiday-mar aiday-mar marked this pull request as ready for review November 13, 2024 16:16
@aiday-mar aiday-mar marked this pull request as draft November 13, 2024 16:16
@aiday-mar aiday-mar requested a review from alexdima November 21, 2024 14:38
@GitMensch
Copy link
Contributor

LGTM, I'd really love to see this pulled in - @alexdima ?

auto-merge was automatically disabled November 26, 2024 09:18

Pull Request is not mergeable

Copy link
Member

@alexdima alexdima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 Looks almost ready to merge! Left a few small comments!

src/vs/workbench/browser/parts/editor/editorStatus.ts Outdated Show resolved Hide resolved
src/vs/workbench/browser/parts/editor/editorStatus.ts Outdated Show resolved Hide resolved
src/vs/workbench/browser/parts/editor/editorActions.ts Outdated Show resolved Hide resolved
@aiday-mar aiday-mar enabled auto-merge (squash) November 27, 2024 10:02
@alexdima
Copy link
Member

🚀 Nice!

@aiday-mar aiday-mar merged commit e250246 into main Nov 29, 2024
8 checks passed
@aiday-mar aiday-mar deleted the nuclear-swallow branch November 29, 2024 08:32
@jkyeung
Copy link

jkyeung commented Dec 11, 2024

Finally! I know legions of users are rejoicing at this. Thank you, @aiday-mar for doing this.

Now, I want to stress that I'm among those who are extremely grateful and appreciative of this work... but I have a question/request: How difficult would it be to add a setting that changes the behavior of the Backspace key when overtype is on?

I think most of us have developed the muscle memory of hitting Backspace when we notice we've made a typo. It is so natural and fast for experienced touch-typists that we don't even consciously think of it, it just happens.

OK, so if I'm overtype mode, it's because I don't want to disturb the positioning of anything that's already there. I start typing, my characters are overwriting things, and everything to the right of the cursor is staying put. Great. Oops, I mistyped a letter (or changed my mind) and my right pinky automatically shot out and hit Backspace. And now the stuff to the right of the cursor is out of alignment, which goes against my concept of what overtype is for.

I can see three plausible behaviors for Backspace in overtype mode:

  1. Status quo. I'm sure plenty of users are happy with this. I also suspect plenty of users would rather it not be this, but have gotten used to it; and either it doesn't occur to them that there could be something better, or they're resigned to the way things are.
  2. Behave like left-arrow. This includes jumping over indentation consisting of spaces, if that setting is on.
  3. Like regular Backspace, except that stuff to the right of the cursor stays where it is (by inserting whitespace as necessary). You might also think of this as "destructive" left-arrow.

I could get used to either 2 or 3, so as far as I'm concerned, if one of those is significantly easier to implement, I'm happy to have just that one. (My guess is 2 is easier, because you could simply remap the Backspace key to left-arrow while overtype is on.)

Thank you for reading this, and thank you again for the work you've already done.

@junetried
Copy link

+1 about backspace behavior. I was very surprised when I pressed backspace after making a typo and the editor removed a character without leaving anything in its place, like I expect insert to behave.

@aiday-mar
Copy link
Contributor Author

aiday-mar commented Dec 16, 2024

Hi @jkyeung and @junetried thank you for the comments and interesting ideas. I see what you mean. I am not sure about idea number 2. If backspace works like left arrow and does not remove anything, then what key will remove text? Idea number 3 is something I could implement. I have created a new issue to myself: #236191

@jkyeung
Copy link

jkyeung commented Dec 16, 2024

I am not sure about idea number 2. If backspace works like left arrow and does not remove anything, then what key will remove text? Idea number 3 is something I could implement. I have created a new issue to myself: #236191

For option 2, the usual way to remove text would be to back up, then press the Space bar as needed. (This is what I'm used to from certain terminal interfaces.)

I agree it's perhaps less useful or efficient than replacing with whitespace as you go, but I could imagine option 3 being trickier because it should handle tabs and indentation sensibly, not just individual spaces. Not saying it's hard exactly, just that you may need to keep more things in mind when implementing it. For me, option 2 done correctly would be better than option 3 done incorrectly or incompletely. But sure, if you get it right, option 3 is probably the most desirable.

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

Successfully merging this pull request may close these issues.

Insert key doesn't switch to overtype/overwrite mode
6 participants