Add 'change-multi' action

Close #3754
This commit is contained in:
Junegunn Choi
2024-04-27 17:38:06 +09:00
parent 7f85beccb5
commit 608232568b
6 changed files with 142 additions and 94 deletions

View File

@@ -367,6 +367,7 @@ const (
actCancel
actChangeBorderLabel
actChangeHeader
actChangeMulti
actChangePreviewLabel
actChangePrompt
actChangeQuery
@@ -3489,6 +3490,19 @@ func (t *Terminal) Loop() {
}
case actPrintQuery:
req(reqPrintQuery)
case actChangeMulti:
multi := t.multi
if a.a == "" {
multi = maxMulti
} else if n, e := strconv.Atoi(a.a); e == nil && n >= 0 {
multi = n
}
if t.multi > 0 && multi != t.multi {
t.selected = make(map[int32]selectedItem)
t.version++
}
t.multi = multi
req(reqList, reqInfo)
case actChangeQuery:
t.input = []rune(a.a)
t.cx = len(t.input)