fix: paste into terminal after switching modes (#793)
* fix: paste into terminal after switching modes * fix: remove collect and fix format
This commit is contained in:
parent
dcd77749dd
commit
26a1b93098
1 changed files with 12 additions and 2 deletions
|
@ -114,6 +114,7 @@ impl State {
|
||||||
match input {
|
match input {
|
||||||
Event::Key(k) => self.handle_key_input(settings, k, len),
|
Event::Key(k) => self.handle_key_input(settings, k, len),
|
||||||
Event::Mouse(m) => self.handle_mouse_input(*m, len),
|
Event::Mouse(m) => self.handle_mouse_input(*m, len),
|
||||||
|
Event::Paste(d) => self.handle_paste_input(d),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,6 +134,13 @@ impl State {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn handle_paste_input(&mut self, input: &str) -> Option<usize> {
|
||||||
|
for i in input.chars() {
|
||||||
|
self.search.input.insert(i);
|
||||||
|
}
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_lines)]
|
#[allow(clippy::too_many_lines)]
|
||||||
fn handle_key_input(
|
fn handle_key_input(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
@ -451,7 +459,8 @@ impl Stdout {
|
||||||
execute!(
|
execute!(
|
||||||
stdout,
|
stdout,
|
||||||
terminal::EnterAlternateScreen,
|
terminal::EnterAlternateScreen,
|
||||||
event::EnableMouseCapture
|
event::EnableMouseCapture,
|
||||||
|
event::EnableBracketedPaste
|
||||||
)?;
|
)?;
|
||||||
Ok(Self { stdout })
|
Ok(Self { stdout })
|
||||||
}
|
}
|
||||||
|
@ -462,7 +471,8 @@ impl Drop for Stdout {
|
||||||
execute!(
|
execute!(
|
||||||
self.stdout,
|
self.stdout,
|
||||||
terminal::LeaveAlternateScreen,
|
terminal::LeaveAlternateScreen,
|
||||||
event::DisableMouseCapture
|
event::DisableMouseCapture,
|
||||||
|
event::DisableBracketedPaste
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
terminal::disable_raw_mode().unwrap();
|
terminal::disable_raw_mode().unwrap();
|
||||||
|
|
Loading…
Reference in a new issue