helix icon indicating copy to clipboard operation
helix copied to clipboard

Accessibility Improvement - Option for always centering cursor vertically

Open jquesada2016 opened this issue 3 years ago • 6 comments

Describe your feature request

This is a complimentary feature request for #3217.

The idea for this feature is to add an option in the [editor] config to always keep the cursor centered on the screen vertically. This would make finding the cursor relatively trivial, as one would only have to scan a single predictable line instead of needing to look everywhere.

The exact behavior should be as described:

On any line change, automatically scroll the viewport so that the cursor is exactly in the center.

jquesada2016 avatar Jul 30 '22 15:07 jquesada2016

Just set the scrolloff config value to something really high (999).

archseer avatar Jul 30 '22 15:07 archseer

@archseer that did not seem to provide the desired behavior.

jquesada2016 avatar Jul 30 '22 15:07 jquesada2016

So upon further testing, scrolloff does provide the desired behavior, but only when the file is larger than the viewport, and does not function as intended near the top of the file,.

jquesada2016 avatar Jul 30 '22 15:07 jquesada2016

Not a real solution but while waiting for an implementation, you can use zz to center the cursor when not at the top of the file. Quite cumbersome if you always want the cursor to be centered on each line change sadly :/

poliorcetics avatar Aug 02 '22 21:08 poliorcetics

I am looking for something related. I want helix to mimic the way vim behaves with scrolloff = 999. Specifically, I want it to never display empty lines past the beginning or the end of the file, at the expense of allowing the cursor to be not in the center of the screen.

Right now, with scrolloff = 999, at the top of a file it breaks the cursor centering rule so that the entire screen is filled with the file contents:

image

But when I scroll to the bottom of the file, half of the screen is empty:

image

This is inconsistent. I would expect it to do one of two things:

  1. Always display the cursor in the middle of the screen, even if that means printing blank lines above or below it.
  2. Always display a full screen of text when the file is longer than the height of the screen. When at the top or the bottom of a file, allow the cursor to deviate from its position in the middle of the screen. This is how vim behaves.

I propose introducing an option that lets the user configure this behaviour. That way, both @jquesada2016 and I can get what we want :)

adamkpickering avatar Aug 04 '22 23:08 adamkpickering

There's an added nuisance in that even with scrolloff = 999 there's wiggle room around the cursor when direction of motion is changed (j to k or vice versa). Visually, this behaves like a long typematic delay, i.e. pretty annoying!

adrian5 avatar Sep 18 '22 10:09 adrian5

Any updates?

vaheqelyan avatar Nov 16 '23 17:11 vaheqelyan