summaryrefslogtreecommitdiff
path: root/internal/tui/flamegraph/model.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/tui/flamegraph/model.go')
-rw-r--r--internal/tui/flamegraph/model.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/internal/tui/flamegraph/model.go b/internal/tui/flamegraph/model.go
index 5f5a83c..5d101c2 100644
--- a/internal/tui/flamegraph/model.go
+++ b/internal/tui/flamegraph/model.go
@@ -208,6 +208,34 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return m, nil
}
+// ConsumesKey reports whether the flamegraph should handle a key press before
+// dashboard- or app-level shortcuts.
+func (m Model) ConsumesKey(msg tea.KeyPressMsg) bool {
+ if m.searchActive {
+ return true
+ }
+ switch {
+ case msg.String() == "/",
+ msg.String() == "n",
+ msg.String() == "N",
+ msg.String() == "p",
+ msg.String() == "r",
+ msg.String() == "o",
+ msg.String() == "?":
+ return true
+ case key.Matches(msg, m.keys.ZoomIn),
+ key.Matches(msg, m.keys.ZoomUndo),
+ key.Matches(msg, m.keys.ZoomReset),
+ key.Matches(msg, m.keys.MoveShallower),
+ key.Matches(msg, m.keys.MoveDeeper),
+ key.Matches(msg, m.keys.PrevSibling),
+ key.Matches(msg, m.keys.NextSibling):
+ return true
+ default:
+ return false
+ }
+}
+
// View renders the flamegraph viewport.
func (m Model) View() tea.View {
content := RenderTerminalView(m.frames, m.width, m.height, m.selectedIdx, m.subtreeSet, m.matchIndices, m.isDark, m.searchActive, m.searchQuery)