aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-11-17 08:59:12 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-11-17 08:59:12 +0000
commitce544776ab41d19ade9d1689079471029da76ac1 (patch)
tree26a4ebd8b22e8504deaf9f9c272e59267e79a287
parentterm: restore_cursor: restore lcf flag (diff)
term: move charset variables into an anonymous struct
-rw-r--r--terminal.c10
-rw-r--r--terminal.h7
-rw-r--r--vt.c20
3 files changed, 23 insertions, 14 deletions
diff --git a/terminal.c b/terminal.c
index f50a2065..82a72747 100644
--- a/terminal.c
+++ b/terminal.c
@@ -823,11 +823,11 @@ term_reset(struct terminal *term, bool hard)
term->focus_events = false;
term->mouse_tracking = MOUSE_NONE;
term->mouse_reporting = MOUSE_NORMAL;
- term->selected_charset = 0;
- term->charset[0] = CHARSET_ASCII;
- term->charset[1] = CHARSET_ASCII;
- term->charset[2] = CHARSET_ASCII;
- term->charset[3] = CHARSET_ASCII;
+ term->charsets.selected = 0;
+ term->charsets.set[0] = CHARSET_ASCII;
+ term->charsets.set[1] = CHARSET_ASCII;
+ term->charsets.set[2] = CHARSET_ASCII;
+ term->charsets.set[3] = CHARSET_ASCII;
tll_free_and_free(term->window_title_stack, free);
free(term->window_title);
term->window_title = strdup("foot");
diff --git a/terminal.h b/terminal.h
index 0d231cbf..18c12ac0 100644
--- a/terminal.h
+++ b/terminal.h
@@ -178,8 +178,11 @@ struct terminal {
enum mouse_tracking mouse_tracking;
enum mouse_reporting mouse_reporting;
- int selected_charset;
- enum charset charset[4]; /* G0-G3 */
+ struct {
+ int selected;
+ enum charset set[4]; /* G0-G3 */
+ } charsets;
+
char *window_title;
tll(char *) window_title_stack;
diff --git a/vt.c b/vt.c
index 6aca18ce..6fcaea2e 100644
--- a/vt.c
+++ b/vt.c
@@ -597,11 +597,17 @@ esc_dispatch(struct terminal *term, uint8_t final)
case '7':
term->saved_cursor = term->cursor;
term->vt.saved_attrs = term->vt.attrs;
+ //term->saved_charset = term->selected_charset;
+ //for (size_t i = 0; i < 4; i++)
+ // term->saved_charsets[i] = term->charset[i];
break;
case '8':
term_restore_cursor(term);
term->vt.attrs = term->vt.saved_attrs;
+ //term->selected_charset = term->saved_charset;
+ //for (size_t i = 0; i < 4; i++)
+ // term->charset[i] = term->saved_charsets[i];
break;
case 'c':
@@ -634,12 +640,12 @@ esc_dispatch(struct terminal *term, uint8_t final)
case 'N':
/* SS2 - Single Shift 2 */
- term->selected_charset = 2; /* G2 */
+ term->charsets.selected = 2; /* G2 */
break;
case 'O':
/* SS3 - Single Shift 3 */
- term->selected_charset = 3; /* G3 */
+ term->charsets.selected = 3; /* G3 */
break;
case '\\':
@@ -673,7 +679,7 @@ esc_dispatch(struct terminal *term, uint8_t final)
'*' ? 2 :
'+' ? 3 : -1;
assert(idx != -1);
- term->charset[idx] = CHARSET_GRAPHIC;
+ term->charsets.set[idx] = CHARSET_GRAPHIC;
break;
}
@@ -685,7 +691,7 @@ esc_dispatch(struct terminal *term, uint8_t final)
'*' ? 2 :
'+' ? 3 : -1;
assert(idx != -1);
- term->charset[idx] = CHARSET_ASCII;
+ term->charsets.set[idx] = CHARSET_ASCII;
break;
}
@@ -814,7 +820,7 @@ action_print(struct terminal *term, uint8_t c)
L'│', L'≤', L'≥', L'π', L'≠', L'£', L'·', /* x - ~ */
};
- if (unlikely(term->charset[term->selected_charset] == CHARSET_GRAPHIC) &&
+ if (unlikely(term->charsets.set[term->charsets.selected] == CHARSET_GRAPHIC) &&
c >= 0x60 && c <= 0x7e)
{
cell->wc = vt100_0[c - 0x60];
@@ -884,12 +890,12 @@ action(struct terminal *term, enum action _action, uint8_t c)
case '\x0e':
/* SO - shift out */
- term->selected_charset = 1; /* G1 */
+ term->charsets.selected = 1; /* G1 */
break;
case '\x0f':
/* SI - shift in */
- term->selected_charset = 0; /* G0 */
+ term->charsets.selected = 0; /* G0 */
break;
default: