aboutsummaryrefslogtreecommitdiff
path: root/terminal.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-02-15 18:00:18 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-02-15 18:00:18 +0000
commita089d6264d941876f4fc6292a28770dfd708007a (patch)
treeaf784319f0f379271f99562568d125b536853460 /terminal.c
parentrender: resize: don't reflow text if grid layout hasn't changed (diff)
parentrender: reflow: set 'linebreak' flag before inserting new line (diff)
Merge branch 'text-reflow-fixes'
Diffstat (limited to 'terminal.c')
-rw-r--r--terminal.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/terminal.c b/terminal.c
index cb52a416..bec0ce7b 100644
--- a/terminal.c
+++ b/terminal.c
@@ -1090,8 +1090,8 @@ term_reset(struct terminal *term, bool hard)
term->normal.offset = term->normal.view = 0;
term->alt.offset = term->alt.view = 0;
for (size_t i = 0; i < term->rows; i++) {
- memset(grid_row_and_alloc(&term->normal, i)->cells, 0, term->cols * sizeof(struct cell));
- memset(grid_row_and_alloc(&term->alt, i)->cells, 0, term->cols * sizeof(struct cell));
+ term->normal.rows[i] = grid_row_alloc(term->cols, true);
+ term->alt.rows[i] = grid_row_alloc(term->cols, true);
}
for (size_t i = term->rows; i < term->normal.num_rows; i++) {
grid_row_free(term->normal.rows[i]);
@@ -1253,6 +1253,7 @@ static inline void
erase_line(struct terminal *term, struct row *row)
{
erase_cell_range(term, row, 0, term->cols - 1);
+ row->linebreak = false;
}
void
@@ -1498,17 +1499,13 @@ term_scroll_reverse(struct terminal *term, int rows)
void
term_formfeed(struct terminal *term)
{
- int col = term->cursor.point.col;
- if (!term->cursor.lcf)
- col--;
- if (col >= 0)
- term->grid->cur_row->cells[col].attrs.linefeed = 1;
term_cursor_left(term, term->cursor.point.col);
}
void
term_linefeed(struct terminal *term)
{
+ term->grid->cur_row->linebreak = true;
if (term->cursor.point.row == term->scroll_region.end - 1)
term_scroll(term, 1);
else