diff options
author | qkzk <qu3nt1n@gmail.com> | 2023-09-22 22:27:36 +0200 |
---|---|---|
committer | qkzk <qu3nt1n@gmail.com> | 2023-09-22 22:27:36 +0200 |
commit | 5ea0739aeec461d1d4365806c7280e350558bd9f (patch) | |
tree | 1635ae4da23a4751e6cc42f78285ca014e707cf1 /src/mode.rs | |
parent | 545c18abe476580be85c1504ff19ef6fbfc4466a (diff) |
The mode should know if they require a refresh when left. ATM only Preview does
Diffstat (limited to 'src/mode.rs')
-rw-r--r-- | src/mode.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mode.rs b/src/mode.rs index ac6ba7d..012f0a2 100644 --- a/src/mode.rs +++ b/src/mode.rs @@ -131,6 +131,15 @@ pub enum Mode { InputSimple(InputSimple), } +impl Mode { + /// True if the mode requires a view refresh when left. + /// Most modes don't, since they don't display their content in the first window. + /// content. But `Mode::Preview` does, since it uses the main window. + pub fn refresh_required(&self) -> bool { + matches!(*self, Mode::Preview) + } +} + impl fmt::Display for Mode { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { |