From 79bfabbc660160d5fc1450dfedc81e310ba9cf1b Mon Sep 17 00:00:00 2001 From: FliegendeWurst <2012gdwu+github@posteo.de> Date: Sat, 15 May 2021 12:28:11 +0200 Subject: [PATCH] Only render visible content in TextView --- cursive-core/src/views/text_view.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cursive-core/src/views/text_view.rs b/cursive-core/src/views/text_view.rs index 676776d..f10be7e 100644 --- a/cursive-core/src/views/text_view.rs +++ b/cursive-core/src/views/text_view.rs @@ -394,8 +394,13 @@ impl View for TextView { let content = self.content.content.lock().unwrap(); + let miny = printer.content_offset.y; + let maxy = printer.output_size.y + printer.content_offset.y; printer.with_style(self.style, |printer| { for (y, row) in self.rows.iter().enumerate() { + if y < miny || y >= maxy { + continue; + } let l = row.width; let mut x = self.align.h.get_offset(l, printer.size.x);