term: move row->prompt_marker into new struct, row->shell_integration

This commit is contained in:
Daniel Eklöf 2022-12-08 10:35:30 +01:00
parent 0f10c4fd6c
commit f8e875a7cd
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
5 changed files with 12 additions and 11 deletions

10
grid.c
View file

@ -231,7 +231,7 @@ grid_snapshot(const struct grid *grid)
clone_row->cells = xmalloc(grid->num_cols * sizeof(clone_row->cells[0])); clone_row->cells = xmalloc(grid->num_cols * sizeof(clone_row->cells[0]));
clone_row->linebreak = row->linebreak; clone_row->linebreak = row->linebreak;
clone_row->dirty = row->dirty; clone_row->dirty = row->dirty;
clone_row->prompt_marker = row->prompt_marker; clone_row->shell_integration = row->shell_integration;
for (int c = 0; c < grid->num_cols; c++) for (int c = 0; c < grid->num_cols; c++)
clone_row->cells[c] = row->cells[c]; clone_row->cells[c] = row->cells[c];
@ -366,7 +366,7 @@ grid_row_alloc(int cols, bool initialize)
row->dirty = false; row->dirty = false;
row->linebreak = false; row->linebreak = false;
row->extra = NULL; row->extra = NULL;
row->prompt_marker = false; row->shell_integration.prompt_marker = false;
if (initialize) { if (initialize) {
row->cells = xcalloc(cols, sizeof(row->cells[0])); row->cells = xcalloc(cols, sizeof(row->cells[0]));
@ -425,7 +425,7 @@ grid_resize_without_reflow(
new_row->dirty = old_row->dirty; new_row->dirty = old_row->dirty;
new_row->linebreak = false; new_row->linebreak = false;
new_row->prompt_marker = old_row->prompt_marker; new_row->shell_integration = old_row->shell_integration;
if (new_cols > old_cols) { if (new_cols > old_cols) {
/* Clear "new" columns */ /* Clear "new" columns */
@ -587,7 +587,7 @@ _line_wrap(struct grid *old_grid, struct row **new_grid, struct row *row,
/* Scrollback is full, need to reuse a row */ /* Scrollback is full, need to reuse a row */
grid_row_reset_extra(new_row); grid_row_reset_extra(new_row);
new_row->linebreak = false; new_row->linebreak = false;
new_row->prompt_marker = false; new_row->shell_integration.prompt_marker = false;
tll_foreach(old_grid->sixel_images, it) { tll_foreach(old_grid->sixel_images, it) {
if (it->item.pos.row == *row_idx) { if (it->item.pos.row == *row_idx) {
@ -920,7 +920,7 @@ grid_resize_and_reflow(
xassert(from + amount <= old_cols); xassert(from + amount <= old_cols);
if (from == 0) if (from == 0)
new_row->prompt_marker = old_row->prompt_marker; new_row->shell_integration = old_row->shell_integration;
memcpy( memcpy(
&new_row->cells[new_col_idx], &old_row->cells[from], &new_row->cells[new_col_idx], &old_row->cells[from],

View file

@ -377,7 +377,7 @@ execute_binding(struct seat *seat, struct terminal *term,
const struct row *row = grid->rows[r_abs]; const struct row *row = grid->rows[r_abs];
xassert(row != NULL); xassert(row != NULL);
if (!row->prompt_marker) if (!row->shell_integration.prompt_marker)
continue; continue;
grid->view = r_abs; grid->view = r_abs;
@ -409,7 +409,7 @@ execute_binding(struct seat *seat, struct terminal *term,
const struct row *row = grid->rows[r_abs]; const struct row *row = grid->rows[r_abs];
xassert(row != NULL); xassert(row != NULL);
if (!row->prompt_marker) { if (!row->shell_integration.prompt_marker) {
if (r_abs == grid->offset + term->rows - 1) { if (r_abs == grid->offset + term->rows - 1) {
/* Weve reached the bottom of the scrollback */ /* Weve reached the bottom of the scrollback */
break; break;

2
osc.c
View file

@ -893,7 +893,7 @@ osc_dispatch(struct terminal *term)
term->grid->cursor.point.row, term->grid->cursor.point.row,
term->grid->cursor.point.col); term->grid->cursor.point.col);
term->grid->cur_row->prompt_marker = true; term->grid->cur_row->shell_integration.prompt_marker = true;
break; break;
case 'B': case 'B':

View file

@ -1825,7 +1825,7 @@ erase_line(struct terminal *term, struct row *row)
{ {
erase_cell_range(term, row, 0, term->cols - 1); erase_cell_range(term, row, 0, term->cols - 1);
row->linebreak = false; row->linebreak = false;
row->prompt_marker = false; row->shell_integration.prompt_marker = false;
} }
void void

View file

@ -121,8 +121,9 @@ struct row {
bool dirty; bool dirty;
bool linebreak; bool linebreak;
/* Shell integration */ struct {
bool prompt_marker; bool prompt_marker;
} shell_integration;
}; };
struct sixel { struct sixel {