Feat/792: Add vim-style gg/G navigation to the main panel#816
Open
Suhird wants to merge 6 commits into
Open
Conversation
Add GotoTop and GotoBottom translation entries used by the upcoming vim-style gg/G navigation bindings in the main panel.
Add handlers that scroll the main panel to the top and bottom. gotoTopMain implements the vim-style "gg" double press (gocui has no native key-sequence support) by tracking the last 'g' press timestamp in the gui state, while gotoBottomMain jumps to the final line, honouring the ScrollPastBottom config. The origin math and double-press timing are factored into pure helpers so they can be unit tested.
Pressing 'gg' jumps to the top and 'G' jumps to the bottom of the main panel, matching vim navigation. The bindings are scoped to the main view so they apply across all of its tabs (Config, Logs, Env, Stats, Top).
When the main panel is focused (e.g. the Container Config screen) the options bar now lists the gg/G scroll-to-top/bottom shortcuts alongside the existing scroll and navigation hints.
Cover the gotoBottomOriginY origin math (scroll-past-bottom on/off, content shorter than the view, empty content) and the isDoublePress timing used to detect the vim-style "gg" double press.
Auto-generated from the new main-panel scroll-to-top/bottom bindings.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #792
What
Adds vim-style scroll navigation to the main panel (where the Container Config
screen, and the other tabs, render):
gg— scroll to the topG(Shift+g) — scroll to the bottomThe shortcuts are also surfaced in the options bar at the bottom whenever the
main panel is focused.
Notes
mainview, so they work across all of itstabs (Config, Logs, Env, Stats, Top), consistent with how the existing
k/jscrolling works.
ggis implemented as adouble-press of
gwithin a short time window (tracked via a timestamp in thegui state).
Gis a normal single binding.Ghonours the existinggui.scrollPastBottomconfig when computing thebottom origin.
Tests
gotoBottomOriginYorigin math andthe
isDoublePresstiming) inpkg/gui/main_panel_test.go, matching therepo's existing test style.
go run scripts/cheatsheet/main.go generate).gofmt -s,go vet,go test -race ./..., and the cheatsheet/vendor checks all pass locally.