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

Cursor shifts on multiple selection letter case changes #5910

Open
ondrej-ivanko opened this issue Feb 10, 2023 · 1 comment · May be fixed by #5930
Open

Cursor shifts on multiple selection letter case changes #5910

ondrej-ivanko opened this issue Feb 10, 2023 · 1 comment · May be fixed by #5930
Labels
C-bug Category: This is a bug

Comments

@ondrej-ivanko
Copy link

ondrej-ivanko commented Feb 10, 2023

Summary

Hi,

I was working on hx tutor file (chapter 10.3) and ran to some issue with cursor shifting right on one of the multi-selected text.

Reproduction Steps

I tried this:

  1. hx
  2. write: this sentence should all be in lowercase.
  3. select whole line x
  4. search in selection with s
  5. input regex: [b,e,l]
  6. switch case: ~ couple of times

I expected this to happen:
Only selected characters change case. Cursor remains on those characters.

Instead, this happened:
Notice cursors shift to right from all be text and starts affecting different characters.

Helix log

No logs, as it does not cause error.

Platform

Linux - Fedora 37 86_64

Terminal Emulator

Alacritty 0.10.1

Helix Version

helix 22.12-223-g9c98043c (9c98043)

@ondrej-ivanko ondrej-ivanko added the C-bug Category: This is a bug label Feb 10, 2023
@ondrej-ivanko ondrej-ivanko changed the title Cursor shifts on multiple selection switching case Cursor shifts on multiple selection letter case changes Feb 10, 2023
@pascalkuthe
Copy link
Member

The reason for this bug is that helix doesn't have a proper concept of replacement. Instead replacing a char is treated as a pair of delete + inserts. The problem here is (I believe) that the characters are adjesent and therefore helix thinks that a chunk of text is being removed (move cursor to either side of that and then reinserted.

I am not sure if/how we would fix that altough I ran into similar issues before so it would be nice to correct

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.

2 participants