Xinqi Bao's Git
projects
/
st.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
Do not eat ESC character if control string is not properly terminated.
[st.git]
/
st.c
diff --git
a/st.c
b/st.c
index
297eb3f
..
d2261e2
100644
(file)
--- a/
st.c
+++ b/
st.c
@@
-2298,7
+2298,7
@@
techo(char *buf, int len) {
for(; len > 0; buf++, len--) {
char c = *buf;
for(; len > 0; buf++, len--) {
char c = *buf;
- if(
c < 0x20 || c == 0177
) { /* control code */
+ if(
BETWEEN(c, 0x00, 0x1f) || c == 0x7f
) { /* control code */
if(c != '\n' && c != '\r' && c != '\t') {
c ^= '\x40';
tputc("^", 1);
if(c != '\n' && c != '\r' && c != '\t') {
c ^= '\x40';
tputc("^", 1);
@@
-2452,10
+2452,6
@@
tputc(char *c, int len) {
csiparse();
csihandle();
}
csiparse();
csihandle();
}
- } else if(term.esc & ESC_STR_END) {
- term.esc = 0;
- if(ascii == '\\')
- strhandle();
} else if(term.esc & ESC_ALTCHARSET) {
tdeftran(ascii);
tselcs();
} else if(term.esc & ESC_ALTCHARSET) {
tdeftran(ascii);
tselcs();
@@
-2545,7
+2541,9
@@
tputc(char *c, int len) {
tcursor(CURSOR_LOAD);
term.esc = 0;
break;
tcursor(CURSOR_LOAD);
term.esc = 0;
break;
- case '\\': /* ST -- Stop */
+ case '\\': /* ST -- String Terminator */
+ if(term.esc & ESC_STR_END)
+ strhandle();
term.esc = 0;
break;
default:
term.esc = 0;
break;
default: