mirror of
https://github.com/anotherhadi/spilltea.git
synced 2026-05-20 17:52:33 +02:00
e8e64eff12
Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
31 lines
777 B
Go
31 lines
777 B
Go
package keys
|
|
|
|
import (
|
|
"charm.land/bubbles/v2/key"
|
|
"github.com/anotherhadi/spilltea/internal/config"
|
|
)
|
|
|
|
type ReplayKeyMap struct {
|
|
Send key.Binding
|
|
Edit key.Binding
|
|
EditExt key.Binding
|
|
UndoEdits key.Binding
|
|
Delete key.Binding
|
|
DeleteAll key.Binding
|
|
}
|
|
|
|
func newReplayKeyMap(cfg config.ReplayKeys) ReplayKeyMap {
|
|
return ReplayKeyMap{
|
|
Send: binding(cfg.Send, "send"),
|
|
Edit: binding(cfg.Edit, "edit"),
|
|
EditExt: binding(cfg.EditExt, "edit in $EDITOR"),
|
|
UndoEdits: binding(cfg.UndoEdits, "undo edits"),
|
|
Delete: binding(cfg.Delete, "delete"),
|
|
DeleteAll: binding(cfg.DeleteAll, "delete all"),
|
|
}
|
|
}
|
|
|
|
func (r ReplayKeyMap) Bindings() []key.Binding {
|
|
return []key.Binding{r.Send, r.Edit, r.EditExt, r.UndoEdits, r.Delete, r.DeleteAll}
|
|
}
|