Skip to content

Commit

Permalink
Handle dashes at the beginning of commands
Browse files Browse the repository at this point in the history
  • Loading branch information
ericfreese committed Feb 18, 2017
1 parent 48a21bf commit c9a51e0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions spec/special_characters_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,10 @@
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
2 changes: 1 addition & 1 deletion spec/terminal_session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def run_command(command)
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
Expand Down
2 changes: 1 addition & 1 deletion src/async.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion zsh-autosuggestions.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit c9a51e0

Please sign in to comment.