From 777863ac3e27464175699921fceb2c1fab163d0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Wed, 28 Aug 2019 17:25:42 +0200 Subject: [PATCH] term: add term_reset_view() - make view follow end-of-output again --- terminal.c | 10 ++++++++++ terminal.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/terminal.c b/terminal.c index b9d2f0f3..95a60682 100644 --- a/terminal.c +++ b/terminal.c @@ -362,6 +362,16 @@ term_reverse_index(struct terminal *term) term_cursor_up(term, 1); } +void +term_reset_view(struct terminal *term) +{ + if (term->grid->view == term->grid->offset) + return; + + term->grid->view = term->grid->offset; + term_damage_view(term); +} + void term_restore_cursor(struct terminal *term) { diff --git a/terminal.h b/terminal.h index 5989788a..18130392 100644 --- a/terminal.h +++ b/terminal.h @@ -392,6 +392,8 @@ void term_damage_rows_in_view(struct terminal *term, int start, int end); void term_damage_all(struct terminal *term); void term_damage_view(struct terminal *term); +void term_reset_view(struct terminal *term); + void term_damage_scroll( struct terminal *term, enum damage_type damage_type, struct scroll_region region, int lines);