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

Append cursor positioning is not consistent during editing #4074

Closed
trink opened this issue Oct 2, 2022 · 4 comments · Fixed by #4147
Closed

Append cursor positioning is not consistent during editing #4074

trink opened this issue Oct 2, 2022 · 4 comments · Fixed by #4147
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug E-easy Call for participation: Experience needed to fix: Easy / not much E-good-first-issue Call for participation: Issues suitable for new contributors

Comments

@trink
Copy link
Contributor

trink commented Oct 2, 2022

Summary

Append fails to position the cursor at the end of the selection

Reproduction Steps

  1. open hx
  2. type itest<esc>ba # insert test, enter normal mode, back select the word, and append
  3. the cursor will be properly positioned after the last 't'
  4. <esc>xditest<esc>ba # delete the line and do it again
  5. the cursor will now be positioned between the 's' and the 't'

Helix log

nothing reported in the log

Platform

Linux

Terminal Emulator

st 0.8.5, gnome-terminal (GNOME Terminal 3.44.0 using VTE 0.68.0 +BIDI +GNUTLS +ICU +SYSTEMD

Helix Version

helix 22.08.1 (6caa7a7)

@trink trink added the C-bug Category: This is a bug label Oct 2, 2022
@dead10ck
Copy link
Member

dead10ck commented Oct 2, 2022

Confirmed. It looks like this happens because there is no final line feed. When the cursor is on the last character, helix inserts a new line feed and positions the cursor correctly, but it seems that it does not do this if the head of the selection is not on the last character of the document.

@dead10ck dead10ck added E-easy Call for participation: Experience needed to fix: Easy / not much A-helix-term Area: Helix term improvements E-good-first-issue Call for participation: Issues suitable for new contributors labels Oct 2, 2022
@startup-stack-sculptor
Copy link

This issue also seems to be present with my XFCE terminal emulator. I'm working on it to fix the issue

@ErdoganSeref
Copy link

The error doesn't occur when there is an empty line below. extend_line_below causes the issue because after the selection d deletes the newline.

@Manosmer
Copy link
Contributor

Manosmer commented Oct 7, 2022

I would like to add some more findings on this. In Normal mode and with the final '\n' removed (<Esc>xditest<Esc>), when the cursor is at the right-most position (the pseudo-space after the word "test") both append (a) and insert i work as expected, meaning they transition to Insertion mode right at the end of the file. However, as @dead10ck mentioned above, when the cursor is on the last letter of "test", append seems to add a new line automatically. I think this could be classified as undesired behaviour in cases where the user simply did not wish to add the newline character at the end of the document. Moreover, it is also a matter of consistency since the new line is not added with the aforementioned way if there is already another line after the current.

Platform/Emulator: MacOS/iTerm2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug E-easy Call for participation: Experience needed to fix: Easy / not much E-good-first-issue Call for participation: Issues suitable for new contributors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants