diff --git a/src/gliumwindows.rs b/src/gliumwindows.rs index e15fe67e9..66eee08c0 100644 --- a/src/gliumwindows.rs +++ b/src/gliumwindows.rs @@ -638,6 +638,32 @@ impl GliumTerminalWindow { return Ok(()); } + if mods == KeyModifiers::ALT + && (key == KeyCode::Char('\r') + || key == KeyCode::Char('\n') + || key == KeyCode::Enter) + { + self.host.toggle_full_screen(); + return Ok(()); + } + + if cfg!(target_os = "macos") + && mods == KeyModifiers::SUPER + && key == KeyCode::Char('c') + { + // Nominally copy, but that is implicit, so NOP + return Ok(()); + } + if (cfg!(target_os = "macos") + && mods == KeyModifiers::SUPER + && key == KeyCode::Char('v')) + || (mods == KeyModifiers::SHIFT && key == KeyCode::Insert) + { + tab.terminal() + .send_paste(&self.host.get_clipboard()?, &mut *tab.pty())?; + return Ok(()); + } + tab.terminal().key_down( key, mods, diff --git a/src/xwindows/xwin.rs b/src/xwindows/xwin.rs index dd8aa3aa7..17bdf9eb8 100644 --- a/src/xwindows/xwin.rs +++ b/src/xwindows/xwin.rs @@ -240,6 +240,13 @@ impl X11TerminalWindow { self.host.with_window(|win| win.spawn_tab().map(|_| ())); return Ok(()); } + + if mods == KeyModifiers::SHIFT && key == KeyCode::Insert { + tab.terminal() + .send_paste(&self.host.get_clipboard()?, &mut *tab.pty())?; + return Ok(()); + } + tab.terminal().key_down( code, mods, diff --git a/term/src/terminalstate.rs b/term/src/terminalstate.rs index 73c12a14a..aea54304d 100644 --- a/term/src/terminalstate.rs +++ b/term/src/terminalstate.rs @@ -671,6 +671,19 @@ impl TerminalState { Ok(()) } + /// Send text to the terminal that is the result of pasting. + /// If bracketed paste mode is enabled, the paste is enclosed + /// in the bracketing, otherwise it is fed to the pty as-is. + pub fn send_paste(&mut self, text: &str, writer: &mut std::io::Write) -> Result<(), Error> { + if self.bracketed_paste { + let buf = format!("\x1b[200~{}\x1b[201~", text); + write_all(writer, buf.as_bytes())?; + } else { + write_all(writer, text.as_bytes())?; + } + Ok(()) + } + /// Processes a key_down event generated by the gui/render layer /// that is embedding the Terminal. This method translates the /// keycode into a sequence of bytes to send to the slave end