diff --git a/src/terminal/terminaldisplay.cc b/src/terminal/terminaldisplay.cc index e7595c248..7f508efd7 100644 --- a/src/terminal/terminaldisplay.cc +++ b/src/terminal/terminaldisplay.cc @@ -112,7 +112,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(); diff --git a/src/terminal/terminalfunctions.cc b/src/terminal/terminalfunctions.cc index ca141dd35..ca59841bf 100644 --- a/src/terminal/terminalfunctions.cc +++ b/src/terminal/terminalfunctions.cc @@ -591,12 +591,15 @@ 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; */ + /* 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';' && - OSC_string[ 3 ] == L'c' && OSC_string[ 4 ] == L';') { + 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() + 5, OSC_string.end() ); + OSC_string.begin() + 3, OSC_string.end() ); fb->set_clipboard( clipboard ); /* handle osc terminal title sequence */ } else if ( OSC_string.size() >= 1 ) {