From 2d17254b2c3a95e12bbab506429b9a1c95d816a2 Mon Sep 17 00:00:00 2001 From: Michael Sippel Date: Wed, 11 Aug 2021 17:43:23 +0200 Subject: [PATCH] leveled term view: only notify when level is changed --- nested/src/leveled_term_view.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/nested/src/leveled_term_view.rs b/nested/src/leveled_term_view.rs index 4a7d445..77565dd 100644 --- a/nested/src/leveled_term_view.rs +++ b/nested/src/leveled_term_view.rs @@ -57,13 +57,15 @@ impl LeveledTermView { } pub fn set_level(&mut self, l: usize) { - self.level = l; + if self.level != l { + self.level = l; - // update complete area - if let Some(a) = self.src.area() { - self.cast.notify_each(a); + // update complete area + if let Some(a) = self.src.area() { + self.cast.notify_each(a); + } } - } + } } impl ImplIndexView for LeveledTermView {