Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions tests/main.zunit
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
load "../fast-highlight"
setopt interactive_comments
-fast-highlight-fill-option-variables
# Chromas are autoloaded functions; the plugin file does this at startup.
fpath+=( "$PWD" )
autoload -Uz -- '→chroma/-ssh.ch'
}

@test 'ls /usr/bin' {
Expand Down Expand Up @@ -121,4 +124,25 @@ reply=()
assert "$reply[9]" same_as ""
}

@test 'ssh -R 5037:localhost:5037 devbox' {
reply=()
PREBUFFER=""
BUFFER="ssh -R 5037:localhost:5037 devbox"
evl -fast-highlight-process "$PREBUFFER" "$BUFFER" 0

# -R takes an argument, so the forward spec is not the hostname and its
# trailing :5037 is not a port passed to a hostspec.
assert "${FAST_HIGHLIGHT[chroma-ssh-message]}" same_as ""
}

@test 'ssh devbox:22' {
reply=()
PREBUFFER=""
BUFFER="ssh devbox:22"
evl -fast-highlight-process "$PREBUFFER" "$BUFFER" 0

# A port really passed in the hostspec is still reported.
assert "${FAST_HIGHLIGHT[chroma-ssh-message]}" same_as "Format of hostname incorrect, use -p to pass port number"
}

# vim:ft=zsh:sw=4:sts=4:et
2 changes: 1 addition & 1 deletion →chroma/-ssh.ch
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ local -a match mbegin mend completions_users completions_host
# Detected option, add style for it.
[[ "$__wrd" = --* ]] && __style=${FAST_THEME_NAME}double-hyphen-option || \
__style=${FAST_THEME_NAME}single-hyphen-option
if [[ "$__wrd" = (-b|-c|-D|-E|-e|-F|-I|-i|-J|-L|-l|-m|-O|-o|-p|Q|R|-S|-W|-w) ]]; then
if [[ "$__wrd" = (-b|-c|-D|-E|-e|-F|-I|-i|-J|-L|-l|-m|-O|-o|-p|-Q|-R|-S|-W|-w) ]]; then
FAST_HIGHLIGHT[chroma-ssh-skip-two]=1
fi
else
Expand Down