zed icon indicating copy to clipboard operation
zed copied to clipboard

Fix VIM cw on last character of a word doesn't work as expected:

Open Kalmaegi opened this issue 1 year ago • 4 comments

At the moment, using the default expand_selection seems to do the job well, without the need for some additional logic, which may also make the code a little clearer, Fix #10945

Release Notes:

  • N/A

Kalmaegi avatar Apr 25 '24 02:04 Kalmaegi

I'd love to delete all the code if we can :D. What happened?

ConradIrwin avatar Apr 25 '24 03:04 ConradIrwin

I'd love to delete all the code if we can :D. What happened?

After removing the extra logic, the logic of change is basically similar to delete, for selection, but there are some boundary cases that require them to be different, and I need to confirm a little further XD

Kalmaegi avatar Apr 25 '24 03:04 Kalmaegi

Teˇst test after cw should be: Teˇ test, If no additional processing is done, it will become at the moment: Teˇtest, Since our range logic includes spaces, there may still be some additional details to be processed

Kalmaegi avatar Apr 25 '24 03:04 Kalmaegi

It seems that we can only add a judgment at the end of an object to deal with the edge case, use a tactical patch, and tidy up the previous code, remove some unnecessary branches, and not modify the original execution logic

Kalmaegi avatar Apr 26 '24 01:04 Kalmaegi

Makes sense, thanks. Could you please add a test too so we can avoid regressing this when we want to refactor it.

ConradIrwin avatar Apr 26 '24 02:04 ConradIrwin

Makes sense, thanks. Could you please add a test too so we can avoid regressing this when we want to refactor it.

I forgot, thanks for the reminder

Kalmaegi avatar Apr 26 '24 02:04 Kalmaegi

Thanks!

ConradIrwin avatar Apr 26 '24 03:04 ConradIrwin