diff --git a/src/terminal/terminaldisplay.cc b/src/terminal/terminaldisplay.cc index c44952857..9600119e4 100644 --- a/src/terminal/terminaldisplay.cc +++ b/src/terminal/terminaldisplay.cc @@ -104,7 +104,7 @@ std::string Display::new_frame( bool initialized, const Framebuffer& last, const /* has clipboard changed? */ if ( f.get_clipboard() != frame.last_frame.get_clipboard() ) { - frame.append( "\033]52;c;" ); + frame.append( "\033]52;" ); const title_type& clipboard( f.get_clipboard() ); for ( title_type::const_iterator i = clipboard.begin(); i != clipboard.end(); i++ ) { frame.append( *i ); diff --git a/src/terminal/terminalfunctions.cc b/src/terminal/terminalfunctions.cc index 40c41afc4..6c593e07b 100644 --- a/src/terminal/terminalfunctions.cc +++ b/src/terminal/terminalfunctions.cc @@ -591,10 +591,13 @@ static Function func_CSI_DECSTR( CSI, "!p", CSI_DECSTR ); /* xterm uses an Operating System Command to set the window title */ void Dispatcher::OSC_dispatch( const Parser::OSC_End* act __attribute( ( unused ) ), Framebuffer* fb ) { - /* handle osc copy clipboard sequence 52;c; */ - if ( OSC_string.size() >= 5 && OSC_string[0] == L'5' && OSC_string[1] == L'2' && OSC_string[2] == L';' - && OSC_string[3] == L'c' && OSC_string[4] == L';' ) { - Terminal::Framebuffer::title_type clipboard( OSC_string.begin() + 5, OSC_string.end() ); + /* Handle OSC copy clipboard sequence 52;c; and variants */ + if ( OSC_string.size() >= 5 && OSC_string[0] == L'5' && OSC_string[1] == L'2' && OSC_string[2] == L';') { + /* Capture the options and clipboard contents + e.g. '52;c;bW9zaCBpcyBncmVhdAo=' + ^^^^^^^^^^^^^^^^^^^^^^^ + capture this part */ + Terminal::Framebuffer::title_type clipboard( OSC_string.begin() + 3, OSC_string.end() ); fb->set_clipboard( clipboard ); /* handle osc terminal title sequence */ } else if ( OSC_string.size() >= 1 ) {