From f8bcff18d6f5ae6ce38766169980efd1fc9621fd Mon Sep 17 00:00:00 2001 From: Sunny Tiwari Date: Wed, 19 Jul 2023 16:37:50 +0530 Subject: [PATCH 1/2] Fix #403: Clear logs --- pkg/gui/keybindings.go | 7 +++++++ pkg/gui/main_panel.go | 9 +++++++++ pkg/i18n/english.go | 2 ++ 3 files changed, 18 insertions(+) diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index 424f47c56..e9e025ee5 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -449,6 +449,13 @@ func (gui *Gui) GetInitialKeybindings() []*Binding { Modifier: gocui.ModNone, Handler: gui.scrollRightMain, }, + { + ViewName: "main", + Key: gocui.KeyCtrlL, + Modifier: gocui.ModNone, + Handler: wrappedHandler(gui.handleClearMain), + Description: gui.Tr.ClearMain, + }, { ViewName: "main", Key: 'h', diff --git a/pkg/gui/main_panel.go b/pkg/gui/main_panel.go index 004147be5..f94b35409 100644 --- a/pkg/gui/main_panel.go +++ b/pkg/gui/main_panel.go @@ -111,3 +111,12 @@ func (gui *Gui) handleMainClick() error { return gui.switchFocus(gui.Views.Main) } + +func (gui *Gui) handleClearMain() error { + if gui.popupPanelFocused() { + return nil + } + + gui.clearMainView() + return nil +} diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index b21b471fe..63421c93c 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -126,6 +126,7 @@ type TranslationSet struct { LcNextScreenMode string LcPrevScreenMode string + ClearMain string FilterPrompt string } @@ -260,6 +261,7 @@ func englishSet() TranslationSet { LcNextScreenMode: "next screen mode (normal/half/fullscreen)", LcPrevScreenMode: "prev screen mode", + ClearMain: "clear main panel", FilterPrompt: "filter", } } From 2b0539b85fbf0470309a0fbcbe50a97c9b407161 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20P=C3=89AU?= Date: Sun, 16 Jun 2024 23:47:15 +0200 Subject: [PATCH 2/2] add keybinds to clear services view & container view --- pkg/gui/keybindings.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index e9e025ee5..4be2eee35 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -32,6 +32,8 @@ func (b *Binding) GetKey() string { switch key { case 27: return "esc" + case 12: + return "Ctrl+L" case 13: return "enter" case 32: @@ -185,6 +187,13 @@ func (gui *Gui) GetInitialKeybindings() []*Binding { Modifier: gocui.ModNone, Handler: gui.handleDonate, }, + { + ViewName: "containers", + Key: gocui.KeyCtrlL, + Modifier: gocui.ModNone, + Handler: wrappedHandler(gui.handleClearMain), + Description: gui.Tr.ClearMain, + }, { ViewName: "containers", Key: 'd', @@ -262,6 +271,13 @@ func (gui *Gui) GetInitialKeybindings() []*Binding { Handler: gui.handleContainersOpenInBrowserCommand, Description: gui.Tr.OpenInBrowser, }, + { + ViewName: "services", + Key: gocui.KeyCtrlL, + Modifier: gocui.ModNone, + Handler: wrappedHandler(gui.handleClearMain), + Description: gui.Tr.ClearMain, + }, { ViewName: "services", Key: 'u',