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

Exclude cursor when doing ctrl-w #2431

Merged
merged 1 commit into from
May 11, 2022
Merged

Conversation

pickfire
Copy link
Contributor

@pickfire pickfire commented 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 #2390

asciicast

cc @scgtrp thanks for reporting the issue

Would be good if @cessen can review, I wonder if there is a better solution for this

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
@pickfire pickfire requested a review from cessen May 8, 2022 15:39
@archseer archseer merged commit 0477d02 into helix-editor:master May 11, 2022
@pickfire pickfire deleted the fix-ctrl-w branch May 11, 2022 01:20
@EricCrosson
Copy link
Contributor

Thank you @pickfire !! I have noticed this but had not gotten around to the fix

🚀 🚀 🚀

@pickfire
Copy link
Contributor Author

pickfire commented May 11, 2022

I just realized there is a bug on this, first insert

hello

Then go to EOF (spam j), and delete one character (newline) backward, then ctrl-w, o still remains.

@EricCrosson
Copy link
Contributor

Hmm, I can't reproduce that

I'm on

; hx --version
helix 22.05-dev (7b287f63

When I insert

hello

then spam j, delete one character backward (with backspace), then press Ctrl-w, I only have a newline remaining in the buffer

@scgtrp
Copy link
Contributor

scgtrp commented May 11, 2022

I can reproduce it, but I think I see why you can't: @pickfire and I are doing
hello\n
delete one character:
hello
ctrl-W:
o

but it sounds like you're doing:
hello\n
delete one character:
hell\n
ctrl-W:
\n

@pickfire
Copy link
Contributor Author

pickfire commented May 12, 2022

@scgtrp Thanks for making it more accurate, I forgot to say delete one newline character using backspace on insert mode. Oh, seemed like if the newline was deleted from normal mode and insert mode both have the same result.

  1. insert hello\n
  2. j
  3. insert <backspace><ctrl-w> (or d then insert ctrl-w)

mtoohey31 pushed a commit to mtoohey31/helix that referenced this pull request 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 pull request 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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ctrl-W sometimes deletes a character from the wrong side of the cursor
4 participants