helix icon indicating copy to clipboard operation
helix copied to clipboard

Opening a file at its last line does not match going to the last line

Open justinlovinger opened this issue 1 year ago • 1 comments

Summary

Opening a file with hx +999999 positions the last line of the file in the center of the window. I expect it to act like g e, respecting scrolloff.

P.S. I am trying to configure Helix as a scrollback-editor in Zellij. Ideally, the text should change as little as possible from the scrollback when opening it in Helix. Currently, the text jumps drastically due to the above-mentioned centering.

Reproduction Steps

  1. Open a file with enough text to fill a page using hx +999999.

Helix log

Log is empty.

Platform

Linux

Terminal Emulator

alacritty 0.12.3

Installation Method

Nixpkgs

Helix Version

helix 23.10 (f6021dd0)

justinlovinger avatar Feb 23 '24 12:02 justinlovinger

A man accepts!

brunbjerg avatar Apr 02 '24 20:04 brunbjerg

We always center when jumping or opening at a location. In the long run I think this could be solved with scripting a command on startup to do ge but in the meantime I don't want to add a special case for this and introduce inconsistency

the-mikedavis avatar Apr 24 '24 01:04 the-mikedavis

We always center when jumping or opening at a location. In the long run I think this could be solved with scripting a command on startup to do ge but in the meantime I don't want to add a special case for this and introduce inconsistency

Actually, jumping to the last line with 999999G, or any other number equal to or greater than the number of lines, does not center. I cannot reproduce the behavior of hx +999999 without manually centering using zc. The + option seems to be the inconsistency here.

justinlovinger avatar Apr 24 '24 21:04 justinlovinger

I'm saying that any time we open a location - from pickers for example but also any LSP motion, :open, etc. - we center. Motions like j or G are different, they move the cursor and the view moving is just a consequence of keeping the cursor in view

the-mikedavis avatar Apr 24 '24 21:04 the-mikedavis