aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJames Campos <james.r.campos@gmail.com>2020-07-09 20:54:11 -0700
committerJames Campos <james.r.campos@gmail.com>2020-07-09 20:54:11 -0700
commitbf02f5e92a9793e2b9c153feeed50d26558a0b94 (patch)
tree6cf32e6bd165905ae45a3c439533cd23bb835fe8 /src
parent04d88a776b11b71d0181ac05544f5dfe415f5ea1 (diff)
downloadbk-bf02f5e92a9793e2b9c153feeed50d26558a0b94.tar.gz
reflow
Diffstat (limited to 'src')
-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(_) => (),