summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzenyu <zenyu@tuta.io>2024-11-10 23:35:32 +0000
committerGitHub <noreply@github.com>2024-11-11 10:35:32 +1100
commit4fefcf7aac02535e651b3d29ec02f9fb72576b6d (patch)
tree4642213885f1c4a8673f547ad735ab2337f390e4
parent0b5749f0ef749c9ce357bb16f0b6750b2b925563 (diff)
Create key event expr with non-zero count (#1846)
-rw-r--r--ui.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/ui.go b/ui.go
index 3721a4b..51cd8f1 100644
--- a/ui.go
+++ b/ui.go
@@ -1347,12 +1347,13 @@ func (ui *ui) readNormalEvent(ev tcell.Event, nav *nav) expr {
}
expr := gOpts.keys[string(ui.keyAcc)]
- if e, ok := expr.(*callExpr); ok && count != 0 {
- expr = &callExpr{e.name, e.args, e.count}
- expr.(*callExpr).count = count
- } else if e, ok := expr.(*listExpr); ok && count != 0 {
- expr = &listExpr{e.exprs, e.count}
- expr.(*listExpr).count = count
+ if count != 0 {
+ switch e := expr.(type) {
+ case *callExpr:
+ expr = &callExpr{name: e.name, args: e.args, count: count}
+ case *listExpr:
+ expr = &listExpr{exprs: e.exprs, count: count}
+ }
}
ui.keyAcc = nil