mirror of
https://github.com/junegunn/fzf.git
synced 2026-01-10 05:22:39 +08:00
Allow put action with an argument i.e. put(...)
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user