Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Improve pager wraparound #4680
This fixes a few cases where the pager didn't correctly wrap around.
It fixes #4669, in that moving down now also wraps around if the current selection is the last row in the last column. The same goes for moving "east" (e.g. via "forward-char") and "west" (e.g. via "backward-char").
It also fixes #3115, by allowing up to move into the pager if nothing is selected. So up from the first element will still jump into the commandline (which we might want to change, since it's the only way to do so), while up from the commandline will jump to the last element in the pager.
@laughedelic: Of course this is independent of the particular key - this modifies the pager's movement function, so any binding that calls any bind function that then moves the pager selection with one of the affected directions will be affected.
These are bound to "up-or-search"/"down-or-search" respectively, which are wrapper functions that call the "up-line"/"down-line" bind functions. So yes, they are fully affected.
These are bound to "complete" and "complete-and-search", which call the pager movement with "direction_next"/"direction_prev". They aren't affected, but there's nothing particularly wrong with them as far as I'm aware.
This needs some adjustment to the tests - I didn't notice that we had some in src/fish_tests.cpp (I always forget about that, and I don't think
The first failure is moving "west". Let's say the pager looks like this:
(with  denoting the cursor position on the
and move "west"? Currently, this goes to
So moving east or west just iterates in (western) reading-order - go through all the columns, then go to the next row and the starting column. Whereas now it does that, except it gets stuck in the last row.
This makes it so that east/west reverse each other, which is a nice property. On the other hand, that "column memory" feature is now gone as far as I can tell.