mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-04 01:40:21 -05:00
parent
277d676159
commit
f85cf47b65
2 changed files with 13 additions and 5 deletions
|
|
@ -80,6 +80,8 @@
|
||||||
direction.
|
direction.
|
||||||
* OSC 10/11/104/110/111 (modify colors) did not update existing screen
|
* OSC 10/11/104/110/111 (modify colors) did not update existing screen
|
||||||
content (https://codeberg.org/dnkl/foot/issues/94).
|
content (https://codeberg.org/dnkl/foot/issues/94).
|
||||||
|
* Extra newlines when copying empty cells
|
||||||
|
(https://codeberg.org/dnkl/foot/issues/97).
|
||||||
|
|
||||||
|
|
||||||
### Security
|
### Security
|
||||||
|
|
|
||||||
16
extract.c
16
extract.c
|
|
@ -10,6 +10,7 @@ struct extraction_context {
|
||||||
size_t size;
|
size_t size;
|
||||||
size_t idx;
|
size_t idx;
|
||||||
size_t empty_count;
|
size_t empty_count;
|
||||||
|
size_t newline_count;
|
||||||
bool failed;
|
bool failed;
|
||||||
const struct row *last_row;
|
const struct row *last_row;
|
||||||
const struct cell *last_cell;
|
const struct cell *last_cell;
|
||||||
|
|
@ -124,10 +125,10 @@ extract_one(const struct terminal *term, const struct row *row,
|
||||||
{
|
{
|
||||||
/* Row has a hard linebreak, or either last cell or
|
/* Row has a hard linebreak, or either last cell or
|
||||||
* current cell is empty */
|
* current cell is empty */
|
||||||
if (!ensure_size(ctx, 1))
|
|
||||||
goto err;
|
|
||||||
|
|
||||||
ctx->buf[ctx->idx++] = L'\n';
|
/* Don't emit newline just yet - only if there are
|
||||||
|
* non-empty cells following it */
|
||||||
|
ctx->newline_count++;
|
||||||
ctx->empty_count = 0;
|
ctx->empty_count = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -149,12 +150,17 @@ extract_one(const struct terminal *term, const struct row *row,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Replace empty cells with spaces when followed by non-empty cell */
|
/* Insert pending newlines, and replace empty cells with spaces */
|
||||||
if (!ensure_size(ctx, ctx->empty_count))
|
if (!ensure_size(ctx, ctx->newline_count + ctx->empty_count))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < ctx->newline_count; i++)
|
||||||
|
ctx->buf[ctx->idx++] = L'\n';
|
||||||
|
|
||||||
for (size_t i = 0; i < ctx->empty_count; i++)
|
for (size_t i = 0; i < ctx->empty_count; i++)
|
||||||
ctx->buf[ctx->idx++] = L' ';
|
ctx->buf[ctx->idx++] = L' ';
|
||||||
|
|
||||||
|
ctx->newline_count = 0;
|
||||||
ctx->empty_count = 0;
|
ctx->empty_count = 0;
|
||||||
|
|
||||||
if (cell->wc >= CELL_COMB_CHARS_LO &&
|
if (cell->wc >= CELL_COMB_CHARS_LO &&
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue