From c9a51e0c4c604ba7406a4d1ac9fd9164090a3776 Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Sat, 18 Feb 2017 16:51:53 -0700 Subject: [PATCH] Handle dashes at the beginning of commands --- spec/special_characters_spec.rb | 5 +++++ spec/terminal_session.rb | 2 +- src/async.zsh | 2 +- zsh-autosuggestions.zsh | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/spec/special_characters_spec.rb b/spec/special_characters_spec.rb index 21f681b..ce7810b 100644 --- a/spec/special_characters_spec.rb +++ b/spec/special_characters_spec.rb @@ -51,5 +51,10 @@ describe 'a special character in the buffer' do session.send_string('echo "^A') wait_for { session.content }.to eq('echo "^A"') end + + with_history('-foo() {}') do + session.send_string('-') + wait_for { session.content }.to eq('-foo() {}') + end end end diff --git a/spec/terminal_session.rb b/spec/terminal_session.rb index a089d27..8cbbac0 100644 --- a/spec/terminal_session.rb +++ b/spec/terminal_session.rb @@ -26,7 +26,7 @@ class TerminalSession end def send_string(str) - tmux_command("send-keys -t 0 -l '#{str.gsub("'", "\\'")}'") + tmux_command("send-keys -t 0 -l -- '#{str.gsub("'", "\\'")}'") self end diff --git a/src/async.zsh b/src/async.zsh index 3c3cf84..124c9ac 100644 --- a/src/async.zsh +++ b/src/async.zsh @@ -55,7 +55,7 @@ _zsh_autosuggest_async_response() { local suggestion zpty -rt $ZSH_AUTOSUGGEST_ASYNC_PTY_NAME suggestion '*'$'\0' 2>/dev/null - zle autosuggest-suggest "${suggestion%%$'\0'##}" + zle autosuggest-suggest -- "${suggestion%%$'\0'##}" } _zsh_autosuggest_async_pty_create() { diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index 0a33006..34ca080 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -550,7 +550,7 @@ _zsh_autosuggest_async_response() { local suggestion zpty -rt $ZSH_AUTOSUGGEST_ASYNC_PTY_NAME suggestion '*'$'\0' 2>/dev/null - zle autosuggest-suggest "${suggestion%%$'\0'##}" + zle autosuggest-suggest -- "${suggestion%%$'\0'##}" } _zsh_autosuggest_async_pty_create() {