Commit e76442a5 authored by Waqar Ahmed's avatar Waqar Ahmed Committed by Tomaz Canabrava
Browse files

Vt102Emulation: Process common case first

parent 55578408
Pipeline #108613 passed with stage
in 2 minutes and 1 second
......@@ -330,7 +330,6 @@ void Vt102Emulation::initTokenizer()
/* clang-format off */
#define lec(P,L,C) (p == (P) && s[(L)] == (C))
#define lun( ) (p == 1 && cc >= 32 )
#define les(P,L,C) (p == (P) && s[L] < 256 && (charClass[s[(L)]] & (C)) == (C))
#define eec(C) (p >= 3 && cc == (C))
#define ees(C) (p >= 3 && cc < 256 && (charClass[cc] & (C)) == (C))
......@@ -360,6 +359,12 @@ void Vt102Emulation::receiveChars(const QVector<uint> &chars)
continue; // VT100: ignore.
}
// early out for displayable characters
if (getMode(MODE_Ansi) && tokenBufferPos == 0 && cc >= 32 && cc != (ESC + 128)) {
_currentScreen->displayCharacter(applyCharset(cc));
continue;
}
if (ces(CTL)) {
// ignore control characters in the text part of osc (aka OSC) "ESC]"
// escape sequences; this matches what XTERM docs say
......@@ -442,7 +447,6 @@ void Vt102Emulation::receiveChars(const QVector<uint> &chars)
if (lec(3,2,'!')) { continue; }
if (lec(3,2,SP )) { continue; }
if (lec(4,3,SP )) { continue; }
if (lun( )) { processToken(token_chr(), applyCharset(cc), 0); resetTokenizer(); continue; }
if (dcs ) { continue; /* TODO We don't xterm DCS, so we just eat it */ }
if (lec(2,0,ESC)) { processToken(token_esc(s[1]), 0, 0); resetTokenizer(); continue; }
if (les(3,1,SCS)) { processToken(token_esc_cs(s[1],s[2]), 0, 0); resetTokenizer(); continue; }
......
......@@ -120,8 +120,8 @@ private:
void resetTokenizer();
#define MAX_TOKEN_LENGTH 256 // Max length of tokens (e.g. window title)
void addToCurrentToken(uint cc);
uint tokenBuffer[MAX_TOKEN_LENGTH]; // FIXME: overflow?
int tokenBufferPos;
uint tokenBuffer[MAX_TOKEN_LENGTH]; // FIXME: overflow?
#define MAXARGS 15
void addDigit(int dig);
void addArgument();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment