* Escape codes to force line breaks to be ignored.

This commit is contained in:
Eelco Dolstra 2004-03-18 21:32:15 +00:00
parent 3f3c4cce5a
commit e6253b58cd
1 changed files with 9 additions and 1 deletions

View File

@ -15,6 +15,7 @@ struct Decoder
vector<int> args; vector<int> args;
bool newNumber; bool newNumber;
int priority; int priority;
bool ignoreLF;
Decoder() Decoder()
{ {
@ -23,6 +24,7 @@ struct Decoder
inHeader = false; inHeader = false;
level = 0; level = 0;
priority = 1; priority = 1;
ignoreLF = false;
} }
void pushChar(char c); void pushChar(char c);
@ -38,7 +40,7 @@ void Decoder::pushChar(char c)
case stTop: case stTop:
if (c == '\e') { if (c == '\e') {
state = stEscape; state = stEscape;
} else if (c == '\n') { } else if (c == '\n' && !ignoreLF) {
finishLine(); finishLine();
} else line += c; } else line += c;
break; break;
@ -75,6 +77,12 @@ void Decoder::pushChar(char c)
if (line.size()) finishLine(); if (line.size()) finishLine();
priority = args.size() >= 1 ? args[0] : 1; priority = args.size() >= 1 ? args[0] : 1;
break; break;
case 'a':
ignoreLF = true;
break;
case 'b':
ignoreLF = false;
break;
} }
} else if (c >= '0' && c <= '9') { } else if (c >= '0' && c <= '9') {
int n = 0; int n = 0;