Skip to content
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

Merged
merged 4 commits into from
Jul 1, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions helix-term/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2944,7 +2944,7 @@ pub mod insert {
let line_start_pos = text.line_to_char(range.cursor_line(text));
// consider to delete by indent level if all characters before `pos` are indent units.
let fragment = Cow::from(text.slice(line_start_pos..pos));
if !fragment.is_empty() && fragment.chars().all(|ch| ch.is_whitespace()) {
if !fragment.is_empty() && fragment.chars().all(|ch| ch.is_ascii_whitespace()) {
if text.get_char(pos.saturating_sub(1)) == Some('\t') {
// fast path, delete one char
(
Expand Down Expand Up @@ -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,
Copy link
Member

@kirawi kirawi Jun 28, 2022

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.

_ => break,
}
}
Expand Down