diff options
| author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2020-06-17 22:05:48 +0200 |
|---|---|---|
| committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2020-06-17 23:49:22 +0200 |
| commit | f74a9df6e1fc88eebe6d673d888b61fd83cf6fc4 (patch) | |
| tree | e73f68351de87490934a184934b0e896850783e8 /st.c | |
| parent | fix unicode glitch in DCS strings, patch by Tim Allen (diff) | |
| download | st-f74a9df6e1fc88eebe6d673d888b61fd83cf6fc4.tar.gz st-f74a9df6e1fc88eebe6d673d888b61fd83cf6fc4.zip | |
remove sixel stub code
Remove stub code that was used for an experiment of adding sixel code to st
from the commit f7398434.
Diffstat (limited to 'st.c')
| -rw-r--r-- | st.c | 26 |
1 files changed, 5 insertions, 21 deletions
| @@ -51,7 +51,6 @@ enum term_mode { | |||
| 51 | MODE_ECHO = 1 << 4, | 51 | MODE_ECHO = 1 << 4, |
| 52 | MODE_PRINT = 1 << 5, | 52 | MODE_PRINT = 1 << 5, |
| 53 | MODE_UTF8 = 1 << 6, | 53 | MODE_UTF8 = 1 << 6, |
| 54 | MODE_SIXEL = 1 << 7, | ||
| 55 | }; | 54 | }; |
| 56 | 55 | ||
| 57 | enum cursor_movement { | 56 | enum cursor_movement { |
| @@ -78,12 +77,11 @@ enum charset { | |||
| 78 | enum escape_state { | 77 | enum escape_state { |
| 79 | ESC_START = 1, | 78 | ESC_START = 1, |
| 80 | ESC_CSI = 2, | 79 | ESC_CSI = 2, |
| 81 | ESC_STR = 4, /* OSC, PM, APC */ | 80 | ESC_STR = 4, /* DCS, OSC, PM, APC */ |
| 82 | ESC_ALTCHARSET = 8, | 81 | ESC_ALTCHARSET = 8, |
| 83 | ESC_STR_END = 16, /* a final string was encountered */ | 82 | ESC_STR_END = 16, /* a final string was encountered */ |
| 84 | ESC_TEST = 32, /* Enter in test mode */ | 83 | ESC_TEST = 32, /* Enter in test mode */ |
| 85 | ESC_UTF8 = 64, | 84 | ESC_UTF8 = 64, |
| 86 | ESC_DCS =128, | ||
| 87 | }; | 85 | }; |
| 88 | 86 | ||
| 89 | typedef struct { | 87 | typedef struct { |
| @@ -2090,12 +2088,9 @@ tdectest(char c) | |||
| 2090 | void | 2088 | void |
| 2091 | tstrsequence(uchar c) | 2089 | tstrsequence(uchar c) |
| 2092 | { | 2090 | { |
| 2093 | strreset(); | ||
| 2094 | |||
| 2095 | switch (c) { | 2091 | switch (c) { |
| 2096 | case 0x90: /* DCS -- Device Control String */ | 2092 | case 0x90: /* DCS -- Device Control String */ |
| 2097 | c = 'P'; | 2093 | c = 'P'; |
| 2098 | term.esc |= ESC_DCS; | ||
| 2099 | break; | 2094 | break; |
| 2100 | case 0x9f: /* APC -- Application Program Command */ | 2095 | case 0x9f: /* APC -- Application Program Command */ |
| 2101 | c = '_'; | 2096 | c = '_'; |
| @@ -2107,6 +2102,7 @@ tstrsequence(uchar c) | |||
| 2107 | c = ']'; | 2102 | c = ']'; |
| 2108 | break; | 2103 | break; |
| 2109 | } | 2104 | } |
| 2105 | strreset(); | ||
| 2110 | strescseq.type = c; | 2106 | strescseq.type = c; |
| 2111 | term.esc |= ESC_STR; | 2107 | term.esc |= ESC_STR; |
| 2112 | } | 2108 | } |
| @@ -2304,7 +2300,7 @@ tputc(Rune u) | |||
| 2304 | Glyph *gp; | 2300 | Glyph *gp; |
| 2305 | 2301 | ||
| 2306 | control = ISCONTROL(u); | 2302 | control = ISCONTROL(u); |
| 2307 | if (u < 127 || !IS_SET(MODE_UTF8 | MODE_SIXEL)) { | 2303 | if (u < 127 || !IS_SET(MODE_UTF8)) { |
| 2308 | c[0] = u; | 2304 | c[0] = u; |
| 2309 | width = len = 1; | 2305 | width = len = 1; |
| 2310 | } else { | 2306 | } else { |
| @@ -2325,23 +2321,11 @@ tputc(Rune u) | |||
| 2325 | if (term.esc & ESC_STR) { | 2321 | if (term.esc & ESC_STR) { |
| 2326 | if (u == '\a' || u == 030 || u == 032 || u == 033 || | 2322 | if (u == '\a' || u == 030 || u == 032 || u == 033 || |
| 2327 | ISCONTROLC1(u)) { | 2323 | ISCONTROLC1(u)) { |
| 2328 | term.esc &= ~(ESC_START|ESC_STR|ESC_DCS); | 2324 | term.esc &= ~(ESC_START|ESC_STR); |
| 2329 | if (IS_SET(MODE_SIXEL)) { | ||
| 2330 | /* TODO: render sixel */; | ||
| 2331 | term.mode &= ~MODE_SIXEL; | ||
| 2332 | return; | ||
| 2333 | } | ||
| 2334 | term.esc |= ESC_STR_END; | 2325 | term.esc |= ESC_STR_END; |
| 2335 | goto check_control_code; | 2326 | goto check_control_code; |
| 2336 | } | 2327 | } |
| 2337 | 2328 | ||
| 2338 | if (IS_SET(MODE_SIXEL)) { | ||
| 2339 | /* TODO: implement sixel mode */ | ||
| 2340 | return; | ||
| 2341 | } | ||
| 2342 | if (term.esc&ESC_DCS && strescseq.len == 0 && u == 'q') | ||
| 2343 | term.mode |= MODE_SIXEL; | ||
| 2344 | |||
| 2345 | if (strescseq.len+len >= strescseq.siz) { | 2329 | if (strescseq.len+len >= strescseq.siz) { |
| 2346 | /* | 2330 | /* |
| 2347 | * Here is a bug in terminals. If the user never sends | 2331 | * Here is a bug in terminals. If the user never sends |
| @@ -2453,7 +2437,7 @@ twrite(const char *buf, int buflen, int show_ctrl) | |||
| 2453 | int n; | 2437 | int n; |
| 2454 | 2438 | ||
| 2455 | for (n = 0; n < buflen; n += charsize) { | 2439 | for (n = 0; n < buflen; n += charsize) { |
| 2456 | if (IS_SET(MODE_UTF8) && !IS_SET(MODE_SIXEL)) { | 2440 | if (IS_SET(MODE_UTF8)) { |
| 2457 | /* process a complete utf8 char */ | 2441 | /* process a complete utf8 char */ |
| 2458 | charsize = utf8decode(buf + n, &u, buflen - n); | 2442 | charsize = utf8decode(buf + n, &u, buflen - n); |
| 2459 | if (charsize == 0) | 2443 | if (charsize == 0) |
