diff options
Diffstat (limited to 'internal/tmuxedit/agentutil.go')
| -rw-r--r-- | internal/tmuxedit/agentutil.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/internal/tmuxedit/agentutil.go b/internal/tmuxedit/agentutil.go index 0f4f38e..bf1a723 100644 --- a/internal/tmuxedit/agentutil.go +++ b/internal/tmuxedit/agentutil.go @@ -11,6 +11,8 @@ import ( "time" ) +const escapeKeyDelay = 150 * time.Millisecond + // promptMatch holds a regex match result with its line number in the pane. type promptMatch struct { lineNum int @@ -124,12 +126,20 @@ func (d tmuxEditDeps) sendClearSequence(paneID, clearKeys string) error { } // Add delay after Escape to let Vim-based agents exit INSERT mode if key == "Escape" { - time.Sleep(150 * time.Millisecond) + d.sleepEscape() } } return nil } +func (d tmuxEditDeps) sleepEscape() { + if d.sleepAfterEscape != nil { + d.sleepAfterEscape() + return + } + time.Sleep(escapeKeyDelay) +} + // parseKeyRepeat splits "Key*N" into (Key, N). Returns (token, 1) if no // repeat suffix is present or the suffix is invalid. func parseKeyRepeat(token string) (string, int) { |
