elves / elvish

Powerful scripting language & versatile interactive shell
https://elv.sh/
BSD 2-Clause "Simplified" License
5.73k stars 303 forks source link

pkg/cli: Add histlist option to reverse listing #1838

Closed mpenick closed 1 month ago

mpenick commented 2 months ago

This provides a variable (edit:histlist:reverse) to reverse the listing, with more recent commands at the top, but leaves the default order as more recent at the bottom.

set edit:histlist:reverse = $true

Reversing (most to least recent commands) the histlist makes it easier to see more recent commands quickly without having to look near the bottom of the screen.

krader1961 commented 1 month ago

Does this have any implications for the &newest-first option of the edit:command-history command? Should there be an explicit mention that setting this to $true does not affect the default order of that command? And should the documentation for that command have at least a "see also" reference to this variable? Also, AFAICT, this doesn't document the new variable and it doesn't include any unit tests to verify the behavior introduced by this change.

xiaq commented 1 month ago

Hi! Not sure about the exact reason you closed the PR, but this seems like a reasonable feature request.

I'm in the process of rewriting the Elvish TUI so I probably won't be accepting this PR as is (in particular, I'll probably implement a different API), but I filed #1847 to track this.