|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From 3ae49a8fdb7d21c065fcf2b1f7459a32f963c087 Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From: David Herrmann <dh.herrmann@gmail.com>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Date: Sun, 5 Oct 2014 14:53:18 +0200
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Subject: [PATCH] terminal/screen: save state in separate object
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Terminal state can be saved/restored by applications. To simplify our
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
internal handling, put all affected state into a separate object.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Especially with alternate screen buffers, this will simplify our code
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
significantly.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
src/libsystemd-terminal/term-internal.h | 41 ++--
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
src/libsystemd-terminal/term-screen.c | 326 +++++++++++++++-----------------
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
2 files changed, 175 insertions(+), 192 deletions(-)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
diff --git a/src/libsystemd-terminal/term-internal.h b/src/libsystemd-terminal/term-internal.h
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
index a023498b53..c78b9aa70a 100644
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
--- a/src/libsystemd-terminal/term-internal.h
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+++ b/src/libsystemd-terminal/term-internal.h
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -37,6 +37,7 @@ typedef struct term_page term_page;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
typedef struct term_history term_history;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
typedef uint32_t term_charset[96];
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+typedef struct term_state term_state;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
/*
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
* Miscellaneous
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -586,11 +587,9 @@ enum {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
TERM_FLAG_HIDE_CURSOR = (1U << 1), /* hide cursor caret (default: off) */
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
TERM_FLAG_INHIBIT_TPARM = (1U << 2), /* do not send TPARM unrequested (default: off) */
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
TERM_FLAG_NEWLINE_MODE = (1U << 3), /* perform carriage-return on line-feeds (default: off) */
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- TERM_FLAG_ORIGIN_MODE = (1U << 4), /* in origin mode, the cursor is bound by the margins (default: off) */
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- TERM_FLAG_PENDING_WRAP = (1U << 5), /* wrap-around is pending */
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- TERM_FLAG_AUTO_WRAP = (1U << 6), /* auto-wrap mode causes line-wraps at line-ends (default: off) */
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- TERM_FLAG_KEYPAD_MODE = (1U << 7), /* application-keypad mode (default: off) */
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- TERM_FLAG_CURSOR_KEYS = (1U << 8), /* enable application cursor-keys (default: off) */
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ TERM_FLAG_PENDING_WRAP = (1U << 4), /* wrap-around is pending */
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ TERM_FLAG_KEYPAD_MODE = (1U << 5), /* application-keypad mode (default: off) */
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ TERM_FLAG_CURSOR_KEYS = (1U << 6), /* enable application cursor-keys (default: off) */
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
};
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
enum {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -600,6 +599,19 @@ enum {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
TERM_CONFORMANCE_LEVEL_CNT,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
};
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+struct term_state {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ unsigned int cursor_x;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ unsigned int cursor_y;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ term_attr attr;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ term_charset **gl;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ term_charset **gr;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ term_charset **glt;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ term_charset **grt;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ bool auto_wrap : 1;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ bool origin_mode : 1;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+};
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
struct term_screen {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
unsigned long ref;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
term_age_t age;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -623,15 +635,8 @@ struct term_screen {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
unsigned int flags;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
unsigned int conformance_level;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- unsigned int cursor_x;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- unsigned int cursor_y;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- term_attr attr;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
term_attr default_attr;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- term_charset **gl;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- term_charset **gr;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- term_charset **glt;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- term_charset **grt;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
term_charset *g0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
term_charset *g1;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
term_charset *g2;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -639,14 +644,6 @@ struct term_screen {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
char *answerback;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- struct {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- unsigned int cursor_x;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- unsigned int cursor_y;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- term_attr attr;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- term_charset **gl;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- term_charset **gr;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- term_charset **glt;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- term_charset **grt;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- unsigned int flags;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- } saved;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ term_state state;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ term_state saved;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
};
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
diff --git a/src/libsystemd-terminal/term-screen.c b/src/libsystemd-terminal/term-screen.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
index 9026c25efe..c8a81658cb 100644
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
--- a/src/libsystemd-terminal/term-screen.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+++ b/src/libsystemd-terminal/term-screen.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -70,18 +70,13 @@ int term_screen_new(term_screen **out, term_screen_write_fn write_fn, void *writ
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen->cmd_fn_data = cmd_fn_data;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen->flags = TERM_FLAG_7BIT_MODE;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen->conformance_level = TERM_CONFORMANCE_LEVEL_VT400;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->gl = &screen->g0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->gr = &screen->g1;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen->g0 = &term_unicode_lower;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen->g1 = &term_unicode_upper;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen->g2 = &term_unicode_lower;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen->g3 = &term_unicode_upper;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
-
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->saved.cursor_x = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->saved.cursor_y = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->saved.attr = screen->attr;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->saved.gl = screen->gl;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->saved.gr = screen->gr;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.gl = &screen->g0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.gr = &screen->g1;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->saved = screen->state;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
r = term_page_new(&screen->page_main);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (r < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -224,7 +219,7 @@ static bool screen_tab_is_set(term_screen *screen, unsigned int pos) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
static inline void screen_age_cursor(term_screen *screen) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
term_cell *cell;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- cell = term_page_get_cell(screen->page, screen->cursor_x, screen->cursor_y);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ cell = term_page_get_cell(screen->page, screen->state.cursor_x, screen->state.cursor_y);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (cell)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
cell->age = screen->age;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -237,21 +232,21 @@ static void screen_cursor_set(term_screen *screen, unsigned int x, unsigned int
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
x = screen_clamp_x(screen, x);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
y = screen_clamp_y(screen, y);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- if (x == screen->cursor_x && y == screen->cursor_y)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ if (x == screen->state.cursor_x && y == screen->state.cursor_y)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (!(screen->flags & TERM_FLAG_HIDE_CURSOR))
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen_age_cursor(screen);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->cursor_x = x;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->cursor_y = y;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.cursor_x = x;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.cursor_y = y;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (!(screen->flags & TERM_FLAG_HIDE_CURSOR))
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen_age_cursor(screen);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
static void screen_cursor_set_rel(term_screen *screen, unsigned int x, unsigned int y) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- if (screen->flags & TERM_FLAG_ORIGIN_MODE) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ if (screen->state.origin_mode) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
x = screen_clamp_x(screen, x);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
y = screen_clamp_x(screen, y) + screen->page->scroll_idx;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -266,53 +261,53 @@ static void screen_cursor_set_rel(term_screen *screen, unsigned int x, unsigned
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
static void screen_cursor_left(term_screen *screen, unsigned int num) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- if (num > screen->cursor_x)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- num = screen->cursor_x;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ if (num > screen->state.cursor_x)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ num = screen->state.cursor_x;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen_cursor_set(screen, screen->cursor_x - num, screen->cursor_y);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen_cursor_set(screen, screen->state.cursor_x - num, screen->state.cursor_y);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
static void screen_cursor_left_tab(term_screen *screen, unsigned int num) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
unsigned int i;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- i = screen->cursor_x;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ i = screen->state.cursor_x;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
while (i > 0 && num > 0) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (screen_tab_is_set(screen, --i))
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
--num;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen_cursor_set(screen, i, screen->cursor_y);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen_cursor_set(screen, i, screen->state.cursor_y);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
static void screen_cursor_right(term_screen *screen, unsigned int num) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (num > screen->page->width)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
num = screen->page->width;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen_cursor_set(screen, screen->cursor_x + num, screen->cursor_y);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen_cursor_set(screen, screen->state.cursor_x + num, screen->state.cursor_y);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
static void screen_cursor_right_tab(term_screen *screen, unsigned int num) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
unsigned int i;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- i = screen->cursor_x;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ i = screen->state.cursor_x;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
while (i + 1 < screen->page->width && num > 0) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (screen_tab_is_set(screen, ++i))
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
--num;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen_cursor_set(screen, i, screen->cursor_y);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen_cursor_set(screen, i, screen->state.cursor_y);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
static void screen_cursor_up(term_screen *screen, unsigned int num, bool scroll) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
unsigned int max;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- if (screen->cursor_y < screen->page->scroll_idx) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- if (num > screen->cursor_y)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- num = screen->cursor_y;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ if (screen->state.cursor_y < screen->page->scroll_idx) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ if (num > screen->state.cursor_y)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ num = screen->state.cursor_y;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen_cursor_set(screen, screen->cursor_x, screen->cursor_y - num);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen_cursor_set(screen, screen->state.cursor_x, screen->state.cursor_y - num);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
} else {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- max = screen->cursor_y - screen->page->scroll_idx;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ max = screen->state.cursor_y - screen->page->scroll_idx;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (num > max) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (num < 1)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -321,14 +316,14 @@ static void screen_cursor_up(term_screen *screen, unsigned int num, bool scroll)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen_age_cursor(screen);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (scroll)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- term_page_scroll_down(screen->page, num - max, &screen->attr, screen->age, NULL);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ term_page_scroll_down(screen->page, num - max, &screen->state.attr, screen->age, NULL);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->cursor_y = screen->page->scroll_idx;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.cursor_y = screen->page->scroll_idx;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (!(screen->flags & TERM_FLAG_HIDE_CURSOR))
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen_age_cursor(screen);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
} else {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen_cursor_set(screen, screen->cursor_x, screen->cursor_y - num);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen_cursor_set(screen, screen->state.cursor_x, screen->state.cursor_y - num);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -336,13 +331,13 @@ static void screen_cursor_up(term_screen *screen, unsigned int num, bool scroll)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
static void screen_cursor_down(term_screen *screen, unsigned int num, bool scroll) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
unsigned int max;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- if (screen->cursor_y >= screen->page->scroll_idx + screen->page->scroll_num) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ if (screen->state.cursor_y >= screen->page->scroll_idx + screen->page->scroll_num) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (num > screen->page->height)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
num = screen->page->height;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen_cursor_set(screen, screen->cursor_x, screen->cursor_y - num);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen_cursor_set(screen, screen->state.cursor_x, screen->state.cursor_y - num);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
} else {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- max = screen->page->scroll_idx + screen->page->scroll_num - 1 - screen->cursor_y;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ max = screen->page->scroll_idx + screen->page->scroll_num - 1 - screen->state.cursor_y;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (num > max) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (num < 1)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -351,18 +346,27 @@ static void screen_cursor_down(term_screen *screen, unsigned int num, bool scrol
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen_age_cursor(screen);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (scroll)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- term_page_scroll_up(screen->page, num - max, &screen->attr, screen->age, screen->history);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ term_page_scroll_up(screen->page, num - max, &screen->state.attr, screen->age, screen->history);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->cursor_y = screen->page->scroll_idx + screen->page->scroll_num - 1;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.cursor_y = screen->page->scroll_idx + screen->page->scroll_num - 1;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (!(screen->flags & TERM_FLAG_HIDE_CURSOR))
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen_age_cursor(screen);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
} else {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen_cursor_set(screen, screen->cursor_x, screen->cursor_y + num);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen_cursor_set(screen, screen->state.cursor_x, screen->state.cursor_y + num);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+static void screen_save_state(term_screen *screen, term_state *where) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ *where = screen->state;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+static void screen_restore_state(term_screen *screen, term_state *from) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen_cursor_set(screen, from->cursor_x, from->cursor_y);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state = *from;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
static inline void set_reset(term_screen *screen, unsigned int flag, bool set) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (set)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen->flags |= flag;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -388,7 +392,7 @@ static void screen_mode_change(term_screen *screen, unsigned int mode, bool dec,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
* DECOM: origin-mode
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
* TODO
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
*/
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- set_reset(screen, TERM_FLAG_ORIGIN_MODE, set);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.origin_mode = set;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -398,7 +402,7 @@ static void screen_mode_change(term_screen *screen, unsigned int mode, bool dec,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
* DECAWN: auto-wrap mode
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
* TODO
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
*/
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- set_reset(screen, TERM_FLAG_AUTO_WRAP, set);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.auto_wrap = set;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -435,19 +439,19 @@ static uint32_t screen_map(term_screen *screen, uint32_t val) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
* identity. */
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
switch (val) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 33 ... 126:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- if (screen->glt) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- nval = (**screen->glt)[val - 32];
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->glt = NULL;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ if (screen->state.glt) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ nval = (**screen->state.glt)[val - 32];
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.glt = NULL;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
} else {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- nval = (**screen->gl)[val - 32];
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ nval = (**screen->state.gl)[val - 32];
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 160 ... 255:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- if (screen->grt) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- nval = (**screen->grt)[val - 160];
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->grt = NULL;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ if (screen->state.grt) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ nval = (**screen->state.grt)[val - 160];
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.grt = NULL;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
} else {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- nval = (**screen->gr)[val - 160];
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ nval = (**screen->state.gr)[val - 160];
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -471,20 +475,20 @@ static int screen_GRAPHIC(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
term_char_t ch = TERM_CHAR_NULL;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
uint32_t c;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- if (screen->cursor_x + 1 == screen->page->width
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ if (screen->state.cursor_x + 1 == screen->page->width
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
&& screen->flags & TERM_FLAG_PENDING_WRAP
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- && screen->flags & TERM_FLAG_AUTO_WRAP) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ && screen->state.auto_wrap) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen_cursor_down(screen, 1, true);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen_cursor_set(screen, 0, screen->cursor_y);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen_cursor_set(screen, 0, screen->state.cursor_y);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen_cursor_clear_wrap(screen);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
c = screen_map(screen, seq->terminator);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
ch = term_char_merge(ch, screen_map(screen, c));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- term_page_write(screen->page, screen->cursor_x, screen->cursor_y, ch, 1, &screen->attr, screen->age, false);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ term_page_write(screen->page, screen->state.cursor_x, screen->state.cursor_y, ch, 1, &screen->state.attr, screen->age, false);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- if (screen->cursor_x + 1 == screen->page->width)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ if (screen->state.cursor_x + 1 == screen->page->width)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen->flags |= TERM_FLAG_PENDING_WRAP;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
else
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen_cursor_right(screen, 1);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -556,7 +560,7 @@ static int screen_CHA(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
pos = seq->args[0];
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen_cursor_clear_wrap(screen);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen_cursor_set(screen, pos - 1, screen->cursor_y);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen_cursor_set(screen, pos - 1, screen->state.cursor_y);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -635,7 +639,7 @@ static int screen_CR(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
*/
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen_cursor_clear_wrap(screen);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen_cursor_set(screen, 0, screen->cursor_y);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen_cursor_set(screen, 0, screen->state.cursor_y);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -901,7 +905,7 @@ static int screen_DCH(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
num = seq->args[0];
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen_cursor_clear_wrap(screen);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- term_page_delete_cells(screen->page, screen->cursor_x, screen->cursor_y, num, &screen->attr, screen->age);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ term_page_delete_cells(screen->page, screen->state.cursor_x, screen->state.cursor_y, num, &screen->state.attr, screen->age);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -1254,14 +1258,7 @@ static int screen_DECRC(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
* state for the main display and the status line.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
*/
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->attr = screen->saved.attr;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->gl = screen->saved.gl;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->gr = screen->saved.gr;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->glt = screen->saved.glt;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->grt = screen->saved.grt;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- set_reset(screen, TERM_FLAG_AUTO_WRAP, screen->saved.flags & TERM_FLAG_AUTO_WRAP);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- set_reset(screen, TERM_FLAG_ORIGIN_MODE, screen->saved.flags & TERM_FLAG_ORIGIN_MODE);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen_cursor_set(screen, screen->saved.cursor_x, screen->saved.cursor_y);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen_restore_state(screen, &screen->saved);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -1468,15 +1465,7 @@ static int screen_DECSC(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
* * Any single shift 2 (SS2) or single shift 3 (SS3) functions sent
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
*/
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->saved.cursor_x = screen->cursor_x;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->saved.cursor_y = screen->cursor_y;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->saved.attr = screen->attr;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->saved.gl = screen->gl;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->saved.gr = screen->gr;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->saved.glt = screen->glt;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->saved.grt = screen->grt;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->saved.flags = screen->flags & (TERM_FLAG_AUTO_WRAP
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- | TERM_FLAG_ORIGIN_MODE);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen_save_state(screen, &screen->saved);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -1503,10 +1492,10 @@ static int screen_DECSCA(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
switch (mode) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 0:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 2:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->attr.protect = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.attr.protect = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 1:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->attr.protect = 1;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.attr.protect = 1;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -1671,21 +1660,21 @@ static int screen_DECSED(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
switch (mode) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 0:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
term_page_erase(screen->page,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->cursor_x, screen->cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.cursor_x, screen->state.cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen->page->width, screen->page->height,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- &screen->attr, screen->age, true);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ &screen->state.attr, screen->age, true);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 1:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
term_page_erase(screen->page,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
0, 0,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->cursor_x, screen->cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- &screen->attr, screen->age, true);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.cursor_x, screen->state.cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ &screen->state.attr, screen->age, true);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 2:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
term_page_erase(screen->page,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
0, 0,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen->page->width, screen->page->height,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- &screen->attr, screen->age, true);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ &screen->state.attr, screen->age, true);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -1717,21 +1706,21 @@ static int screen_DECSEL(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
switch (mode) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 0:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
term_page_erase(screen->page,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->cursor_x, screen->cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->page->width, screen->cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- &screen->attr, screen->age, true);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.cursor_x, screen->state.cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->page->width, screen->state.cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ &screen->state.attr, screen->age, true);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 1:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
term_page_erase(screen->page,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- 0, screen->cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->cursor_x, screen->cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- &screen->attr, screen->age, true);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ 0, screen->state.cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.cursor_x, screen->state.cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ &screen->state.attr, screen->age, true);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 2:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
term_page_erase(screen->page,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- 0, screen->cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->page->width, screen->cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- &screen->attr, screen->age, true);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ 0, screen->state.cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->page->width, screen->state.cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ &screen->state.attr, screen->age, true);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -2078,7 +2067,7 @@ static int screen_DL(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (seq->args[0] > 0)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
num = seq->args[0];
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- term_page_delete_lines(screen->page, screen->cursor_y, num, &screen->attr, screen->age);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ term_page_delete_lines(screen->page, screen->state.cursor_y, num, &screen->state.attr, screen->age);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -2123,9 +2112,9 @@ static int screen_ECH(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
num = seq->args[0];
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
term_page_erase(screen->page,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->cursor_x, screen->cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->cursor_x + num, screen->cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- &screen->attr, screen->age, false);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.cursor_x, screen->state.cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.cursor_x + num, screen->state.cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ &screen->state.attr, screen->age, false);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -2154,21 +2143,21 @@ static int screen_ED(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
switch (mode) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 0:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
term_page_erase(screen->page,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->cursor_x, screen->cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.cursor_x, screen->state.cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen->page->width, screen->page->height,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- &screen->attr, screen->age, false);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ &screen->state.attr, screen->age, false);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 1:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
term_page_erase(screen->page,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
0, 0,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->cursor_x, screen->cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- &screen->attr, screen->age, false);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.cursor_x, screen->state.cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ &screen->state.attr, screen->age, false);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 2:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
term_page_erase(screen->page,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
0, 0,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen->page->width, screen->page->height,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- &screen->attr, screen->age, false);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ &screen->state.attr, screen->age, false);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -2198,21 +2187,21 @@ static int screen_EL(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
switch (mode) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 0:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
term_page_erase(screen->page,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->cursor_x, screen->cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->page->width, screen->cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- &screen->attr, screen->age, false);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.cursor_x, screen->state.cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->page->width, screen->state.cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ &screen->state.attr, screen->age, false);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 1:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
term_page_erase(screen->page,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- 0, screen->cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->cursor_x, screen->cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- &screen->attr, screen->age, false);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ 0, screen->state.cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.cursor_x, screen->state.cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ &screen->state.attr, screen->age, false);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 2:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
term_page_erase(screen->page,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- 0, screen->cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->page->width, screen->cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- &screen->attr, screen->age, false);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ 0, screen->state.cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->page->width, screen->state.cursor_y,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ &screen->state.attr, screen->age, false);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -2271,7 +2260,7 @@ static int screen_HPA(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
num = seq->args[0];
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen_cursor_clear_wrap(screen);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen_cursor_set(screen, num - 1, screen->cursor_y);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen_cursor_set(screen, num - 1, screen->state.cursor_y);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -2327,7 +2316,7 @@ static int screen_HTS(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
unsigned int pos;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- pos = screen->cursor_x;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ pos = screen->state.cursor_x;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (screen->page->width > 0)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen->tabs[pos / 8] |= 1U << (pos % 8);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -2372,7 +2361,7 @@ static int screen_ICH(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
num = seq->args[0];
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen_cursor_clear_wrap(screen);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- term_page_insert_cells(screen->page, screen->cursor_x, screen->cursor_y, num, &screen->attr, screen->age);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ term_page_insert_cells(screen->page, screen->state.cursor_x, screen->state.cursor_y, num, &screen->state.attr, screen->age);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -2398,7 +2387,7 @@ static int screen_IL(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
num = seq->args[0];
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen_cursor_clear_wrap(screen);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- term_page_insert_lines(screen->page, screen->cursor_y, num, &screen->attr, screen->age);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ term_page_insert_lines(screen->page, screen->state.cursor_y, num, &screen->state.attr, screen->age);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -2424,7 +2413,7 @@ static int screen_LF(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen_cursor_down(screen, 1, true);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (screen->flags & TERM_FLAG_NEWLINE_MODE)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen_cursor_left(screen, screen->cursor_x);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen_cursor_left(screen, screen->state.cursor_x);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -2435,7 +2424,7 @@ static int screen_LS1R(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
* Map G1 into GR.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
*/
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->gr = &screen->g1;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.gr = &screen->g1;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -2446,7 +2435,7 @@ static int screen_LS2(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
* Map G2 into GL.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
*/
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->gl = &screen->g2;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.gl = &screen->g2;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -2457,7 +2446,7 @@ static int screen_LS2R(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
* Map G2 into GR.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
*/
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->gr = &screen->g2;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.gr = &screen->g2;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -2468,7 +2457,7 @@ static int screen_LS3(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
* Map G3 into GL.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
*/
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->gl = &screen->g3;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.gl = &screen->g3;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -2479,7 +2468,7 @@ static int screen_LS3R(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
* Map G3 into GR.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
*/
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->gr = &screen->g3;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.gr = &screen->g3;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -2513,7 +2502,7 @@ static int screen_NEL(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen_cursor_clear_wrap(screen);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen_cursor_down(screen, 1, true);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen_cursor_set(screen, 0, screen->cursor_y);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen_cursor_set(screen, 0, screen->state.cursor_y);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -2834,7 +2823,7 @@ static int screen_SD(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (seq->args[0] > 0)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
num = seq->args[0];
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- term_page_scroll_down(screen->page, num, &screen->attr, screen->age, NULL);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ term_page_scroll_down(screen->page, num, &screen->state.attr, screen->age, NULL);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -2849,7 +2838,7 @@ static int screen_SGR(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
int v;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (seq->n_args < 1) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- zero(screen->attr);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ zero(screen->state.attr);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -2857,67 +2846,67 @@ static int screen_SGR(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
v = seq->args[i];
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
switch (v) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 1:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->attr.bold = 1;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.attr.bold = 1;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 3:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->attr.italic = 1;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.attr.italic = 1;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 4:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->attr.underline = 1;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.attr.underline = 1;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 5:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->attr.blink = 1;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.attr.blink = 1;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 7:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->attr.inverse = 1;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.attr.inverse = 1;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 8:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->attr.hidden = 1;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.attr.hidden = 1;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 22:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->attr.bold = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.attr.bold = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 23:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->attr.italic = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.attr.italic = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 24:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->attr.underline = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.attr.underline = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 25:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->attr.blink = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.attr.blink = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 27:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->attr.inverse = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.attr.inverse = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 28:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->attr.hidden = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.attr.hidden = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 30 ... 37:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->attr.fg.ccode = v - 30 + TERM_CCODE_BLACK;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.attr.fg.ccode = v - 30 + TERM_CCODE_BLACK;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 39:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->attr.fg.ccode = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.attr.fg.ccode = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 40 ... 47:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->attr.bg.ccode = v - 40 + TERM_CCODE_BLACK;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.attr.bg.ccode = v - 40 + TERM_CCODE_BLACK;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 49:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->attr.bg.ccode = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.attr.bg.ccode = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 90 ... 97:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->attr.fg.ccode = v - 90 + TERM_CCODE_LIGHT_BLACK;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.attr.fg.ccode = v - 90 + TERM_CCODE_LIGHT_BLACK;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 100 ... 107:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->attr.bg.ccode = v - 100 + TERM_CCODE_LIGHT_BLACK;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.attr.bg.ccode = v - 100 + TERM_CCODE_LIGHT_BLACK;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 38:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
/* fallthrough */
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 48:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (v == 38)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- dst = &screen->attr.fg;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ dst = &screen->state.attr.fg;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
else
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- dst = &screen->attr.bg;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ dst = &screen->state.attr.bg;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
++i;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (i >= seq->n_args)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -2955,7 +2944,7 @@ static int screen_SGR(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case -1:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
/* fallthrough */
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 0:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- zero(screen->attr);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ zero(screen->state.attr);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -2969,7 +2958,7 @@ static int screen_SI(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
* Map G0 into GL.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
*/
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->gl = &screen->g0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.gl = &screen->g0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -3009,7 +2998,7 @@ static int screen_SO(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
* Map G1 into GL.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
*/
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->gl = &screen->g1;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.gl = &screen->g1;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -3030,7 +3019,7 @@ static int screen_SS2(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
* Temporarily map G2 into GL for the next graphics character.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
*/
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->glt = &screen->g2;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.glt = &screen->g2;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -3041,7 +3030,7 @@ static int screen_SS3(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
* Temporarily map G3 into GL for the next graphics character
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
*/
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->glt = &screen->g3;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.glt = &screen->g3;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -3077,7 +3066,7 @@ static int screen_SU(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (seq->args[0] > 0)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
num = seq->args[0];
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- term_page_scroll_up(screen->page, num, &screen->attr, screen->age, screen->history);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ term_page_scroll_up(screen->page, num, &screen->state.attr, screen->age, screen->history);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -3116,7 +3105,7 @@ static int screen_TBC(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
switch (mode) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case 0:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- pos = screen->cursor_x;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ pos = screen->state.cursor_x;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (screen->page->width > 0)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen->tabs[pos / 8] &= ~(1U << (pos % 8));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -3147,7 +3136,7 @@ static int screen_VPA(term_screen *screen, const term_seq *seq) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
pos = seq->args[0];
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen_cursor_clear_wrap(screen);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen_cursor_set_rel(screen, screen->cursor_x, pos - 1);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen_cursor_set_rel(screen, screen->state.cursor_x, pos - 1);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -4104,11 +4093,11 @@ int term_screen_resize(term_screen *screen, unsigned int x, unsigned int y) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
assert_return(screen, -EINVAL);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- r = term_page_reserve(screen->page_main, x, y, &screen->attr, screen->age);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ r = term_page_reserve(screen->page_main, x, y, &screen->state.attr, screen->age);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (r < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return r;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- r = term_page_reserve(screen->page_alt, x, y, &screen->attr, screen->age);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ r = term_page_reserve(screen->page_alt, x, y, &screen->state.attr, screen->age);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (r < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return r;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -4124,11 +4113,11 @@ int term_screen_resize(term_screen *screen, unsigned int x, unsigned int y) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
for (i = (screen->page->width + 7) / 8 * 8; i < x; i += 8)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen->tabs[i / 8] = 0x1;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- term_page_resize(screen->page_main, x, y, &screen->attr, screen->age, screen->history);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- term_page_resize(screen->page_alt, x, y, &screen->attr, screen->age, NULL);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ term_page_resize(screen->page_main, x, y, &screen->state.attr, screen->age, screen->history);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ term_page_resize(screen->page_alt, x, y, &screen->state.attr, screen->age, NULL);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->cursor_x = screen_clamp_x(screen, screen->cursor_x);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->cursor_y = screen_clamp_x(screen, screen->cursor_y);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.cursor_x = screen_clamp_x(screen, screen->state.cursor_x);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.cursor_y = screen_clamp_x(screen, screen->state.cursor_y);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen_cursor_clear_wrap(screen);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -4139,29 +4128,26 @@ void term_screen_soft_reset(term_screen *screen) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
assert(screen);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->gl = &screen->g0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->gr = &screen->g1;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->glt = NULL;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->grt = NULL;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen->g0 = &term_unicode_lower;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen->g1 = &term_unicode_upper;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen->g2 = &term_unicode_lower;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen->g3 = &term_unicode_upper;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.attr = screen->default_attr;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.gl = &screen->g0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.gr = &screen->g1;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.glt = NULL;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.grt = NULL;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.auto_wrap = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.origin_mode = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->saved = screen->state;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->saved.cursor_x = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->saved.cursor_y = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen->page = screen->page_main;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen->history = screen->history_main;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen->flags = TERM_FLAG_7BIT_MODE;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen->conformance_level = TERM_CONFORMANCE_LEVEL_VT400;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->attr = screen->default_attr;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
-
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->saved.cursor_x = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->saved.cursor_y = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->saved.attr = screen->attr;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->saved.gl = screen->gl;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->saved.gr = screen->gr;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->saved.glt = NULL;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->saved.grt = NULL;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->flags = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
for (i = 0; i < screen->page->width; i += 8)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
screen->tabs[i / 8] = 0x1;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -4175,10 +4161,10 @@ void term_screen_hard_reset(term_screen *screen) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
term_screen_soft_reset(screen);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
zero(screen->utf8);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->cursor_x = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- screen->cursor_y = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- term_page_erase(screen->page_main, 0, 0, screen->page->width, screen->page->height, &screen->attr, screen->age, false);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- term_page_erase(screen->page_alt, 0, 0, screen->page->width, screen->page->height, &screen->attr, screen->age, false);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.cursor_x = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ screen->state.cursor_y = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ term_page_erase(screen->page_main, 0, 0, screen->page->width, screen->page->height, &screen->state.attr, screen->age, false);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ term_page_erase(screen->page_alt, 0, 0, screen->page->width, screen->page->height, &screen->state.attr, screen->age, false);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
int term_screen_set_answerback(term_screen *screen, const char *answerback) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -4248,7 +4234,7 @@ int term_screen_draw(term_screen *screen,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
cw = MAX(cell->cwidth, 1U);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
attr = cell->attr;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- if (i == screen->cursor_x && j == screen->cursor_y &&
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ if (i == screen->state.cursor_x && j == screen->state.cursor_y &&
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
!(screen->flags & TERM_FLAG_HIDE_CURSOR))
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
attr.inverse ^= 1;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|