Co-Authored-By: Julia <30666851+ForLoveOfCats@users.noreply.github.com>
This commit is contained in:
Joseph T. Lyons 2023-08-22 15:27:44 -04:00
parent a836f9c23d
commit 471810a3c2
3 changed files with 76 additions and 5 deletions

View file

@ -158,6 +158,7 @@ pub struct TerminalSettings {
pub dock: TerminalDockPosition,
pub default_width: f32,
pub default_height: f32,
pub automatically_activate_python_virtual_environment: bool,
}
#[derive(Clone, Debug, Default, Serialize, Deserialize, JsonSchema)]
@ -176,6 +177,7 @@ pub struct TerminalSettingsContent {
pub dock: Option<TerminalDockPosition>,
pub default_width: Option<f32>,
pub default_height: Option<f32>,
pub automatically_activate_python_virtual_environment: Option<bool>,
}
impl TerminalSettings {
@ -1018,6 +1020,10 @@ impl Terminal {
self.pty_tx.notify(input.into_bytes());
}
fn write_bytes_to_pty(&self, input: Vec<u8>) {
self.pty_tx.notify(input);
}
pub fn input(&mut self, input: String) {
self.events
.push_back(InternalEvent::Scroll(AlacScroll::Bottom));
@ -1026,6 +1032,14 @@ impl Terminal {
self.write_to_pty(input);
}
pub fn input_bytes(&mut self, input: Vec<u8>) {
self.events
.push_back(InternalEvent::Scroll(AlacScroll::Bottom));
self.events.push_back(InternalEvent::SetSelection(None));
self.write_bytes_to_pty(input);
}
pub fn try_keystroke(&mut self, keystroke: &Keystroke, alt_is_meta: bool) -> bool {
let esc = to_esc_str(keystroke, &self.last_content.mode, alt_is_meta);
if let Some(esc) = esc {