···
ctx->control_sequence = false;
54
+
ctx->osc_escape = false;
ctx->discard_next = false;
58
+
ctx->bg_bold = false;
ctx->reverse_video = false;
ctx->dec_private = false;
ctx->insert_mode = false;
···
ctx->current_primary = (size_t)-1;
71
+
ctx->current_bg = (size_t)-1;
ctx->scroll_top_margin = 0;
ctx->scroll_bottom_margin = ctx->rows;
···
104
+
ctx->bg_bold = false;
ctx->current_primary = (size_t)-1;
106
+
ctx->current_bg = (size_t)-1;
ctx->set_text_bg_default(ctx);
ctx->set_text_fg_default(ctx);
···
124
+
else if (ctx->esc_values[i] == 5) {
125
+
ctx->bg_bold = true;
126
+
if (ctx->current_bg != (size_t)-1) {
127
+
if (!ctx->reverse_video) {
128
+
ctx->set_text_bg_bright(ctx, ctx->current_bg);
130
+
ctx->set_text_fg_bright(ctx, ctx->current_bg);
else if (ctx->esc_values[i] == 22) {
if (ctx->current_primary != (size_t)-1) {
···
148
+
else if (ctx->esc_values[i] == 25) {
149
+
ctx->bg_bold = false;
150
+
if (ctx->current_bg != (size_t)-1) {
151
+
if (!ctx->reverse_video) {
152
+
ctx->set_text_bg(ctx, ctx->current_bg);
154
+
ctx->set_text_fg(ctx, ctx->current_bg);
else if (ctx->esc_values[i] >= 30 && ctx->esc_values[i] <= 37) {
ctx->current_primary = ctx->esc_values[i] - offset;
···
139
-
if (ctx->bold && !ctx->reverse_video) {
169
+
if ((ctx->bold && !ctx->reverse_video)
170
+
|| (ctx->bg_bold && ctx->reverse_video)) {
ctx->set_text_fg_bright(ctx, ctx->esc_values[i] - offset);
ctx->set_text_fg(ctx, ctx->esc_values[i] - offset);
···
else if (ctx->esc_values[i] >= 40 && ctx->esc_values[i] <= 47) {
180
+
ctx->current_bg = ctx->esc_values[i] - offset;
if (ctx->reverse_video) {
154
-
if (ctx->bold && ctx->reverse_video) {
187
+
if ((ctx->bold && ctx->reverse_video)
188
+
|| (ctx->bg_bold && !ctx->reverse_video)) {
ctx->set_text_bg_bright(ctx, ctx->esc_values[i] - offset);
ctx->set_text_bg(ctx, ctx->esc_values[i] - offset);
···
else if (ctx->esc_values[i] >= 100 && ctx->esc_values[i] <= 107) {
211
+
ctx->current_bg = ctx->esc_values[i] - offset;
if (ctx->reverse_video) {
···
else if (ctx->esc_values[i] == 49) {
239
+
ctx->current_bg = (size_t)-1;
if (ctx->reverse_video) {
···
395
+
static void osc_parse(struct term_context *ctx, uint8_t c) {
396
+
if (ctx->osc_escape && c == '\\') {
400
+
ctx->osc_escape = false;
404
+
ctx->osc_escape = true;
413
+
ctx->osc_escape = false;
415
+
ctx->escape = false;
static void control_sequence_parse(struct term_context *ctx, uint8_t c) {
if (ctx->escape_offset == 2) {
···
ctx->esc_values[0] = ctx->rows - 1;
ctx->set_cursor_pos(ctx, ctx->esc_values[1], ctx->esc_values[0]);
556
+
for (size_t i = 0; i < ctx->esc_values[0]; i++) {
561
+
size_t old_scroll_top_margin = ctx->scroll_top_margin;
562
+
ctx->scroll_top_margin = y + 1;
563
+
for (size_t i = 0; i < ctx->esc_values[0]; i++) {
564
+
ctx->revscroll(ctx);
566
+
ctx->scroll_top_margin = old_scroll_top_margin;
switch (ctx->esc_values[0]) {
···
size_t rows_remaining = ctx->rows - (y + 1);
size_t cols_diff = ctx->cols - (x + 1);
518
-
size_t to_clear = rows_remaining * ctx->cols + cols_diff;
593
+
size_t to_clear = rows_remaining * ctx->cols + cols_diff + 1;
for (size_t i = 0; i < to_clear; i++) {
ctx->raw_putchar(ctx, ' ');
···
static void restore_state(struct term_context *ctx) {
ctx->bold = ctx->saved_state_bold;
711
+
ctx->bg_bold = ctx->saved_state_bg_bold;
ctx->reverse_video = ctx->saved_state_reverse_video;
ctx->current_charset = ctx->saved_state_current_charset;
ctx->current_primary = ctx->saved_state_current_primary;
715
+
ctx->current_bg = ctx->saved_state_current_bg;
···
ctx->saved_state_bold = ctx->bold;
724
+
ctx->saved_state_bg_bold = ctx->bg_bold;
ctx->saved_state_reverse_video = ctx->reverse_video;
ctx->saved_state_current_charset = ctx->current_charset;
ctx->saved_state_current_primary = ctx->current_primary;
728
+
ctx->saved_state_current_bg = ctx->current_bg;
static void escape_parse(struct term_context *ctx, uint8_t c) {
734
+
if (ctx->osc == true) {
if (ctx->control_sequence == true) {
control_sequence_parse(ctx, c);
···
ctx->get_cursor_pos(ctx, &x, &y);
754
+
ctx->osc_escape = false;
for (size_t i = 0; i < TERM_MAX_ESC_VALUES; i++)
···
ctx->control_sequence = false;
861
+
ctx->osc_escape = false;