[Konsole-devel] [konsole] [Bug 344977] New: Escape sequence causes konsole to reset to default

Marc Paradise marc.paradise at gmail.com
Mon Mar 9 14:52:03 UTC 2015


https://bugs.kde.org/show_bug.cgi?id=344977

            Bug ID: 344977
           Summary: Escape sequence causes konsole to reset to default
           Product: konsole
           Version: unspecified
          Platform: Ubuntu Packages
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: emulation
          Assignee: konsole-devel at kde.org
          Reporter: marc.paradise at gmail.com

The following escape sequence will cause Konsole to reset to current profile
defaults: 

printf '\033]50;anything\007\033\\'

This escape sequence is commonly used in vim to change cursor shape (in that
case replace 'anything' with CursorShape=1 or CursorShape=0)

I think I've been able to track this one down. 

This is likely related to #323227 

TLDR: 

Here we see UserTitleChange::ProfileCHange enum value of 50: 
https://projects.kde.org/projects/kde/applications/konsole/repository/revisions/master/entry/src/Session.h#L358

I am not set up to build or test Konsole, or I'd submit a patch for this, but I
*think* that finding a safe(?) value for ProfileChange attribute -  perhaps
something > 255 since an escape sequence should never triggers this -  will
resolve it. 

More details: 

In Vt102Emulation.cpp, first: 
https://projects.kde.org/projects/kde/applications/konsole/repository/revisions/master/entry/src/Vt102Emulation.cpp#L282
: 

#define Xpe  (tokenBufferPos >= 2 && tokenBuffer[1] == ']') // evals true in
this case 
#define Xte (Xpe && cc = 7)  // evals true in this case 

And then in receiveChar:


https://projects.kde.org/projects/kde/applications/konsole/repository/revisions/master/entry/src/Vt102Emulation.cpp#L321

// Xte evals true in this case 
if (Xte         ) { processWindowAttributeChange(); resetTokenizer(); return; }

processWindowAttributeChange looks at the token buffer which is: 
//  '\033]50;anything\007\033\\'

[0] = ESC
[1] = ']'
[2] = '5' 
[3] = '0' 
[4] = ';'

Assigns attributeToChange = 50

This then gets emitted in a titleUpdate - and the changed attribute now
corresponds to the ProfileChange attribute.  Session sees that it changed and
does what it thinks is correct - calls for a reset of the profile.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the konsole-devel mailing list