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() {
112
112
fi
113
113
114
114
# 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=' '
116
124
117
125
for (( i= 0 ; i < "${# str} "; ++ i )) ; do
126
+ # Escape backslashes, semi-colons specially, then special ASCII chars below space (0x20).
118
127
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 # \
122
132
token=" \\\\ "
123
- elif [ " $byte " = " ; " ] ; then
133
+ elif (( val == 59 )) ; then # ;
124
134
token=" \\ x3b"
125
- elif (( $(builtin printf '% d' "'$byte ") < 31 )) ; then
126
- token=$( builtin printf ' \\x%02x' " '$byte " )
127
135
else
128
136
token=" $byte "
129
137
fi
130
138
131
139
out+=" $token "
132
140
done
133
141
134
- builtin printf ' %s\n' " ${ out} "
142
+ builtin printf ' %s\n' " $out "
135
143
}
136
144
137
145
# Send the IsWindows property if the environment looks like Windows
You can’t perform that action at this time.
0 commit comments