aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index 9a4e720..bf8baf1 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -538,8 +538,14 @@ impl Bk<'_> {
match event::read()? {
Event::Key(e) => view.run(self, e.code),
Event::Resize(cols, rows) => {
- self.cols = cols;
self.rows = rows as usize;
+ if cols != self.cols {
+ self.cols = cols;
+ let width = min(cols, self.max_width) as usize;
+ for c in &mut self.chapters {
+ c.lines = wrap(&c.text, width);
+ }
+ }
}
// TODO
Event::Mouse(_) => (),