From b448cfec4dd86c301fd9d02433a388ef4224a245 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Fri, 22 Feb 2019 20:31:04 -0800 Subject: [PATCH] fix shift-insert for paste on linux the match guard was applying to both arms, so break this into two separate matches --- term/src/terminalstate.rs | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/term/src/terminalstate.rs b/term/src/terminalstate.rs index 8e7de6f0f..9f9fad30a 100644 --- a/term/src/terminalstate.rs +++ b/term/src/terminalstate.rs @@ -735,6 +735,18 @@ impl TerminalState { } } + macro_rules! paste { + () => {{ + let clip = host.get_clipboard()?; + if self.bracketed_paste { + write!(buf, "\x1b[200~{}\x1b[201~", clip)?; + } else { + buf = clip; + } + buf.as_str() + }}; + } + let to_send = match (key, ctrl, alt, shift, self.application_cursor_keys) { (Char('\n'), _, ALT, ..) => { host.toggle_full_screen(); @@ -747,15 +759,8 @@ impl TerminalState { // Delete (Char('\x7f'), _, _, _, false) | (Delete, _, _, _, false) => "\x7f", (Char('\x7f'), ..) | (Delete, ..) => "\x1b[3~", - (Insert, _, _, SHIFT, _) | (Char('v'), ..) if mods == KeyModifiers::SUPER => { - let clip = host.get_clipboard()?; - if self.bracketed_paste { - write!(buf, "\x1b[200~{}\x1b[201~", clip)?; - } else { - buf = clip; - } - buf.as_str() - } + (Insert, _, _, SHIFT, _) => paste!(), + (Char('v'), ..) if mods == KeyModifiers::SUPER => paste!(), (Char(c), CTRL, _, SHIFT, _) if c <= 0xff as char && c > 0x40 as char => { // If shift is held we have C == 0x43 and want to translate