From 54e2b0b005347810571a44b1ad64f9c14cf56e92 Mon Sep 17 00:00:00 2001 From: Max Hollmann Date: Wed, 15 Jul 2020 09:53:13 +0200 Subject: limit font size to non-negative values --- terminal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'terminal.c') diff --git a/terminal.c b/terminal.c index 40bfbc90..84c9d459 100644 --- a/terminal.c +++ b/terminal.c @@ -1430,7 +1430,7 @@ term_font_size_adjust(struct terminal *term, double amount) old_pt_size = term->font_sizes[i].px_size * 72. / dpi; } - term->font_sizes[i].pt_size = old_pt_size + amount; + term->font_sizes[i].pt_size = fmax(old_pt_size + amount, 0); term->font_sizes[i].px_size = -1; } -- cgit v1.3 From 6f2cffd8c0949c2dfa1499c5d0c2594eb645ac26 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Thu, 16 Jul 2020 08:04:12 +0200 Subject: vt: never call term_print() with a width <= 0 --- terminal.c | 3 +-- vt.c | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'terminal.c') diff --git a/terminal.c b/terminal.c index 84c9d459..554aa8b2 100644 --- a/terminal.c +++ b/terminal.c @@ -2401,8 +2401,7 @@ print_spacer(struct terminal *term, int col) void term_print(struct terminal *term, wchar_t wc, int width) { - if (unlikely(width <= 0)) - return; + assert(width > 0); print_linewrap(term); print_insert(term, width); diff --git a/vt.c b/vt.c index 148f2aae..f25f26be 100644 --- a/vt.c +++ b/vt.c @@ -663,7 +663,8 @@ action_utf8_print(struct terminal *term, wchar_t wc) } } - term_print(term, wc, width); + if (width > 0) + term_print(term, wc, width); } static void -- cgit v1.3 From 7f6ed98a8366d0c270aff592c6d5782f99385a6a Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Thu, 16 Jul 2020 08:47:37 +0200 Subject: term: line-wrap: don't move cursor outside the grid Remove assertion that row be less than the scrolling region end. The cursor may in fact be *inside* the margin. Inside the margin, content never scrolls, but we must make sure we don't move the cursor outside the grid. --- terminal.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'terminal.c') diff --git a/terminal.c b/terminal.c index 554aa8b2..450b885b 100644 --- a/terminal.c +++ b/terminal.c @@ -2355,12 +2355,15 @@ print_linewrap(struct terminal *term) } term->grid->cursor.lcf = false; - if (term->grid->cursor.point.row == term->scroll_region.end - 1) + + const int row = term->grid->cursor.point.row; + + if (row == term->scroll_region.end - 1) term_scroll(term, 1); else { - assert(term->grid->cursor.point.row < term->scroll_region.end - 1); - term->grid->cursor.point.row++; - term->grid->cur_row = grid_row(term->grid, term->grid->cursor.point.row); + const int new_row = min(row + 1, term->rows - 1); + term->grid->cursor.point.row = new_row; + term->grid->cur_row = grid_row(term->grid, new_row); } term->grid->cursor.point.col = 0; -- cgit v1.3