diff options
| author | Roberto E. Vargas Caballero <k0ga@shike2.com> | 2014-04-29 08:58:10 +0200 |
|---|---|---|
| committer | Roberto E. Vargas Caballero <k0ga@shike2.com> | 2014-04-29 15:17:51 +0200 |
| commit | 1629363f2d009a0c0d61209e4126ff09fa0e11a4 (patch) | |
| tree | eebdbe5a5b31ddbf02f0b3ebf935e245806979b1 | |
| parent | 6b315558f8095b91988d5b305ed06e082da48889 (diff) | |
| download | st-1629363f2d009a0c0d61209e4126ff09fa0e11a4.tar.gz st-1629363f2d009a0c0d61209e4126ff09fa0e11a4.zip | |
Remove ATTR_GFX and tselcs
ATTR_GFX was used long time ago to detect when terminal was in
graphic mode. Today graphic mode is implemented using a charset
pointer, so ATTR_GFX is not needed anymore because graphic
condition can be detected directly checking if current charset
is GRAPHICS C0.
| -rw-r--r-- | st.c | 30 |
1 files changed, 8 insertions, 22 deletions
| @@ -94,12 +94,11 @@ enum glyph_attribute { | |||
| 94 | ATTR_REVERSE = 1, | 94 | ATTR_REVERSE = 1, |
| 95 | ATTR_UNDERLINE = 2, | 95 | ATTR_UNDERLINE = 2, |
| 96 | ATTR_BOLD = 4, | 96 | ATTR_BOLD = 4, |
| 97 | ATTR_GFX = 8, | 97 | ATTR_ITALIC = 8, |
| 98 | ATTR_ITALIC = 16, | 98 | ATTR_BLINK = 16, |
| 99 | ATTR_BLINK = 32, | 99 | ATTR_WRAP = 32, |
| 100 | ATTR_WRAP = 64, | 100 | ATTR_WIDE = 64, |
| 101 | ATTR_WIDE = 128, | 101 | ATTR_WDUMMY = 128, |
| 102 | ATTR_WDUMMY = 256, | ||
| 103 | }; | 102 | }; |
| 104 | 103 | ||
| 105 | enum cursor_movement { | 104 | enum cursor_movement { |
| @@ -396,7 +395,6 @@ static void techo(char *, int); | |||
| 396 | static bool tcontrolcode(uchar ); | 395 | static bool tcontrolcode(uchar ); |
| 397 | static void tdectest(char ); | 396 | static void tdectest(char ); |
| 398 | static int32_t tdefcolor(int *, int *, int); | 397 | static int32_t tdefcolor(int *, int *, int); |
| 399 | static void tselcs(void); | ||
| 400 | static void tdeftran(char); | 398 | static void tdeftran(char); |
| 401 | static inline bool match(uint, uint); | 399 | static inline bool match(uint, uint); |
| 402 | static void ttynew(void); | 400 | static void ttynew(void); |
| @@ -1535,7 +1533,7 @@ tsetchar(char *c, Glyph *attr, int x, int y) { | |||
| 1535 | /* | 1533 | /* |
| 1536 | * The table is proudly stolen from rxvt. | 1534 | * The table is proudly stolen from rxvt. |
| 1537 | */ | 1535 | */ |
| 1538 | if(attr->mode & ATTR_GFX) { | 1536 | if(term.trantbl[term.charset] == CS_GRAPHIC0) { |
| 1539 | if(BETWEEN(c[0], 0x41, 0x7e) && vt100_0[c[0] - 0x41]) { | 1537 | if(BETWEEN(c[0], 0x41, 0x7e) && vt100_0[c[0] - 0x41]) { |
| 1540 | c = vt100_0[c[0] - 0x41]; | 1538 | c = vt100_0[c[0] - 0x41]; |
| 1541 | } | 1539 | } |
| @@ -2317,9 +2315,7 @@ void | |||
| 2317 | tdeftran(char ascii) { | 2315 | tdeftran(char ascii) { |
| 2318 | char c, (*bp)[2]; | 2316 | char c, (*bp)[2]; |
| 2319 | static char tbl[][2] = { | 2317 | static char tbl[][2] = { |
| 2320 | {'0', CS_GRAPHIC0}, {'1', CS_GRAPHIC1}, {'A', CS_UK}, | 2318 | {'0', CS_GRAPHIC0}, {'B', CS_USA}, |
| 2321 | {'B', CS_USA}, {'<', CS_MULTI}, {'K', CS_GER}, | ||
| 2322 | {'5', CS_FIN}, {'C', CS_FIN}, | ||
| 2323 | {0, 0} | 2319 | {0, 0} |
| 2324 | }; | 2320 | }; |
| 2325 | 2321 | ||
| @@ -2332,13 +2328,6 @@ tdeftran(char ascii) { | |||
| 2332 | term.trantbl[term.icharset] = (*bp)[1]; | 2328 | term.trantbl[term.icharset] = (*bp)[1]; |
| 2333 | } | 2329 | } |
| 2334 | 2330 | ||
| 2335 | void | ||
| 2336 | tselcs(void) { | ||
| 2337 | MODBIT(term.c.attr.mode, | ||
| 2338 | term.trantbl[term.charset] == CS_GRAPHIC0, | ||
| 2339 | ATTR_GFX); | ||
| 2340 | } | ||
| 2341 | |||
| 2342 | bool | 2331 | bool |
| 2343 | tcontrolcode(uchar ascii) { | 2332 | tcontrolcode(uchar ascii) { |
| 2344 | static char question[UTF_SIZ] = "?"; | 2333 | static char question[UTF_SIZ] = "?"; |
| @@ -2377,11 +2366,9 @@ tcontrolcode(uchar ascii) { | |||
| 2377 | return 1; | 2366 | return 1; |
| 2378 | case '\016': /* SO */ | 2367 | case '\016': /* SO */ |
| 2379 | term.charset = 0; | 2368 | term.charset = 0; |
| 2380 | tselcs(); | ||
| 2381 | break; | 2369 | break; |
| 2382 | case '\017': /* SI */ | 2370 | case '\017': /* SI */ |
| 2383 | term.charset = 1; | 2371 | term.charset = 1; |
| 2384 | tselcs(); | ||
| 2385 | break; | 2372 | break; |
| 2386 | case '\032': /* SUB */ | 2373 | case '\032': /* SUB */ |
| 2387 | tsetchar(question, &term.c.attr, term.c.x, term.c.y); | 2374 | tsetchar(question, &term.c.attr, term.c.x, term.c.y); |
| @@ -2506,7 +2493,6 @@ tputc(char *c, int len) { | |||
| 2506 | return; | 2493 | return; |
| 2507 | } else if(term.esc & ESC_ALTCHARSET) { | 2494 | } else if(term.esc & ESC_ALTCHARSET) { |
| 2508 | tdeftran(ascii); | 2495 | tdeftran(ascii); |
| 2509 | tselcs(); | ||
| 2510 | } else if(term.esc & ESC_TEST) { | 2496 | } else if(term.esc & ESC_TEST) { |
| 2511 | tdectest(ascii); | 2497 | tdectest(ascii); |
| 2512 | } else { | 2498 | } else { |
| @@ -2593,7 +2579,7 @@ tputc(char *c, int len) { | |||
| 2593 | /* | 2579 | /* |
| 2594 | * Display control codes only if we are in graphic mode | 2580 | * Display control codes only if we are in graphic mode |
| 2595 | */ | 2581 | */ |
| 2596 | if(control && !(term.c.attr.mode & ATTR_GFX)) | 2582 | if(control && term.trantbl[term.charset] != CS_GRAPHIC0) |
| 2597 | return; | 2583 | return; |
| 2598 | if(sel.ob.x != -1 && BETWEEN(term.c.y, sel.ob.y, sel.oe.y)) | 2584 | if(sel.ob.x != -1 && BETWEEN(term.c.y, sel.ob.y, sel.oe.y)) |
| 2599 | selclear(NULL); | 2585 | selclear(NULL); |
