-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix backwards character deletion on other whitespaces #2855
Fix backwards character deletion on other whitespaces #2855
Conversation
We actually probably just want to change this check here: helix/helix-term/src/commands.rs Line 2947 in 5b3b6ff
Most indentation will be using spaces or tabs, rather than full-width characters. I don't have a strong opinion on it though. |
actually, i don't have any strong opinion either, however the change happened like that because this already looked rather wrong. |
helix-term/src/commands.rs
Outdated
@@ -2981,7 +2981,7 @@ pub mod insert { | |||
for _ in 0..drop { | |||
// delete up to `drop` spaces | |||
match chars.next() { | |||
Some(' ') => start -= 1, | |||
Some(c) if c.is_whitespace() => start -= 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this won't work correctly with whitespace that has a wider width than 1 (eg. space used in Japanese text).
The body of this function should be extracted into helix-core
and properly unit tested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this won't work correctly with whitespace that has a wider width than 1 (eg. space used in Japanese text).
Well the Japanese text spaces are Ideographic Spaces.
I also filed this bug because i am using a japanese ime quite frequently.
This change has been tested locally, and works.
However i see what you mean, would it maybe make sense to something similar as the width
variable for the substraction of the pos?
Some(c) if c.is_whitespace() => start -= c.width().unwrap_or(1),
helix-term/src/commands.rs
Outdated
@@ -2981,7 +2981,7 @@ pub mod insert { | |||
for _ in 0..drop { | |||
// delete up to `drop` spaces | |||
match chars.next() { | |||
Some(' ') => start -= 1, | |||
Some(c) if c.is_ascii_whitespace() => start -= 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is an unnecessary change, as aside from line endings, tab and space are the only two recognized as ascii whitespace.
This issue closes #2842
In summary:
delete_char_backward
ignored any other whitespace other than ' ', which resulted in you not being able to backspace orC-h
on insert mode when there's only whitespace with the character next to the cursor being a lexiographic whitespace.