File tree Expand file tree Collapse file tree 2 files changed +45
-16
lines changed Expand file tree Collapse file tree 2 files changed +45
-16
lines changed Original file line number Diff line number Diff line change @@ -138,22 +138,22 @@ make run
138138
139139## ⌨️ Key Bindings
140140
141- | Key | Action |
142- | ---| ---|
143- | / | Toggle search bar |
144- | ↑/↓ | Navigate servers |
145- | Enter | SSH into selected server |
146- | c | Copy SSH command to clipboard |
147- | g | Ping selected server |
148- | r | Refresh background data |
149- | a | Add server |
150- | e | Edit server |
151- | t | Edit tags |
152- | d | Delete server |
153- | p | Pin/Unpin server |
154- | s | Toggle sort field |
155- | S | Reverse sort order |
156- | q | Quit |
141+ | Key | Action |
142+ | ----- | ----------------------------- |
143+ | / | Toggle search bar |
144+ | ↑↓/jk | Navigate servers |
145+ | Enter | SSH into selected server |
146+ | c | Copy SSH command to clipboard |
147+ | g | Ping selected server |
148+ | r | Refresh background data |
149+ | a | Add server |
150+ | e | Edit server |
151+ | t | Edit tags |
152+ | d | Delete server |
153+ | p | Pin/Unpin server |
154+ | s | Toggle sort field |
155+ | S | Reverse sort order |
156+ | q | Quit |
157157
158158Tip: The hint bar at the top of the list shows the most useful shortcuts.
159159
Original file line number Diff line number Diff line change @@ -72,6 +72,12 @@ func (t *tui) handleGlobalKeys(event *tcell.EventKey) *tcell.EventKey {
7272 case 't' :
7373 t .handleTagsEdit ()
7474 return nil
75+ case 'j' :
76+ t .handleNavigateDown ()
77+ return nil
78+ case 'k' :
79+ t .handleNavigateUp ()
80+ return nil
7581 }
7682
7783 if event .Key () == tcell .KeyEnter {
@@ -125,6 +131,29 @@ func (t *tui) handleTagsEdit() {
125131 }
126132}
127133
134+ func (t * tui ) handleNavigateDown () {
135+ if t .app .GetFocus () == t .serverList {
136+ currentIdx := t .serverList .GetCurrentItem ()
137+ itemCount := t .serverList .GetItemCount ()
138+ if currentIdx < itemCount - 1 {
139+ t .serverList .SetCurrentItem (currentIdx + 1 )
140+ } else {
141+ t .serverList .SetCurrentItem (0 )
142+ }
143+ }
144+ }
145+
146+ func (t * tui ) handleNavigateUp () {
147+ if t .app .GetFocus () == t .serverList {
148+ currentIdx := t .serverList .GetCurrentItem ()
149+ if currentIdx > 0 {
150+ t .serverList .SetCurrentItem (currentIdx - 1 )
151+ } else {
152+ t .serverList .SetCurrentItem (t .serverList .GetItemCount () - 1 )
153+ }
154+ }
155+ }
156+
128157func (t * tui ) handleSearchInput (query string ) {
129158 filtered , _ := t .serverService .ListServers (query )
130159 sortServersForUI (filtered , t .sortMode )
You can’t perform that action at this time.
0 commit comments