summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2022-12-27 19:54:46 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2022-12-27 19:54:46 +0900
commit4b3f0b9f083ffff69b432b4d01eaab11d2cf58b9 (patch)
treec74604cadc902f6121e2e583d25c09d777f803cb /src
parent12af069dcad672b1563388c61ec33ba8a86c013e (diff)
Allow put action with an argument i.e. put(...)
Diffstat (limited to 'src')
-rw-r--r--src/options.go4
-rw-r--r--src/terminal.go6
2 files changed, 9 insertions, 1 deletions
diff --git a/src/options.go b/src/options.go
index 91ac9881..f25b6e73 100644
--- a/src/options.go
+++ b/src/options.go
@@ -890,7 +890,7 @@ const (
func init() {
executeRegexp = regexp.MustCompile(
- `(?si)[:+](execute(?:-multi|-silent)?|reload|preview|change-query|change-prompt|change-preview-window|change-preview|(?:re|un)bind|pos)`)
+ `(?si)[:+](execute(?:-multi|-silent)?|reload|preview|change-query|change-prompt|change-preview-window|change-preview|(?:re|un)bind|pos|put)`)
splitRegexp = regexp.MustCompile("[,:]+")
actionNameRegexp = regexp.MustCompile("(?i)^[a-z-]+")
}
@@ -1205,6 +1205,8 @@ func isExecuteAction(str string) actionType {
return actExecuteSilent
case "execute-multi":
return actExecuteMulti
+ case "put":
+ return actPut
}
return actIgnore
}
diff --git a/src/terminal.go b/src/terminal.go
index 90239f7b..552daa23 100644
--- a/src/terminal.go
+++ b/src/terminal.go
@@ -321,6 +321,7 @@ const (
actPreviewHalfPageDown
actPrevHistory
actPrevSelected
+ actPut
actNextHistory
actNextSelected
actExecute
@@ -2848,6 +2849,11 @@ func (t *Terminal) Loop() {
t.vset(n)
req(reqList)
}
+ case actPut:
+ str := []rune(a.a)
+ suffix := copySlice(t.input[t.cx:])
+ t.input = append(append(t.input[:t.cx], str...), suffix...)
+ t.cx += len(str)
case actUnixLineDiscard:
beof = len(t.input) == 0
if t.cx > 0 {