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

ctrl-W sometimes deletes a character from the wrong side of the cursor #2390

Closed
scgtrp opened this issue May 4, 2022 · 1 comment · Fixed by #2431
Closed

ctrl-W sometimes deletes a character from the wrong side of the cursor #2390

scgtrp opened this issue May 4, 2022 · 1 comment · Fixed by #2431
Assignees
Labels
C-bug Category: This is a bug

Comments

@scgtrp
Copy link
Contributor

scgtrp commented May 4, 2022

Summary

When in insert mode, you can use ctrl-W to delete words from the left of the cursor, like many other terminal programs. Sometimes, this also deletes the character to the right of the cursor in addition to the word to the left.

This seems to be triggered by punctuation adjacent to letters; I have not managed to work out under exactly what circumstances it happens, but I have found that:

  • it is deterministic (so not race conditions from hitting ^W^W^W too fast or something)
  • it is reproducible in plain text mode (so not LSP weirdness)
  • it does not happen with space-separated words

Reproduction Steps

Recording, if you'd prefer that: https://asciinema.org/a/EQ1VxVOSIMiWT9Upk4OSyBMQw

  • In an empty buffer, enter some text with punctuation, e.g. hello::world::I::have::some::namespaces
  • Place the cursor between the word have and the following ::, with no selection.
  • Press i, then ctrl-W seven times.
  • At this point I would expect the remaining text to be ::some::namespaces; instead, it is me::namespaces.
  • Probably related: continuing to press ^W after there is no more text at the start of the line deletes one additional character each time.

Helix log

~/.cache/helix/helix.log Nothing relevant, only these two lines complaining about my theme:
2022-05-04T01:32:01.596 helix_view::theme [WARN] Theme: malformed hexcode: form
2022-05-04T01:32:01.596 helix_view::theme [WARN] Theme: malformed hexcode: fg

Platform

Linux

Terminal Emulator

kitty 0.25.0

Helix Version

22.03 (Arch package), and also git 22.03-185-g09a17e4f

@scgtrp scgtrp added the C-bug Category: This is a bug label May 4, 2022
@archseer archseer assigned archseer and pickfire and unassigned archseer May 4, 2022
@pickfire
Copy link
Contributor

pickfire commented May 6, 2022

I think I noticed something with B as well in normal mode which probably is the cause of this, need to check.

pickfire added a commit to pickfire/helix that referenced this issue May 8, 2022
Currently ctrl-w in insert mode deletes the cursor which results in
unexpected behavior. The patch also reduces the selection to cursor before
performing prev word to remove the behavior of removing unnecessary text
when nothing should be removed.

1. `::#(|)#::` after `ctrl-w` should be `#(|)#::`, previously `#(|)#:`
2. `#(|::)#` after `ctrl-w` should be `#(|::)#`, previously `#(|)#`

Fix helix-editor#2390
archseer pushed a commit that referenced this issue May 11, 2022
Currently ctrl-w in insert mode deletes the cursor which results in
unexpected behavior. The patch also reduces the selection to cursor before
performing prev word to remove the behavior of removing unnecessary text
when nothing should be removed.

1. `::#(|)#::` after `ctrl-w` should be `#(|)#::`, previously `#(|)#:`
2. `#(|::)#` after `ctrl-w` should be `#(|::)#`, previously `#(|)#`

Fix #2390
mtoohey31 pushed a commit to mtoohey31/helix that referenced this issue Jun 15, 2022
Currently ctrl-w in insert mode deletes the cursor which results in
unexpected behavior. The patch also reduces the selection to cursor before
performing prev word to remove the behavior of removing unnecessary text
when nothing should be removed.

1. `::#(|)#::` after `ctrl-w` should be `#(|)#::`, previously `#(|)#:`
2. `#(|::)#` after `ctrl-w` should be `#(|::)#`, previously `#(|)#`

Fix helix-editor#2390
mtoohey31 pushed a commit to mtoohey31/helix that referenced this issue Jun 15, 2022
Currently ctrl-w in insert mode deletes the cursor which results in
unexpected behavior. The patch also reduces the selection to cursor before
performing prev word to remove the behavior of removing unnecessary text
when nothing should be removed.

1. `::#(|)#::` after `ctrl-w` should be `#(|)#::`, previously `#(|)#:`
2. `#(|::)#` after `ctrl-w` should be `#(|::)#`, previously `#(|)#`

Fix helix-editor#2390
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants