summaryrefslogtreecommitdiffstats
path: root/src/tab.rs
diff options
context:
space:
mode:
authorqkzk <qu3nt1n@gmail.com>2023-10-31 19:21:33 +0100
committerqkzk <qu3nt1n@gmail.com>2023-10-31 19:21:33 +0100
commit5363d5ebd2984a1d09133ce9b62a2e0c0649e912 (patch)
tree01ef9e104a19ecc3bbc9f956eed20055bde00d4a /src/tab.rs
parent50d448c93b13fcc47ba8ff197951694345b840e8 (diff)
refactor event dispatcher
Diffstat (limited to 'src/tab.rs')
-rw-r--r--src/tab.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/tab.rs b/src/tab.rs
index 3349c84..801c86e 100644
--- a/src/tab.rs
+++ b/src/tab.rs
@@ -450,6 +450,14 @@ impl Tab {
must_refresh
}
+ pub fn reset_mode_and_view(&mut self) -> Result<()> {
+ if self.reset_mode() {
+ self.refresh_view()
+ } else {
+ Ok(())
+ }
+ }
+
/// Returns true if the current mode requires 2 windows.
/// Only Tree, Normal & Preview doesn't require 2 windows.
pub fn need_second_window(&self) -> bool {
@@ -496,6 +504,12 @@ impl Tab {
self.window.scroll_to(0);
}
+ /// Insert a char in the input string.
+ pub fn input_insert(&mut self, char: char) -> Result<()> {
+ self.input.insert(char);
+ Ok(())
+ }
+
/// Add a char to input string, look for a possible completion.
pub fn text_insert_and_complete(&mut self, c: char) -> Result<()> {
self.input.insert(c);