From f791125c021ef8126f3a60e92e17d9b4116284c4 Mon Sep 17 00:00:00 2001 From: Rob Watson Date: Wed, 9 Apr 2025 20:37:56 +0200 Subject: [PATCH] feat(ui): update key bindings --- internal/app/integration_test.go | 2 +- internal/terminal/terminal.go | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/internal/app/integration_test.go b/internal/app/integration_test.go index 5d449f7..851614e 100644 --- a/internal/app/integration_test.go +++ b/internal/app/integration_test.go @@ -189,7 +189,7 @@ func TestIntegration(t *testing.T) { ) printScreen(getContents, "After starting the destination streams") - sendKey(screen, tcell.KeyRune, 'r') + sendKey(screen, tcell.KeyDelete, ' ') sendKey(screen, tcell.KeyEnter, ' ') require.EventuallyWithT( diff --git a/internal/terminal/terminal.go b/internal/terminal/terminal.go index c93b5ac..6b900e4 100644 --- a/internal/terminal/terminal.go +++ b/internal/terminal/terminal.go @@ -172,12 +172,13 @@ func StartUI(ctx context.Context, params StartParams) (*UI, error) { aboutView.SetDirection(tview.FlexRow) aboutView.SetBorder(true) aboutView.SetTitle("Actions") - aboutView.AddItem(tview.NewTextView().SetText("[a] Add new destination"), 1, 0, false) - aboutView.AddItem(tview.NewTextView().SetText("[r] Remove destination"), 1, 0, false) - aboutView.AddItem(tview.NewTextView().SetText("[Space] Toggle destination"), 1, 0, false) - aboutView.AddItem(tview.NewTextView().SetText("[u] Copy source RTMP URL"), 1, 0, false) - aboutView.AddItem(tview.NewTextView().SetText("[c] Copy config file path"), 1, 0, false) - aboutView.AddItem(tview.NewTextView().SetText("[?] About"), 1, 0, false) + aboutView.AddItem(tview.NewTextView().SetDynamicColors(true).SetText("[grey]a[-] Add destination"), 1, 0, false) + aboutView.AddItem(tview.NewTextView().SetDynamicColors(true).SetText("[grey]Del[-] Remove destination"), 1, 0, false) + aboutView.AddItem(tview.NewTextView().SetDynamicColors(true).SetText("[grey]Space[-] Start/stop destination"), 1, 0, false) + aboutView.AddItem(tview.NewTextView().SetDynamicColors(true).SetText(""), 1, 0, false) + aboutView.AddItem(tview.NewTextView().SetDynamicColors(true).SetText("[grey]u[-] Copy source RTMP URL"), 1, 0, false) + aboutView.AddItem(tview.NewTextView().SetDynamicColors(true).SetText("[grey]c[-] Copy config file path"), 1, 0, false) + aboutView.AddItem(tview.NewTextView().SetDynamicColors(true).SetText("[grey]?[-] About"), 1, 0, false) sidebar.AddItem(aboutView, 0, 1, false) @@ -298,9 +299,6 @@ func (ui *UI) handleInputCapture(event *tcell.EventKey) *tcell.EventKey { case 'a', 'A': ui.addDestination() return nil - case 'r', 'R': - ui.removeDestination() - return nil case ' ': ui.toggleDestination() case 'u', 'U': @@ -310,6 +308,9 @@ func (ui *UI) handleInputCapture(event *tcell.EventKey) *tcell.EventKey { case '?': ui.showAbout() } + case tcell.KeyDelete, tcell.KeyBackspace, tcell.KeyBackspace2: + ui.removeDestination() + return nil case tcell.KeyUp: row, _ := ui.destView.GetSelection() if row == 1 {