Skip to content

insert mode Ctrl+left/right navigation is kinda broken #3395

Closed
@adsick

Description

@adsick

Hi, referring my long complain about Helix not being as good as I would want it to be I am writing this issue to clear more on what is wrong with word-wise navigation in insert mode.

assume we have this text (repeated 2-3 times to demonstrate wrapping behaviors):

    println!("Hello, world!");

How it works in VS Code

    |println!("Hello, world!");
    println|!("Hello, world!");
    println!("|Hello, world!");
    println!("Hello|, world!");
    println!("Hello,| world!");
    println!("Hello, world|!");
    println!("Hello, world!");|

and backwards:

    println!("Hello, world!");|
    println!("Hello, world|!");
    println!("Hello, |world!");
    println!("|Hello, world!");
    println|!("Hello, world!");
    |println!("Hello, world!");

How it looks in Helix

    |println!("Hello, world!");
    printl|n!("Hello, world!");
    println!(|"Hello, world!");
    println!("Hell|o, world!");
    println!("Hello,| world!");
    println!("Hello, worl|d!");
    println!("Hello, world!")|;

you might think that the next step will be

    println!("Hello, world!");|

but in fact it wraps to the next line and sits like this:

    println!("Hello, world!");
    printl|n!("Hello, world!");

and when navigating backwards it will visit different stops than when navigating forward:

    println!("Hello, world!");
    printl|n!("Hello, world!");
    println!("Hello, world!");
    |println!("Hello, world!");
    println!("Hello, world|!");
    println!("Hello,| world!");
    println!("Hello|, world!");
    println!("|Hello, world!");
    println|!("Hello, world!");
    |println!("Hello, world!");

whoa, that's a lot of greetings! I really hope that you can spot what I'm talking about.

from this little experiment we can conclude a few things:

  1. Helix's word-wise navigation does not matches VSC's one (and also vim's one but you can check that for yourself)
    there are other contexts like command-line prompt when you can use Ctrl+left/right to navigate, and they're also differ, but some things (like where the stop sits, on the last char or before it) are more sensible there as well
  2. I find VS Code's variant much more sensible and convenient
  3. Helix's navigation looks better backwards than forwards
  4. Some deeper investigation needed to determine what to do with it.

I've noticed that Ctrl+left/right uses move_prev_word_end and move_next_word_start actions, and as properly mentioned in a similar issue #2729 it should be decided what we should count as a word (and whether to use or not this ambiguous term at all)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-helix-termArea: Helix term improvementsC-discussionCategory: Discussion or questions that doesn't represent real issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions