diff options
| author | Berke Güzel <wenekar1@gmail.com> | 2026-10-14 17:17:43 +0300 |
|---|---|---|
| committer | Berke Güzel <wenekar1@gmail.com> | 2026-10-14 17:17:43 +0300 |
| commit | 513bf031a589d9e2a1a2730adf56f95e5e316a06 (patch) | |
| tree | 66ef6b095e6aa00c790ac37705fb9df3b099b92a /src/text.c | |
| parent | 234dd752dc2e15afab38cbbf78f8aa32be72ea5f (diff) | |
Remove unused private functions and inline trivial helpers
Diffstat (limited to 'src/text.c')
| -rw-r--r-- | src/text.c | 34 |
1 files changed, 14 insertions, 20 deletions
@@ -12,17 +12,6 @@ #include <stdio.h> #include <string.h> -static void dispatch_c1_control(struct term *t, uint32_t cp) -{ - static const char c1_map[32] = { - [4] = 'D', [5] = 'E', [8] = 'H', [13] = 'M', - [16] = 'P', [27] = '[', [28] = '\\', [29] = ']' }; - char ch = c1_map[cp - 0x80]; - if (!ch) return; - t->state = ST_ESC; - term_escape_byte(t, (unsigned char)ch); -} - static inline void emit_codepoint(struct term *t, uint32_t cp, int klass, uint16_t flags) { static const uint32_t dec_graphics[] = { @@ -32,7 +21,15 @@ static inline void emit_codepoint(struct term *t, uint32_t cp, int klass, uint16 0x23bb,0x2500,0x23bc,0x23bd,0x251c,0x2524,0x2534,0x252c, 0x2502,0x2264,0x2265,0x03c0,0x2260,0x00a3,0x00b7 }; if (cp >= 0x80 && cp <= 0x9f) { - dispatch_c1_control(t, cp); + static const char c1_map[32] = { + [4] = 'D', [5] = 'E', [8] = 'H', [13] = 'M', + [16] = 'P', [27] = '[', [28] = '\\', [29] = ']', + }; + char ch = c1_map[cp - 0x80]; + if (ch) { + t->state = ST_ESC; + term_escape_byte(t, (unsigned char)ch); + } return; } if (t->graphics && cp >= '_' && cp <= '~') { @@ -78,7 +75,10 @@ void term_text_ground(struct term *t, unsigned char ch) } else if (ch == '\r') { sc_cr(t); } else if (ch == '\b') { - sc_bs(t); + t->pending_wrap = false; + if (t->cursor_x > 0) + t->cursor_x--; + term_row(t, t->cursor_y)->version++; } else if (ch == '\t') { term_sc_tab(t, 1); } else if (ch == 0x07) { @@ -105,12 +105,6 @@ void term_text_ground(struct term *t, unsigned char ch) } } -static inline int decode_ground_utf8(struct term *t, const char *buf, size_t len, - uint32_t *cp) -{ - return utf8_decode_ground(&t->utf8_state, &t->utf8_codep, buf, len, cp); -} - static inline bool can_stream_bottom(const struct term *t) { return t->state == ST_GROUND && !t->graphics && !t->insert_mode && t->autowrap && @@ -294,7 +288,7 @@ static void term_feed_inner(struct term *t, const char *buf, size_t len, unsigne continue; } uint32_t cp; - int cp_len = decode_ground_utf8(t, buf + i, len - i, &cp); + int cp_len = utf8_decode_ground(&t->utf8_state, &t->utf8_codep, buf + i, len - i, &cp); if (cp) emit_decoded(t, cp, cur_flags); i += (size_t)(cp_len - 1); |
