summaryrefslogtreecommitdiff
path: root/internal/tui
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-05 19:25:09 +0200
committerPaul Buetow <paul@buetow.org>2026-03-05 19:25:09 +0200
commitc3adb86fda302eeb90c2b07e56aae5abaea469ce (patch)
tree6a50addcf57519bc53d28be5981b1d9456649adb /internal/tui
parentbab716a6a5931c211fad2f17ee2f67e8d182a7fc (diff)
refactor(tui): migrate source key handling to KeyPressMsg
Diffstat (limited to 'internal/tui')
-rw-r--r--internal/tui/dashboard/model.go6
-rw-r--r--internal/tui/eventstream/exportmodal.go2
-rw-r--r--internal/tui/eventstream/filtermodal.go2
-rw-r--r--internal/tui/eventstream/model.go12
-rw-r--r--internal/tui/eventstream/searchmodal.go2
-rw-r--r--internal/tui/export/model.go2
-rw-r--r--internal/tui/pidpicker/model.go4
-rw-r--r--internal/tui/probes/model.go4
-rw-r--r--internal/tui/tui.go6
9 files changed, 20 insertions, 20 deletions
diff --git a/internal/tui/dashboard/model.go b/internal/tui/dashboard/model.go
index 39150e8..ac61982 100644
--- a/internal/tui/dashboard/model.go
+++ b/internal/tui/dashboard/model.go
@@ -103,7 +103,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.processesOffset = clampOffset(m.processesOffset, m.maxProcessesRows())
m.streamModel.Refresh()
return m, nil
- case tea.KeyMsg:
+ case tea.KeyPressMsg:
return m.handleKey(msg)
case streamEditorDoneMsg:
if msg.err != nil {
@@ -114,7 +114,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return m, nil
}
-func (m Model) handleKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
+func (m Model) handleKey(msg tea.KeyPressMsg) (tea.Model, tea.Cmd) {
prevActiveTab := m.activeTab
var cmd tea.Cmd
keyStr := msg.String()
@@ -182,7 +182,7 @@ func (m Model) handleKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
return m, cmd
}
-func (m *Model) handleScrollKey(msg tea.KeyMsg) (bool, tea.Cmd) {
+func (m *Model) handleScrollKey(msg tea.KeyPressMsg) (bool, tea.Cmd) {
keyStr := msg.String()
switch m.activeTab {
case TabSyscalls:
diff --git a/internal/tui/eventstream/exportmodal.go b/internal/tui/eventstream/exportmodal.go
index 70c57ee..ec35343 100644
--- a/internal/tui/eventstream/exportmodal.go
+++ b/internal/tui/eventstream/exportmodal.go
@@ -47,7 +47,7 @@ func (m ExportModal) Update(msg tea.Msg) (ExportModal, string, bool) {
if !m.visible {
return m, "", false
}
- if keyMsg, ok := msg.(tea.KeyMsg); ok {
+ if keyMsg, ok := msg.(tea.KeyPressMsg); ok {
switch keyMsg.String() {
case "esc":
return m.Close(), "", false
diff --git a/internal/tui/eventstream/filtermodal.go b/internal/tui/eventstream/filtermodal.go
index 4090925..6c7653e 100644
--- a/internal/tui/eventstream/filtermodal.go
+++ b/internal/tui/eventstream/filtermodal.go
@@ -86,7 +86,7 @@ func (m FilterModal) Update(msg tea.Msg) FilterModal {
return m
}
- if keyMsg, ok := msg.(tea.KeyMsg); ok {
+ if keyMsg, ok := msg.(tea.KeyPressMsg); ok {
switch keyMsg.String() {
case "esc":
if m.editing {
diff --git a/internal/tui/eventstream/model.go b/internal/tui/eventstream/model.go
index cb05e47..af7f67d 100644
--- a/internal/tui/eventstream/model.go
+++ b/internal/tui/eventstream/model.go
@@ -353,8 +353,8 @@ func (m *Model) HandleKey(keyStr string) bool {
// HandleTeaKey handles stream keys based on Bubble Tea key message types first,
// then falls back to string matching for rune-driven shortcuts.
-func (m *Model) HandleTeaKey(msg tea.KeyMsg) bool {
- switch msg.Key().Code {
+func (m *Model) HandleTeaKey(msg tea.KeyPressMsg) bool {
+ switch msg.Code {
case tea.KeyLeft:
return m.HandleKey("left")
case tea.KeyRight:
@@ -374,10 +374,10 @@ func (m *Model) HandleTeaKey(msg tea.KeyMsg) bool {
case tea.KeyEnter:
return m.HandleKey("enter")
default:
- if msg.Key().Text != "" {
- runes := []rune(msg.Key().Text)
+ if msg.Text != "" {
+ runes := []rune(msg.Text)
if len(runes) == 1 {
- return m.HandleKey(msg.Key().Text)
+ return m.HandleKey(msg.Text)
}
}
}
@@ -810,7 +810,7 @@ func (m *Model) clampSelection() {
m.selectedIdx = clamp(m.selectedIdx, 0, len(m.filtered)-1)
}
-func keyMsgFromString(keyStr string) tea.KeyMsg {
+func keyMsgFromString(keyStr string) tea.KeyPressMsg {
switch keyStr {
case "esc":
return tea.KeyPressMsg{Code: tea.KeyEsc}
diff --git a/internal/tui/eventstream/searchmodal.go b/internal/tui/eventstream/searchmodal.go
index 94e9cd7..892b6d9 100644
--- a/internal/tui/eventstream/searchmodal.go
+++ b/internal/tui/eventstream/searchmodal.go
@@ -60,7 +60,7 @@ func (m SearchModal) Update(msg tea.Msg) (SearchModal, string, bool) {
if !m.visible {
return m, "", false
}
- if keyMsg, ok := msg.(tea.KeyMsg); ok {
+ if keyMsg, ok := msg.(tea.KeyPressMsg); ok {
switch keyMsg.String() {
case "esc":
return m.Close(), "", false
diff --git a/internal/tui/export/model.go b/internal/tui/export/model.go
index 9c77080..179754d 100644
--- a/internal/tui/export/model.go
+++ b/internal/tui/export/model.go
@@ -75,7 +75,7 @@ func (m Model) Close() Model {
// Update handles modal key navigation and export completion messages.
func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
switch msg := msg.(type) {
- case tea.KeyMsg:
+ case tea.KeyPressMsg:
if !m.visible {
return m, nil
}
diff --git a/internal/tui/pidpicker/model.go b/internal/tui/pidpicker/model.go
index fff7614..187be52 100644
--- a/internal/tui/pidpicker/model.go
+++ b/internal/tui/pidpicker/model.go
@@ -124,7 +124,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.lastErr = msg.err
m.applyFilter()
return m, nil
- case tea.KeyMsg:
+ case tea.KeyPressMsg:
return m.updateKey(msg)
}
@@ -134,7 +134,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return m, cmd
}
-func (m Model) updateKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
+func (m Model) updateKey(msg tea.KeyPressMsg) (tea.Model, tea.Cmd) {
switch {
case key.Matches(msg, m.keys.Esc):
return m, tea.Quit
diff --git a/internal/tui/probes/model.go b/internal/tui/probes/model.go
index c50c696..c4512f9 100644
--- a/internal/tui/probes/model.go
+++ b/internal/tui/probes/model.go
@@ -87,7 +87,7 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
}
m.clampCursor()
return m, nil
- case tea.KeyMsg:
+ case tea.KeyPressMsg:
if m.searching {
return m.updateSearch(msg)
}
@@ -125,7 +125,7 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
return m, nil
}
-func (m Model) updateSearch(msg tea.KeyMsg) (Model, tea.Cmd) {
+func (m Model) updateSearch(msg tea.KeyPressMsg) (Model, tea.Cmd) {
switch msg.String() {
case "esc":
m.searching = false
diff --git a/internal/tui/tui.go b/internal/tui/tui.go
index 24a8ba5..6c08c2f 100644
--- a/internal/tui/tui.go
+++ b/internal/tui/tui.go
@@ -246,7 +246,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.width = msg.Width
m.height = msg.Height
return m.updateActiveModel(msg)
- case tea.KeyMsg:
+ case tea.KeyPressMsg:
if key.Matches(msg, m.keys.Quit) {
m.quitting = true
m.stopTrace()
@@ -307,7 +307,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
if m.probeModal.Visible() {
var dashboardCmd tea.Cmd
// Keep dashboard refresh/data flow alive while probe modal is open.
- if _, isKey := msg.(tea.KeyMsg); !isKey && m.screen == ScreenDashboard {
+ if _, isKey := msg.(tea.KeyPressMsg); !isKey && m.screen == ScreenDashboard {
next, cmd := m.dashboard.Update(msg)
m.dashboard = next.(dashboardui.Model)
dashboardCmd = cmd
@@ -319,7 +319,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
if m.exporter.Visible() {
var dashboardCmd tea.Cmd
// Keep dashboard refresh/data flow alive while export modal is open.
- if _, isKey := msg.(tea.KeyMsg); !isKey && m.screen == ScreenDashboard {
+ if _, isKey := msg.(tea.KeyPressMsg); !isKey && m.screen == ScreenDashboard {
next, cmd := m.dashboard.Update(msg)
m.dashboard = next.(dashboardui.Model)
dashboardCmd = cmd