Xinqi Bao's Git
projects
/
st.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
End a sequence only on CAN, SUB, \a and C1s.
[st.git]
/
st.c
diff --git
a/st.c
b/st.c
index
3ed77e1
..
fd872c1
100644
(file)
--- a/
st.c
+++ b/
st.c
@@
-392,7
+392,7
@@
static void tsetdirtattr(int);
static void tsetmode(bool, bool, int *, int);
static void tfulldirt(void);
static void techo(char *, int);
static void tsetmode(bool, bool, int *, int);
static void tfulldirt(void);
static void techo(char *, int);
-static
bool
tcontrolcode(uchar );
+static
void
tcontrolcode(uchar );
static void tdectest(char );
static int32_t tdefcolor(int *, int *, int);
static void tdeftran(char);
static void tdectest(char );
static int32_t tdefcolor(int *, int *, int);
static void tdeftran(char);
@@
-1837,7
+1837,7
@@
tsetmode(bool priv, bool set, int *args, int narg) {
if (!allowaltscreen)
break;
tcursor((set) ? CURSOR_SAVE : CURSOR_LOAD);
if (!allowaltscreen)
break;
tcursor((set) ? CURSOR_SAVE : CURSOR_LOAD);
- /* FALLTHR
U
*/
+ /* FALLTHR
OUGH
*/
case 47: /* swap screen */
case 1047:
if (!allowaltscreen)
case 47: /* swap screen */
case 1047:
if (!allowaltscreen)
@@
-1851,7
+1851,7
@@
tsetmode(bool priv, bool set, int *args, int narg) {
tswapscreen();
if(*args != 1049)
break;
tswapscreen();
if(*args != 1049)
break;
- /* FALLT
RU
*/
+ /* FALLT
HROUGH
*/
case 1048:
tcursor((set) ? CURSOR_SAVE : CURSOR_LOAD);
break;
case 1048:
tcursor((set) ? CURSOR_SAVE : CURSOR_LOAD);
break;
@@
-2146,7
+2146,7
@@
strhandle(void) {
if(narg < 3)
break;
p = strescseq.args[2];
if(narg < 3)
break;
p = strescseq.args[2];
- /*
fall through
*/
+ /*
FALLTHROUGH
*/
case 104: /* color reset, here p = NULL */
j = (narg > 1) ? atoi(strescseq.args[1]) : -1;
if (!xsetcolorname(j, p)) {
case 104: /* color reset, here p = NULL */
j = (narg > 1) ? atoi(strescseq.args[1]) : -1;
if (!xsetcolorname(j, p)) {
@@
-2328,26
+2328,26
@@
tdeftran(char ascii) {
term.trantbl[term.icharset] = (*bp)[1];
}
term.trantbl[term.icharset] = (*bp)[1];
}
-bool
+void
tcontrolcode(uchar ascii) {
static char question[UTF_SIZ] = "?";
switch(ascii) {
case '\t': /* HT */
tputtab(1);
tcontrolcode(uchar ascii) {
static char question[UTF_SIZ] = "?";
switch(ascii) {
case '\t': /* HT */
tputtab(1);
-
break
;
+
return
;
case '\b': /* BS */
tmoveto(term.c.x-1, term.c.y);
case '\b': /* BS */
tmoveto(term.c.x-1, term.c.y);
-
break
;
+
return
;
case '\r': /* CR */
tmoveto(0, term.c.y);
case '\r': /* CR */
tmoveto(0, term.c.y);
-
break
;
+
return
;
case '\f': /* LF */
case '\v': /* VT */
case '\n': /* LF */
/* go to first col if the mode is set */
tnewline(IS_SET(MODE_CRLF));
case '\f': /* LF */
case '\v': /* VT */
case '\n': /* LF */
/* go to first col if the mode is set */
tnewline(IS_SET(MODE_CRLF));
-
break
;
+
return
;
case '\a': /* BEL */
if(term.esc & ESC_STR_END) {
/* backwards compatibility to xterm */
case '\a': /* BEL */
if(term.esc & ESC_STR_END) {
/* backwards compatibility to xterm */
@@
-2363,13
+2363,13
@@
tcontrolcode(uchar ascii) {
csireset();
term.esc &= ~(ESC_CSI|ESC_ALTCHARSET|ESC_TEST);
term.esc |= ESC_START;
csireset();
term.esc &= ~(ESC_CSI|ESC_ALTCHARSET|ESC_TEST);
term.esc |= ESC_START;
- return
1
;
+ return;
case '\016': /* SO */
term.charset = 0;
case '\016': /* SO */
term.charset = 0;
-
break
;
+
return
;
case '\017': /* SI */
term.charset = 1;
case '\017': /* SI */
term.charset = 1;
-
break
;
+
return
;
case '\032': /* SUB */
tsetchar(question, &term.c.attr, term.c.x, term.c.y);
case '\030': /* CAN */
case '\032': /* SUB */
tsetchar(question, &term.c.attr, term.c.x, term.c.y);
case '\030': /* CAN */
@@
-2380,6
+2380,7
@@
tcontrolcode(uchar ascii) {
case '\021': /* XON (IGNORED) */
case '\023': /* XOFF (IGNORED) */
case 0177: /* DEL (IGNORED) */
case '\021': /* XON (IGNORED) */
case '\023': /* XOFF (IGNORED) */
case 0177: /* DEL (IGNORED) */
+ return;
case 0x84: /* TODO: IND */
case 0x85: /* TODO: NEL */
case 0x88: /* TODO: HTS */
case 0x84: /* TODO: IND */
case 0x85: /* TODO: NEL */
case 0x88: /* TODO: HTS */
@@
-2395,11
+2396,10
@@
tcontrolcode(uchar ascii) {
case 0x9e: /* TODO: PM */
case 0x9f: /* TODO: APC */
break;
case 0x9e: /* TODO: PM */
case 0x9f: /* TODO: APC */
break;
- default:
- return 0;
}
}
+ /* only CAN, SUB, \a and C1 chars interrupt a sequence */
term.esc &= ~(ESC_STR_END|ESC_STR);
term.esc &= ~(ESC_STR_END|ESC_STR);
- return
1
;
+ return;
}
void
}
void
@@
-2448,7
+2448,7
@@
tputc(char *c, int len) {
(ascii == '\a' || ascii == 030 ||
ascii == 032 || ascii == 033 ||
ISCONTROLC1(unicodep))) {
(ascii == '\a' || ascii == 030 ||
ascii == 032 || ascii == 033 ||
ISCONTROLC1(unicodep))) {
- term.esc &= ~
ESC_STR
;
+ term.esc &= ~
(ESC_START|ESC_STR)
;
term.esc |= ESC_STR_END;
} else if(strescseq.len + len < sizeof(strescseq.buf) - 1) {
memmove(&strescseq.buf[strescseq.len], c, len);
term.esc |= ESC_STR_END;
} else if(strescseq.len + len < sizeof(strescseq.buf) - 1) {
memmove(&strescseq.buf[strescseq.len], c, len);
@@
-2478,8
+2478,11
@@
tputc(char *c, int len) {
* they must not cause conflicts with sequences.
*/
if(control) {
* they must not cause conflicts with sequences.
*/
if(control) {
- if (tcontrolcode(ascii))
- return;
+ tcontrolcode(ascii);
+ /*
+ * control codes are not shown ever
+ */
+ return;
} else if(term.esc & ESC_START) {
if(term.esc & ESC_CSI) {
csiescseq.buf[csiescseq.len++] = ascii;
} else if(term.esc & ESC_START) {
if(term.esc & ESC_CSI) {
csiescseq.buf[csiescseq.len++] = ascii;
@@
-2576,11
+2579,6
@@
tputc(char *c, int len) {
*/
return;
}
*/
return;
}
- /*
- * Display control codes only if we are in graphic mode
- */
- if(control && term.trantbl[term.charset] != CS_GRAPHIC0)
- return;
if(sel.ob.x != -1 && BETWEEN(term.c.y, sel.ob.y, sel.oe.y))
selclear(NULL);
if(sel.ob.x != -1 && BETWEEN(term.c.y, sel.ob.y, sel.oe.y))
selclear(NULL);