X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=st.c;h=fe446088e9baff397524f61600eea1eecb7ebe47;hb=99fb365aa30e6d9f8fa035f4d2adbc3145fafb00;hp=c50a20295df23d9174dcb4f252b4a8622053f5ee;hpb=6b315558f8095b91988d5b305ed06e082da48889;p=st.git diff --git a/st.c b/st.c index c50a202..fe44608 100644 --- a/st.c +++ b/st.c @@ -94,12 +94,11 @@ enum glyph_attribute { ATTR_REVERSE = 1, ATTR_UNDERLINE = 2, ATTR_BOLD = 4, - ATTR_GFX = 8, - ATTR_ITALIC = 16, - ATTR_BLINK = 32, - ATTR_WRAP = 64, - ATTR_WIDE = 128, - ATTR_WDUMMY = 256, + ATTR_ITALIC = 8, + ATTR_BLINK = 16, + ATTR_WRAP = 32, + ATTR_WIDE = 64, + ATTR_WDUMMY = 128, }; enum cursor_movement { @@ -393,10 +392,9 @@ static void tsetdirtattr(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 tselcs(void); static void tdeftran(char); static inline bool match(uint, uint); static void ttynew(void); @@ -1535,7 +1533,7 @@ tsetchar(char *c, Glyph *attr, int x, int y) { /* * The table is proudly stolen from rxvt. */ - if(attr->mode & ATTR_GFX) { + if(term.trantbl[term.charset] == CS_GRAPHIC0) { if(BETWEEN(c[0], 0x41, 0x7e) && vt100_0[c[0] - 0x41]) { c = vt100_0[c[0] - 0x41]; } @@ -1839,7 +1837,7 @@ tsetmode(bool priv, bool set, int *args, int narg) { if (!allowaltscreen) break; tcursor((set) ? CURSOR_SAVE : CURSOR_LOAD); - /* FALLTHRU */ + /* FALLTHROUGH */ case 47: /* swap screen */ case 1047: if (!allowaltscreen) @@ -1853,7 +1851,7 @@ tsetmode(bool priv, bool set, int *args, int narg) { tswapscreen(); if(*args != 1049) break; - /* FALLTRU */ + /* FALLTHROUGH */ case 1048: tcursor((set) ? CURSOR_SAVE : CURSOR_LOAD); break; @@ -2148,7 +2146,7 @@ strhandle(void) { 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)) { @@ -2317,9 +2315,7 @@ void tdeftran(char ascii) { char c, (*bp)[2]; static char tbl[][2] = { - {'0', CS_GRAPHIC0}, {'1', CS_GRAPHIC1}, {'A', CS_UK}, - {'B', CS_USA}, {'<', CS_MULTI}, {'K', CS_GER}, - {'5', CS_FIN}, {'C', CS_FIN}, + {'0', CS_GRAPHIC0}, {'B', CS_USA}, {0, 0} }; @@ -2333,13 +2329,6 @@ tdeftran(char ascii) { } void -tselcs(void) { - MODBIT(term.c.attr.mode, - term.trantbl[term.charset] == CS_GRAPHIC0, - ATTR_GFX); -} - -bool tcontrolcode(uchar ascii) { static char question[UTF_SIZ] = "?"; @@ -2374,14 +2363,12 @@ tcontrolcode(uchar ascii) { csireset(); term.esc &= ~(ESC_CSI|ESC_ALTCHARSET|ESC_TEST); term.esc |= ESC_START; - return 1; + return; case '\016': /* SO */ term.charset = 0; - tselcs(); break; case '\017': /* SI */ term.charset = 1; - tselcs(); break; case '\032': /* SUB */ tsetchar(question, &term.c.attr, term.c.x, term.c.y); @@ -2408,11 +2395,9 @@ tcontrolcode(uchar ascii) { case 0x9e: /* TODO: PM */ case 0x9f: /* TODO: APC */ break; - default: - return 0; } term.esc &= ~(ESC_STR_END|ESC_STR); - return 1; + return; } void @@ -2491,8 +2476,11 @@ tputc(char *c, int len) { * 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; @@ -2506,7 +2494,6 @@ tputc(char *c, int len) { return; } else if(term.esc & ESC_ALTCHARSET) { tdeftran(ascii); - tselcs(); } else if(term.esc & ESC_TEST) { tdectest(ascii); } else { @@ -2590,11 +2577,6 @@ tputc(char *c, int len) { */ return; } - /* - * Display control codes only if we are in graphic mode - */ - if(control && !(term.c.attr.mode & ATTR_GFX)) - return; if(sel.ob.x != -1 && BETWEEN(term.c.y, sel.ob.y, sel.oe.y)) selclear(NULL);