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.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/internal/tui/flamegraph/model.go b/internal/tui/flamegraph/model.go
index 2238ba0..a7b26f8 100644
--- a/internal/tui/flamegraph/model.go
+++ b/internal/tui/flamegraph/model.go
@@ -968,14 +968,18 @@ func keyMatchesDirection(keyName, plain string, ansiFinal byte) bool {
}
func isArrowEscapeSequence(value string, ansiFinal byte) bool {
- if len(value) < 3 || value[0] != '\x1b' {
+ body, ok := strings.CutPrefix(value, "\x1b")
+ if !ok || len(body) < 2 {
return false
}
- last := value[len(value)-1]
- if last != ansiFinal {
+ switch body[0] {
+ case '[':
+ return body[len(body)-1] == ansiFinal
+ case 'O':
+ return len(body) == 2 && body[1] == ansiFinal
+ default:
return false
}
- return value[1] == '[' || value[1] == 'O'
}
func (m Model) visibleRowOffset() int {