Skip to content

Commit 328ab7d

Browse files
author
Tim Middleton
committed
ESC key can also be used to exit panel view
1 parent 3483f80 commit 328ab7d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkg/cmd/monitor_cluster.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
const (
2525
defaultLayoutName = "default"
2626
pressAdditional = "(press key in [] or mouse to toggle expand, ? = help)"
27-
pressAdditionalReset = "(press key in [] or mouse to exit expand)"
27+
pressAdditionalReset = "(press key in [] or mouse/ESC to exit expand)"
2828
noContent = " No Content"
2929
errorContent = "Unable to retrieve data"
3030
unableToFindPanel = "unable to find panel [%v], use --help or --show-panels to see all options"
@@ -282,7 +282,7 @@ Use --show-panels to show all available panels.`,
282282
case *tcell.EventKey:
283283
pressedKey := ev.Rune()
284284
// Exit for 'q', ESC, or CTRL-C
285-
if ev.Key() == tcell.KeyESC || ev.Key() == tcell.KeyCtrlC {
285+
if (ev.Key() == tcell.KeyESC && expandedPanel == "") || ev.Key() == tcell.KeyCtrlC {
286286
close(exit)
287287
return nil
288288
}
@@ -311,7 +311,7 @@ Use --show-panels to show all available panels.`,
311311
if err := refresh(screen, dataFetcher, parsedLayout, false); err != nil {
312312
panic(err)
313313
}
314-
} else if (pressedKey >= '1' && pressedKey <= '9' && pressedKey <= lastPanelCode) ||
314+
} else if ((pressedKey >= '1' && pressedKey <= '9' && pressedKey <= lastPanelCode) || ev.Key() == tcell.KeyESC) ||
315315
(pressedKey >= 'a' && pressedKey <= 'z' && pressedKey <= lastPanelCode) {
316316
updateExpanded(pressedKey, screen, dataFetcher, parsedLayout)
317317
}

0 commit comments

Comments
 (0)