helix-editor / helix

A post-modern modal text editor.
https://helix-editor.com
Mozilla Public License 2.0
33.7k stars 2.5k forks source link

Content in split view shifts when lines added above #6322

Open lefp opened 1 year ago

lefp commented 1 year ago

Summary

See the recording: https://asciinema.org/a/9WzLvaltn1a71NWBKOsIPsggM?t=15

I often use a split view to edit one part of a file while looking at another part of the same file.

But if I'm editing, e.g., around line 50 in WindowA while viewing line 200 in WindowB, I can see the text in WindowB start to shift downward as I add new lines in WindowA. This is inconvenient because I have to periodically move my location in WindowB to keep looking at the same content.

The expected behavior is that WindowB automatically accounts for lines being added above and shifts its view so that the user continues to see the same "relative" part of the file.

Reproduction Steps

https://asciinema.org/a/9WzLvaltn1a71NWBKOsIPsggM?t=15 1. Open a large buffer. 2. Create a split view of it (C-w, C-v). 3. In the new window, go many lines lower in the file. 4. In the first window, create new lines (i, Enter). You will see the text in the new window start to shift down. ### Helix log _No response_ ### Platform Linux ### Terminal Emulator alacritty 0.10.1 ### Helix Version helix 22.12
lefp commented 1 year ago

Actually, looks like this was almost completely fixed by 4dcf1fe66ba30a78edc054780d9b65c2f826530f ; since then it only shifts down one time.

I'll close the issue.

mxmerz commented 5 months ago

I am sorry to revive this issue, but I believe this bug still exists in helix 24.3 (2cadec0b), Platform macOS, iTerm2. Please tell me if opening a new issue would be better.

It is true that it shifts down one time directly when you insert a character, but then afterwards it also sometimes shifts down, depending on the number of characters in the next line (?).

To reproduce:

1
22
333
4444
55555
666666
7777777
88888888
999999999
0000000000

→ Scroll the "upper" view to here and then re-type the following line (l.14)
  into the line below (line 15).
rr1234567890r123456789r12345678r1234567r123456r12345r1234r123r12r1rr1234567890r123456789r

1
22
333
4444
55555
666666
7777777
88888888
999999999
0000000000

1
22
333
4444
55555
666666
7777777
88888888
999999999
0000000000

1
22
333
4444
55555
666666
7777777
88888888
999999999
0000000000

1
22
333
4444
55555
666666
7777777
88888888
999999999
0000000000

→ Scroll this line to the top of the second split view.
Every time you insert as many characters in the upper split
as there are in the line just above the first line you see
in the lower view, the lower view will move one line down.

Example: If the line with eight `8` characters is visible,
         then the line with seven `7` characters is the next one.
         If you enter any seven characters in the upper view,
         the lower view will move.

1
22
333
4444
55555
666666
7777777
88888888
999999999
0000000000