mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
grid: set linebreak=false when printing to a line, not when allocating it
This ensures empty lines are treated correctly, and is also more in line with how lines are handled at runtime, when filling the scrollback. For now, set linebreak=false as soon as something is printed on a line. It will remain like that *until* we reach the end of an old row with linebreak=true, at which point we set linebreak=true on the current new line.
This commit is contained in:
parent
7b6efcf19a
commit
605694bc93
1 changed files with 11 additions and 9 deletions
20
grid.c
20
grid.c
|
|
@ -501,7 +501,6 @@ grid_resize_without_reflow(
|
|||
sizeof(struct cell) * min(old_cols, new_cols));
|
||||
|
||||
new_row->dirty = old_row->dirty;
|
||||
new_row->linebreak = false;
|
||||
new_row->shell_integration.prompt_marker = old_row->shell_integration.prompt_marker;
|
||||
new_row->shell_integration.cmd_start = min(old_row->shell_integration.cmd_start, new_cols - 1);
|
||||
new_row->shell_integration.cmd_end = min(old_row->shell_integration.cmd_end, new_cols - 1);
|
||||
|
|
@ -709,10 +708,6 @@ _line_wrap(struct grid *old_grid, struct row **new_grid, struct row *row,
|
|||
/* Scrollback not yet full, allocate a completely new row */
|
||||
new_row = grid_row_alloc(col_count, false);
|
||||
new_grid[*row_idx] = new_row;
|
||||
|
||||
/* *clear* linebreak, since we only want to set it when we
|
||||
reach the end of an old row, with linebreak=true */
|
||||
new_row->linebreak = false;
|
||||
} else {
|
||||
/* Scrollback is full, need to reuse a row */
|
||||
grid_row_reset_extra(new_row);
|
||||
|
|
@ -720,10 +715,6 @@ _line_wrap(struct grid *old_grid, struct row **new_grid, struct row *row,
|
|||
new_row->shell_integration.cmd_start = -1;
|
||||
new_row->shell_integration.cmd_end = -1;
|
||||
|
||||
/* *clear* linebreak, since we only want to set it when we
|
||||
reach the end of an old row, with linebreak=true */
|
||||
new_row->linebreak = false;
|
||||
|
||||
tll_foreach(old_grid->sixel_images, it) {
|
||||
if (it->item.pos.row == *row_idx) {
|
||||
sixel_destroy(&it->item);
|
||||
|
|
@ -1112,6 +1103,17 @@ grid_resize_and_reflow(
|
|||
}
|
||||
|
||||
new_row->cells[new_col_idx++] = *old;
|
||||
|
||||
/*
|
||||
* TODO: simulate LCF instead?
|
||||
*
|
||||
* Rows have linebreak=true by default. This is needed
|
||||
* for a number of reasons. However, we want non-empty
|
||||
* rows to have linebreak=false, *until* we reach the
|
||||
* end of an old row with linebreak=true, at which
|
||||
* point we set linebreak=true on the new row.
|
||||
*/
|
||||
new_row->linebreak = false;
|
||||
old++;
|
||||
c++;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue