aboutsummaryrefslogtreecommitdiff
path: root/helix-view
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-06-03 01:28:49 +0000
committerBlaž Hrastnik2021-06-03 01:28:49 +0000
commitc0332bd935bb7c016278d43a526e588558a0cab1 (patch)
treed7a65b8aef3bde84baa7a39196a089e203f95d2a /helix-view
parent3c7729906c9a677d715f2694c16cd78200691aaf (diff)
Fix split sizes getting out of sync with the terminal size, refs #69
Diffstat (limited to 'helix-view')
-rw-r--r--helix-view/src/editor.rs5
-rw-r--r--helix-view/src/tree.rs10
2 files changed, 10 insertions, 5 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index e9f8b5a1..e7b25814 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -194,8 +194,9 @@ impl Editor {
}
pub fn resize(&mut self, area: Rect) {
- self.tree.resize(area);
- self._refresh();
+ if self.tree.resize(area) {
+ self._refresh();
+ };
}
pub fn focus_next(&mut self) {
diff --git a/helix-view/src/tree.rs b/helix-view/src/tree.rs
index b7c99e16..5b56156f 100644
--- a/helix-view/src/tree.rs
+++ b/helix-view/src/tree.rs
@@ -293,9 +293,13 @@ impl Tree {
}
}
- pub fn resize(&mut self, area: Rect) {
- self.area = area;
- self.recalculate();
+ pub fn resize(&mut self, area: Rect) -> bool {
+ if self.area != area {
+ self.area = area;
+ self.recalculate();
+ return true;
+ }
+ false
}
pub fn recalculate(&mut self) {