Commit a8842603 authored by Kurt Hindenburg's avatar Kurt Hindenburg

readability fixes - braces

parent 068daf47
...@@ -300,8 +300,9 @@ const int DEL = 127; ...@@ -300,8 +300,9 @@ const int DEL = 127;
// process an incoming unicode character // process an incoming unicode character
void Vt102Emulation::receiveChar(int cc) void Vt102Emulation::receiveChar(int cc)
{ {
if (cc == DEL) if (cc == DEL) {
return; //VT100: ignore. return; //VT100: ignore.
}
if (ces(CTL)) if (ces(CTL))
{ {
...@@ -309,8 +310,9 @@ void Vt102Emulation::receiveChar(int cc) ...@@ -309,8 +310,9 @@ void Vt102Emulation::receiveChar(int cc)
// This means, they do neither a resetTokenizer() nor a pushToToken(). Some of them, do // This means, they do neither a resetTokenizer() nor a pushToToken(). Some of them, do
// of course. Guess this originates from a weakly layered handling of the X-on // of course. Guess this originates from a weakly layered handling of the X-on
// X-off protocol, which comes really below this level. // X-off protocol, which comes really below this level.
if (cc == CNTL('X') || cc == CNTL('Z') || cc == ESC) if (cc == CNTL('X') || cc == CNTL('Z') || cc == ESC) {
resetTokenizer(); //VT100: CAN or SUB resetTokenizer(); //VT100: CAN or SUB
}
if (cc != ESC) if (cc != ESC)
{ {
processToken(TY_CTL(cc+'@' ),0,0); processToken(TY_CTL(cc+'@' ),0,0);
...@@ -353,11 +355,11 @@ void Vt102Emulation::receiveChar(int cc) ...@@ -353,11 +355,11 @@ void Vt102Emulation::receiveChar(int cc)
if (eec(';')) { addArgument(); return; } if (eec(';')) { addArgument(); return; }
for (int i = 0; i <= argc; i++) for (int i = 0; i <= argc; i++)
{ {
if (epp()) if (epp()) {
processToken(TY_CSI_PR(cc,argv[i]), 0, 0); processToken(TY_CSI_PR(cc,argv[i]), 0, 0);
else if (egt()) } else if (egt()) {
processToken(TY_CSI_PG(cc), 0, 0); // spec. case for ESC]>0c or ESC]>c processToken(TY_CSI_PG(cc), 0, 0); // spec. case for ESC]>0c or ESC]>c
else if (cc == 'm' && argc - i >= 4 && (argv[i] == 38 || argv[i] == 48) && argv[i+1] == 2) } else if (cc == 'm' && argc - i >= 4 && (argv[i] == 38 || argv[i] == 48) && argv[i+1] == 2)
{ {
// ESC[ ... 48;2;<red>;<green>;<blue> ... m -or- ESC[ ... 38;2;<red>;<green>;<blue> ... m // ESC[ ... 48;2;<red>;<green>;<blue> ... m -or- ESC[ ... 38;2;<red>;<green>;<blue> ... m
i += 2; i += 2;
...@@ -369,27 +371,28 @@ void Vt102Emulation::receiveChar(int cc) ...@@ -369,27 +371,28 @@ void Vt102Emulation::receiveChar(int cc)
// ESC[ ... 48;5;<index> ... m -or- ESC[ ... 38;5;<index> ... m // ESC[ ... 48;5;<index> ... m -or- ESC[ ... 38;5;<index> ... m
i += 2; i += 2;
processToken(TY_CSI_PS(cc, argv[i-2]), COLOR_SPACE_256, argv[i]); processToken(TY_CSI_PS(cc, argv[i-2]), COLOR_SPACE_256, argv[i]);
} } else {
else
processToken(TY_CSI_PS(cc,argv[i]), 0, 0); processToken(TY_CSI_PS(cc,argv[i]), 0, 0);
}
} }
resetTokenizer(); resetTokenizer();
} } else {
else
{
// VT52 Mode // VT52 Mode
if (lec(1,0,ESC)) if (lec(1,0,ESC)) {
return; return;
}
if (les(1,0,CHR)) if (les(1,0,CHR))
{ {
processToken( TY_CHR(), s[0], 0); processToken( TY_CHR(), s[0], 0);
resetTokenizer(); resetTokenizer();
return; return;
} }
if (lec(2,1,'Y')) if (lec(2,1,'Y')) {
return; return;
if (lec(3,1,'Y')) }
if (lec(3,1,'Y')) {
return; return;
}
if (p < 4) if (p < 4)
{ {
processToken(TY_VT52(s[1] ), 0, 0); processToken(TY_VT52(s[1] ), 0, 0);
...@@ -423,8 +426,9 @@ void Vt102Emulation::processWindowAttributeRequest() ...@@ -423,8 +426,9 @@ void Vt102Emulation::processWindowAttributeRequest()
QString value; QString value;
value.reserve(tokenBufferPos-i-2); value.reserve(tokenBufferPos-i-2);
for (int j = 0; j < tokenBufferPos-i-2; j++) for (int j = 0; j < tokenBufferPos-i-2; j++) {
value[j] = tokenBuffer[i+1+j]; value[j] = tokenBuffer[i+1+j];
}
if (value == QLatin1String("?")) { if (value == QLatin1String("?")) {
emit sessionAttributeRequest(attribute); emit sessionAttributeRequest(attribute);
...@@ -882,19 +886,21 @@ void Vt102Emulation::reportTerminalType() ...@@ -882,19 +886,21 @@ void Vt102Emulation::reportTerminalType()
// VT100: ^[[?1;2c // VT100: ^[[?1;2c
// VT101: ^[[?1;0c // VT101: ^[[?1;0c
// VT102: ^[[?6v // VT102: ^[[?6v
if (getMode(MODE_Ansi)) if (getMode(MODE_Ansi)) {
sendString("\033[?1;2c"); // I'm a VT100 sendString("\033[?1;2c"); // I'm a VT100
else } else {
sendString("\033/Z"); // I'm a VT52 sendString("\033/Z"); // I'm a VT52
}
} }
void Vt102Emulation::reportSecondaryAttributes() void Vt102Emulation::reportSecondaryAttributes()
{ {
// Secondary device attribute response (Request was: ^[[>0c or ^[[>c) // Secondary device attribute response (Request was: ^[[>0c or ^[[>c)
if (getMode(MODE_Ansi)) if (getMode(MODE_Ansi)) {
sendString("\033[>0;115;0c"); // Why 115? ;) sendString("\033[>0;115;0c"); // Why 115? ;)
else } else {
sendString("\033/Z"); // FIXME I don't think VT52 knows about it but kept for sendString("\033/Z"); // FIXME I don't think VT52 knows about it but kept for
}
// konsoles backward compatibility. // konsoles backward compatibility.
} }
...@@ -1101,31 +1107,28 @@ void Vt102Emulation::sendKeyEvent(QKeyEvent *event) ...@@ -1101,31 +1107,28 @@ void Vt102Emulation::sendKeyEvent(QKeyEvent *event)
if ((entry.command() & KeyboardTranslator::EraseCommand) != 0) { if ((entry.command() & KeyboardTranslator::EraseCommand) != 0) {
textToSend += eraseChar(); textToSend += eraseChar();
} else if ((entry.command() & KeyboardTranslator::ScrollPageUpCommand) != 0) } else if ((entry.command() & KeyboardTranslator::ScrollPageUpCommand) != 0) {
currentView->scrollScreenWindow(ScreenWindow::ScrollPages, -1); currentView->scrollScreenWindow(ScreenWindow::ScrollPages, -1);
else if ((entry.command() & KeyboardTranslator::ScrollPageDownCommand) != 0) } else if ((entry.command() & KeyboardTranslator::ScrollPageDownCommand) != 0) {
currentView->scrollScreenWindow(ScreenWindow::ScrollPages, 1); currentView->scrollScreenWindow(ScreenWindow::ScrollPages, 1);
else if ((entry.command() & KeyboardTranslator::ScrollLineUpCommand) != 0) } else if ((entry.command() & KeyboardTranslator::ScrollLineUpCommand) != 0) {
currentView->scrollScreenWindow(ScreenWindow::ScrollLines, -1); currentView->scrollScreenWindow(ScreenWindow::ScrollLines, -1);
else if ((entry.command() & KeyboardTranslator::ScrollLineDownCommand) != 0) } else if ((entry.command() & KeyboardTranslator::ScrollLineDownCommand) != 0) {
currentView->scrollScreenWindow(ScreenWindow::ScrollLines, 1); currentView->scrollScreenWindow(ScreenWindow::ScrollLines, 1);
else if ((entry.command() & KeyboardTranslator::ScrollUpToTopCommand) != 0) } else if ((entry.command() & KeyboardTranslator::ScrollUpToTopCommand) != 0) {
currentView->scrollScreenWindow(ScreenWindow::ScrollLines, currentView->scrollScreenWindow(ScreenWindow::ScrollLines,
- currentView->screenWindow()->currentLine()); - currentView->screenWindow()->currentLine());
else if ((entry.command() & KeyboardTranslator::ScrollDownToBottomCommand) != 0) } else if ((entry.command() & KeyboardTranslator::ScrollDownToBottomCommand) != 0) {
currentView->scrollScreenWindow(ScreenWindow::ScrollLines, lineCount()); currentView->scrollScreenWindow(ScreenWindow::ScrollLines, lineCount());
} }
else if (!entry.text().isEmpty()) } else if (!entry.text().isEmpty()) {
{
textToSend += entry.text(true,modifiers); textToSend += entry.text(true,modifiers);
} } else {
else
textToSend += _codec->fromUnicode(event->text()); textToSend += _codec->fromUnicode(event->text());
}
emit sendData(textToSend); emit sendData(textToSend);
} } else {
else
{
// print an error message to the terminal if no key translator has been // print an error message to the terminal if no key translator has been
// set // set
QString translatorError = i18n("No keyboard translator available. " QString translatorError = i18n("No keyboard translator available. "
......
Markdown is supported
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