Commit 68a98ed7 authored by Kurt Hindenburg's avatar Kurt Hindenburg
Browse files

Add support for ANSI SGR escape code 3 (italics)

Adds support for escape sequences \e[3m and \e[23m (to turn italics on
and off respectively).
http://en.wikipedia.org/wiki/ANSI_escape_code#CSI_codes

Patch by Jem Orgun jeorgun@gmail.com
FEATURE: 314410
REVIEW: 108844
FIXED-IN: 4.11
parent 340cfba5
......@@ -41,8 +41,9 @@ const int RE_BLINK = (1 << 1);
const int RE_UNDERLINE = (1 << 2);
const int RE_REVERSE = (1 << 3); // Screen only
const int RE_INTENSIVE = (1 << 3); // Widget only
const int RE_CURSOR = (1 << 4);
const int RE_EXTENDED_CHAR = (1 << 5);
const int RE_ITALIC = (1 << 4);
const int RE_CURSOR = (1 << 5);
const int RE_EXTENDED_CHAR = (1 << 6);
/**
* Unicode character in the range of U+2500 ~ U+257F are known as line
......
......@@ -696,12 +696,15 @@ void TerminalDisplay::drawCharacters(QPainter& painter,
else
useBold = (weight == ColorEntry::Bold) ? true : false;
const bool useUnderline = style->rendition & RE_UNDERLINE || font().underline();
const bool useItalic = style->rendition & RE_ITALIC || font().italic();
QFont font = painter.font();
if (font.bold() != useBold
|| font.underline() != useUnderline) {
|| font.underline() != useUnderline
|| font.italic() != useItalic) {
font.setBold(useBold);
font.setUnderline(useUnderline);
font.setItalic(useItalic);
painter.setFont(font);
}
......
......@@ -570,6 +570,7 @@ void Vt102Emulation::processToken(int token, int p, int q)
case TY_CSI_PS('m', 0) : _currentScreen->setDefaultRendition ( ); break;
case TY_CSI_PS('m', 1) : _currentScreen-> setRendition (RE_BOLD ); break; //VT100
case TY_CSI_PS('m', 3) : _currentScreen-> setRendition (RE_ITALIC ); break; //VT100
case TY_CSI_PS('m', 4) : _currentScreen-> setRendition (RE_UNDERLINE); break; //VT100
case TY_CSI_PS('m', 5) : _currentScreen-> setRendition (RE_BLINK ); break; //VT100
case TY_CSI_PS('m', 7) : _currentScreen-> setRendition (RE_REVERSE ); break;
......@@ -577,6 +578,7 @@ void Vt102Emulation::processToken(int token, int p, int q)
case TY_CSI_PS('m', 11) : /* IGNORED: mapping related */ break; //LINUX
case TY_CSI_PS('m', 12) : /* IGNORED: mapping related */ break; //LINUX
case TY_CSI_PS('m', 22) : _currentScreen->resetRendition (RE_BOLD ); break;
case TY_CSI_PS('m', 23) : _currentScreen->resetRendition (RE_ITALIC ); break; //VT100
case TY_CSI_PS('m', 24) : _currentScreen->resetRendition (RE_UNDERLINE); break;
case TY_CSI_PS('m', 25) : _currentScreen->resetRendition (RE_BLINK ); break;
case TY_CSI_PS('m', 27) : _currentScreen->resetRendition (RE_REVERSE ); break;
......
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