Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@joelim-work
Copy link
Collaborator

The current implementation for the scroll-up/scroll-down commands is mostly fine but I managed to get it to crash using the following steps:

  1. Ensure there are more files than the pane height (the cursor is at the first row, on the first file)
  2. Press <c-e> to scroll-down (the cursor is at the first row, on the second file)
  3. Press 2<c-y> to scroll-up twice
    • The result is already wrong here - the cursor is somehow at the third row, but it should be at the second row on the second file (the result of executing scroll-up once), and the second scroll-up should be a no-op as directory already shows the first file and cannot be scrolled up further.
  4. Continue pressing <c-y>
    • The cursor continues moving down despite the fact that the directory cannot be scrolled up further, but this is the result of being in an invalid state.
  5. Eventually lf will crash

The logic can also be cleaned up and should have the following steps:

  1. Shift dir.pos as much as possible (both the cursor and files will scroll)
  2. Compensate for the remaining required distance by shifting dir.ind (the cursor cannot move any further, but continue scrolling files)

@joelim-work joelim-work added the fix Pull requests that fix existing behavior label Dec 24, 2025
@joelim-work joelim-work added this to the r41 milestone Dec 24, 2025
@joelim-work joelim-work merged commit 36cf932 into gokcehan:master Dec 24, 2025
32 checks passed
@joelim-work joelim-work deleted the fix-scroll-crash branch December 24, 2025 02:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Pull requests that fix existing behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant