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 on empty line is wrong #1377

Closed
adsick opened this issue Dec 25, 2021 · 12 comments
Closed

append on empty line is wrong #1377

adsick opened this issue Dec 25, 2021 · 12 comments
Labels
A-helix-term Area: Helix term improvements C-discussion Category: Discussion or questions that doesn't represent real issues R-wontfix Not planned: Won't fix

Comments

@adsick
Copy link

adsick commented Dec 25, 2021

to reproduce:

  1. move a cursor to empty line
  2. press a
  3. observe cursor on the next line
    image
    background goes back to normal after you press Enter
@adsick adsick added the C-bug Category: This is a bug label Dec 25, 2021
@matoous
Copy link
Contributor

matoous commented Dec 25, 2021

This is intended behavior. In helix your cursor can be placed on the new line character which is happening in this case and after pressing a for append you are appending after the EOL thus on new line. I brought up similar question a few days ago in the matrix chat, you can find it there for more context. I was also confused by this behavior but it makes sense in the overall design of Helix. On the other hand, I still dislike it because I usually edit text by appending a and it requires mental focus to switch to i when at the end of line. Personally I would prefer for a to not open a new line.

The background is cursor highlight, nothing wrong there I think.

@adsick
Copy link
Author

adsick commented Dec 26, 2021

The background is cursor highlight, nothing wrong there I think.

yea, but I don't get why there is so called "highlight" (because when i insert with i the background is clean as it should be)

@heliostatic
Copy link
Contributor

I just ran into this today via paste onto a blank line. Very unintuitive, and inconsistent from a user perspective (even users building their terminal text editors nightly ;)

Example with a new file where I find it unintuitive:

2022-01-25.at.15.48.19.-.Alacritty.-.CleanShot.mp4

@norman784
Copy link
Contributor

I also find annoying the append behaviour, in my case I'm used to create a new line explicitly if I want it with o. If this is the intended behaviour, at least we need an option to configure so we can say that append shouldn't create a new line.

@diktomat
Copy link
Contributor

diktomat commented Apr 5, 2022

Same applies to adding when cursor is at end of line and is fairly annoying:

some text█
some other text
# -> press `a`
some text
|some other text

Maybe let the user disable placing the cursor on the eol character in the config?

@kennyishihara
Copy link

The background is cursor highlight, nothing wrong there I think.

yea, but I don't get why there is so called "highlight" (because when i insert with i the background is clean as it should be)

I also find the highlighting annoying after append after a word. For me, it is more intuitive that the highlighting goes away when entering insert mode with a, just like how it is with i.

@wmstack
Copy link
Contributor

wmstack commented May 18, 2022

The highlighting doesn't go away either after going into insert mode OR append mode.
Before append/insert:
image
After append:
image
After insert:
image

As you can see, the selection is still there. Definitely surprising behaviour. One more thing I want to mention. Suppose you say well, "let me collapse the selection before append, that should fix it right". Well, no!

After collapsing selection
image

Appending after collapsing the selection!
image
Still doesn't get rid of the highlight.

@kirawi kirawi added C-discussion Category: Discussion or questions that doesn't represent real issues A-helix-term Area: Helix term improvements and removed C-bug Category: This is a bug labels May 26, 2022
@adsick
Copy link
Author

adsick commented Aug 5, 2022

will it ever be fixed?

@the-mikedavis
Copy link
Member

As matoous says, this is intentional behavior. You're on a line-ending character so append will insert text after the line-ending - on the next line. The behavior you're looking for is most closely emulated by A which inserts before the line-ending character.

Whether your cursor is on a line-ending or not is more clear if you enable visible whitespace. You can do so just for newlines:

# ~/.config/helix/config.toml
[editor]
whitespace.render.newline = "all"

@the-mikedavis the-mikedavis closed this as not planned Won't fix, can't repro, duplicate, stale Aug 5, 2022
@the-mikedavis the-mikedavis added the R-wontfix Not planned: Won't fix label Aug 5, 2022
@Tarbetu
Copy link

Tarbetu commented Nov 21, 2023

This is cool, but this prevents me to get into Helix/Kakoune. Is there will be any setting for this behaviour?

Edit: I got into Helix for my daily use. :) This stills a bit weird to me, but I get used with it.

@giganteous
Copy link

giganteous commented Jan 20, 2024

Hello all,

I'm running into this issue too because of unintuitive behaviour. I'm new to the editor as well, so I might be the stubborn one.

If i:

  • have some empty and some nonempty lines,
  • add cursors on every line
  • go to the end of the line (gl)
  • append text (a),

... what then happens is that some text is added to the end of the current line (before newline) while on the empty lines, the text is inserted before the next line. It's not consistent, or "gl" (goto line end) is not working as I'd be understanding.

(the same counts for selecting the current line with X standing on an empty line: it selects 2 lines)

I don't want to sound unthankful, helix' editing is a very consistent experience! thanks!

EDIT: found out that capital A is the one I need. I'll remap the keys a bit.

@Diegovsky
Copy link

sorry to bump and old closed thread, but I wanted to ask nonetheless: would you be willing to review/accept a PR which implements behaviour such that pressing 'a' on a newline works like in vim?

Of course: this behaviour would be behind a configuration flag.

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-discussion Category: Discussion or questions that doesn't represent real issues R-wontfix Not planned: Won't fix
Projects
None yet
Development

No branches or pull requests