-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
:w selects the whole file, thus losing caret placement. #2752
Comments
strangely enough, it only happens to one file: 2022-06-12_01-28-14.mp4any ideas what might be happening? more info: |
Could be due to line endings? (from #2404):
|
This happens to me too, after I upgraded to 22.05. Unfortunately I don't remember what my previous helix version was. I've only seen it in rust-files when auto-format is on. I use rust-analyzer. Running helix with the same configuration on a remote ubuntu machine works fine, so it seems to be windows-related. PlatformWindows 10 Terminal Emulatoralacritty 0.10.0 (8a26dee) Helix Versionhelix 22.05 (27609f5) |
@sudormrfbin possibly, i actually tried rewriting the entire file but it still caused the same problem. like i recreated it from scratch. so i have no idea what is happening... |
I think that's consistent with the line-endings theory. IIRC, if you're on windows you'll use |
Yeah, when using Thanks! |
Yeah, showing the current line-endings could be a good addition after #2434. I think this happens because rust-analyzer wants to use only lf line-endings. When it sees crlf, it reformats them all to lf. |
Perhaps it would also be possible to ask for rust-analyzer to be smarter about files with different line endings? I also wonder if other text editors have this issue with CRLF, and how they retain cursor position (if they do). |
For reference, this is the behaviour @the-mikedavis mentioned. But that would mean we only get this behaviour once. Currently it happens again, even after rust-analyzer changed the line endings. Presumably because helix changes the line endings right back?! Looks like Document::detect_indent_and_line_ending is not called in this case. Maybe it should be called in general when LS sends a whole doc? Just like when the document is reloaded from disk? |
Ah good catch @farwyler! Yes let's call |
@the-mikedavis will do |
Additionally... i found a bug in rust-analyzer as well. When it sends the whole document because it wants to change the line endings, the replacement document actually uses the old line endings. This results in helix always receiving the whole document, because the endings never actually change. I have created an issue here |
Closed by #2778. |
Summary
2022-06-12_01-23-27.mp4
as seen in the video above, when keying in
:w
, the entire file gets selected, and my caret always returns to the start when i exit it.settings:
thank you!
Reproduction Steps
I tried this:
:w
I expected this to happen:
no selections made.
Instead, this happened:
above video.
Helix log
~/.cache/helix/helix.log
Platform
Windows
Terminal Emulator
Windows Terminal Preview 1.14.1451.0
Helix Version
helix 22.05 (27609f5)
The text was updated successfully, but these errors were encountered: