File tree Expand file tree Collapse file tree 1 file changed +16
-8
lines changed
src/vs/workbench/contrib/terminal/browser/media Expand file tree Collapse file tree 1 file changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -112,26 +112,34 @@ __vsc_escape_value() {
112112 fi
113113
114114 # Process text byte by byte, not by codepoint.
115- builtin local LC_ALL=C str=" ${1} " i byte token out=' '
115+ local -r LC_ALL=C
116+ local -r str=" ${1} "
117+ local -ir len=" ${# str} "
118+
119+ local -i i
120+ local -i val
121+ local byte
122+ local token
123+ local out=' '
116124
117125 for (( i= 0 ; i < "${# str} "; ++ i )) ; do
126+ # Escape backslashes, semi-colons specially, then special ASCII chars below space (0x20).
118127 byte=" ${str: $i : 1} "
119-
120- # Escape backslashes, semi-colons specially, then special ASCII chars below space (0x20)
121- if [ " $byte " = " \\ " ]; then
128+ builtin printf -v val ' %d' " '$byte "
129+ if (( val < 31 )) ; then
130+ builtin printf -v token ' \\x%02x' " '$byte "
131+ elif (( val == 92 )) ; then # \
122132 token=" \\\\ "
123- elif [ " $byte " = " ; " ] ; then
133+ elif (( val == 59 )) ; then # ;
124134 token=" \\ x3b"
125- elif (( $(builtin printf '% d' "'$byte ") < 31 )) ; then
126- token=$( builtin printf ' \\x%02x' " '$byte " )
127135 else
128136 token=" $byte "
129137 fi
130138
131139 out+=" $token "
132140 done
133141
134- builtin printf ' %s\n' " ${ out} "
142+ builtin printf ' %s\n' " $out "
135143}
136144
137145# Send the IsWindows property if the environment looks like Windows
You can’t perform that action at this time.
0 commit comments