Add rendition flags SGRs 2, 8, 9, 53

Adds faint intensity, strikeout, conceal and overline support.

echo -e 'D\e[2mD\e[9mD\e[53mD\e[8mD'

Thanks to Antonio Russo antonio e russo gmail com for patch

REVIEW: 128405
BUG: 362171
This commit is contained in:
Kurt Hindenburg
2016-07-16 12:34:24 -04:00
parent f3ce85b9ef
commit 84b43dfb21
23 changed files with 524 additions and 66 deletions

View File

@@ -4,54 +4,81 @@ Color=255,255,221
[BackgroundIntense]
Color=255,255,221
[BackgroundFaint]
Color=255,255,221
[Color0]
Color=0,0,0
[Color0Intense]
Color=104,104,104
[Color0Faint]
Color=192,192,192
[Color1]
Color=178,24,24
[Color1Intense]
Color=255,84,84
[Color1Faint]
Color=224,142,142
[Color2]
Color=24,178,24
[Color2Intense]
Color=84,255,84
[Color2Faint]
Color=142,224,142
[Color3]
Color=178,104,24
[Color3Intense]
Color=255,255,84
[Color3Faint]
Color=224,224,142
[Color4]
Color=24,24,178
[Color4Intense]
Color=84,84,255
[Color4Faint]
Color=142,142,224
[Color5]
Color=178,24,178
[Color5Intense]
Color=255,84,255
[Color5Faint]
Color=224,142,224
[Color6]
Color=24,178,178
[Color6Intense]
Color=84,255,255
[Color6Faint]
Color=142,224,224
[Color7]
Color=178,178,178
[Color7Intense]
Color=255,255,255
[Color7Faint]
Color=142,142,142
[Foreground]
Color=0,0,0
@@ -59,6 +86,9 @@ Color=0,0,0
Bold=true
Color=0,0,0
[ForegroundFaint]
Color=0,0,0
[General]
Description=Black on Light Yellow
Opacity=1

View File

@@ -5,54 +5,81 @@ MaxRandomHue=340
[BackgroundIntense]
Color=255,255,221
[BackgroundFaint]
Color=247,247,214
[Color0]
Color=0,0,0
[Color0Intense]
Color=104,104,104
[Color0Faint]
Color=192,192,192
[Color1]
Color=178,24,24
[Color1Intense]
Color=255,84,84
[Color1Faint]
Color=224,142,142
[Color2]
Color=24,178,24
[Color2Intense]
Color=84,255,84
[Color2Faint]
Color=142,224,142
[Color3]
Color=178,104,24
[Color3Intense]
Color=255,255,84
[Color3Faint]
Color=224,224,142
[Color4]
Color=24,24,178
[Color4Intense]
Color=84,84,255
[Color4Faint]
Color=142,142,224
[Color5]
Color=178,24,178
[Color5Intense]
Color=255,84,255
[Color5Faint]
Color=224,142,224
[Color6]
Color=24,178,178
[Color6Intense]
Color=84,255,255
[Color6Faint]
Color=142,224,224
[Color7]
Color=178,178,178
[Color7Intense]
Color=255,255,255
[Color7Faint]
Color=142,142,142
[Foreground]
Color=0,0,0
@@ -60,6 +87,9 @@ Color=0,0,0
Bold=true
Color=0,0,0
[ForegroundFaint]
Color=0,0,0
[General]
Description=Black on Random Light
Opacity=1

View File

@@ -4,54 +4,81 @@ Color=255,255,255
[BackgroundIntense]
Color=255,255,255
[BackgroundFaint]
Color=255,255,255
[Color0]
Color=0,0,0
[Color0Intense]
Color=104,104,104
[Color0Faint]
Color=192,192,192
[Color1]
Color=178,24,24
[Color1Intense]
Color=255,84,84
[Color1Faint]
Color=224,142,142
[Color2]
Color=24,178,24
[Color2Intense]
Color=84,255,84
[Color2Faint]
Color=142,224,142
[Color3]
Color=178,104,24
[Color3Intense]
Color=255,255,84
[Color3Faint]
Color=224,224,142
[Color4]
Color=24,24,178
[Color4Intense]
Color=84,84,255
[Color4Faint]
Color=142,142,224
[Color5]
Color=178,24,178
[Color5Intense]
Color=255,84,255
[Color5Faint]
Color=224,142,224
[Color6]
Color=24,178,178
[Color6Intense]
Color=84,255,255
[Color6Faint]
Color=142,224,224
[Color7]
Color=178,178,178
[Color7Intense]
Color=255,255,255
[Color7Faint]
Color=142,142,142
[Foreground]
Color=0,0,0
@@ -59,6 +86,9 @@ Color=0,0,0
Bold=true
Color=0,0,0
[ForegroundFaint]
Color=0,0,0
[General]
Description=Black on White
Opacity=1

View File

@@ -4,54 +4,81 @@ Color=0,0,0
[BackgroundIntense]
Color=0,0,0
[BackgroundFaint]
Color=0,0,0
[Color0]
Color=0,0,0
[Color0Intense]
Color=104,104,104
[Color0Faint]
Color=192,192,192
[Color1]
Color=250,0,0
[Color1Intense]
Color=75,93,255
[Color1Faint]
Color=250,0,0
[Color2]
Color=24,178,24
[Color2Intense]
Color=84,255,84
[Color2Faint]
Color=142,224,142
[Color3]
Color=178,104,24
[Color3Intense]
Color=255,255,84
[Color3Faint]
Color=224,224,142
[Color4]
Color=125,152,35
[Color4Intense]
Color=84,84,255
[Color4Faint]
Color=125,152,35
[Color5]
Color=225,30,225
[Color5Intense]
Color=255,84,255
[Color5Faint]
Color=175,29,175
[Color6]
Color=0,134,223
[Color6Intense]
Color=0,68,255
[Color6Faint]
Color=0,98,173
[Color7]
Color=255,255,255
[Color7Intense]
Color=50,50,50
[Color7Faint]
Color=200,200,200
[Foreground]
Color=0,119,255
@@ -59,6 +86,9 @@ Color=0,119,255
Bold=true
Color=23,74,240
[ForegroundFaint]
Color=0,90,195
[General]
Description=Blue on Black
Opacity=1

View File

@@ -7,60 +7,90 @@ MaxRandomValue=0
[BackgroundIntense]
Color=35,38,41
[BackgroundFaint]
Color=49,54,59
[Color0]
Color=7,54,66
[Color0Intense]
Color=0,43,54
[Color0Faint]
Color=32,43,54
[Color1]
Color=237,21,21
[Color1Intense]
Color=192,57,43
[Color1Faint]
Color=120,50,40
[Color2]
Color=17,209,22
[Color2Intense]
Color=28,220,154
[Color2Faint]
Color=23,162,98
[Color3]
Color=246,116,0
[Color3Intense]
Color=253,188,75
[Color3Faint]
Color=182,86,25
[Color4]
Color=29,153,243
[Color4Intense]
Color=61,174,233
[Color4Faint]
Color=27,102,143
[Color5]
Color=155,89,182
[Color5Intense]
Color=142,68,173
[Color5Faint]
Color=97,74,115
[Color6]
Color=26,188,156
[Color6Intense]
Color=22,160,133
[Color6Faint]
Color=24,108,96
[Color7]
Color=239,240,241
[Color7Intense]
Color=252,252,252
[Color7Faint]
Color=99,104,109
[Foreground]
Color=239,240,241
[ForegroundIntense]
Color=252,252,252
[ForegroundFaint]
Color=220,230,231
[General]
Description=Breeze
Opacity=1

View File

@@ -5,6 +5,9 @@ Color=44,44,44
Bold=true
Color=44,44,44
[BackgroundFaint]
Color=44,44,44
[Color0]
Color=63,63,63
@@ -12,6 +15,9 @@ Color=63,63,63
Bold=true
Color=112,144,128
[Color0Faint]
Color=52,52,52
[Color1]
Color=112,80,80
@@ -19,6 +25,9 @@ Color=112,80,80
Bold=true
Color=220,163,163
[Color1Faint]
Color=102,72,72
[Color2]
Color=96,180,138
@@ -26,6 +35,9 @@ Color=96,180,138
Bold=true
Color=114,213,163
[Color2Faint]
Color=87,163,124
[Color3]
Color=223,175,143
@@ -33,6 +45,9 @@ Color=223,175,143
Bold=true
Color=240,223,175
[Color3Faint]
Color=170,133,111
[Color4]
Color=154,184,215
@@ -40,6 +55,9 @@ Color=154,184,215
Bold=true
Color=148,191,243
[Color4Faint]
Color=117,141,161
[Color5]
Color=220,140,195
@@ -47,6 +65,9 @@ Color=220,140,195
Bold=true
Color=236,147,211
[Color5Faint]
Color=154,98,137
[Color6]
Color=140,208,211
@@ -54,6 +75,9 @@ Color=140,208,211
Bold=true
Color=147,224,227
[Color6Faint]
Color=107,159,161
[Color7]
Color=220,220,204
@@ -61,6 +85,9 @@ Color=220,220,204
Bold=true
Color=255,255,255
[Color7Faint]
Color=149,149,139
[Foreground]
Color=220,220,204
@@ -68,6 +95,9 @@ Color=220,220,204
Bold=true
Color=220,220,204
[ForegroundFaint]
Color=220,220,204
[General]
Description=Dark Pastels
Opacity=1

View File

@@ -4,54 +4,81 @@ Color=0,0,0
[BackgroundIntense]
Color=0,0,0
[BackgroundFaint]
Color=0,0,0
[Color0]
Color=0,0,0
[Color0Intense]
Color=104,104,104
[Color0Faint]
Color=24,24,24
[Color1]
Color=250,75,75
[Color1Intense]
Color=255,84,84
[Color1Faint]
Color=101,25,25
[Color2]
Color=24,178,24
[Color2Intense]
Color=84,255,84
[Color2Faint]
Color=0,101,0
[Color3]
Color=178,104,24
[Color3Intense]
Color=255,255,84
[Color3Faint]
Color=101,74,0
[Color4]
Color=24,24,178
[Color4Intense]
Color=84,84,255
[Color4Faint]
Color=0,0,101
[Color5]
Color=225,30,225
[Color5Intense]
Color=255,84,255
[Color5Faint]
Color=95,5,95
[Color6]
Color=24,178,178
[Color6Intense]
Color=84,255,255
[Color6Faint]
Color=0,101,101
[Color7]
Color=178,178,178
[Color7Intense]
Color=255,255,255
[Color7Faint]
Color=101,101,101
[Foreground]
Color=24,240,24
@@ -59,6 +86,9 @@ Color=24,240,24
Bold=true
Color=24,240,24
[ForegroundFaint]
Color=18,200,18
[General]
Description=Green on Black
Opacity=1

View File

@@ -4,59 +4,89 @@ Color=0,0,0
[BackgroundIntense]
Color=104,104,104
[BackgroundFaint]
Color=0,0,0
[Color0]
Color=0,0,0
[Color0Intense]
Color=104,104,104
[Color0Faint]
Color=24,24,24
[Color1]
Color=178,24,24
[Color1Intense]
Color=255,84,84
[Color1Faint]
Color=101,0,0
[Color2]
Color=24,178,24
[Color2Intense]
Color=84,255,84
[Color2Faint]
Color=0,101,0
[Color3]
Color=178,104,24
[Color3Intense]
Color=255,255,84
[Color3Faint]
Color=101,94,0
[Color4]
Color=24,24,178
[Color4Intense]
Color=84,84,255
[Color4Faint]
Color=0,0,101
[Color5]
Color=178,24,178
[Color5Intense]
Color=255,84,255
[Color5Faint]
Color=101,0,101
[Color6]
Color=24,178,178
[Color6Intense]
Color=84,255,255
[Color6Faint]
Color=0,101,101
[Color7]
Color=178,178,178
[Color7Intense]
Color=255,255,255
[Color7Faint]
Color=101,101,101
[Foreground]
Color=178,178,178
[ForegroundIntense]
Color=255,255,255
[ForegroundFaint]
Color=101,101,101
[General]
Description=Linux Colors

View File

@@ -4,54 +4,81 @@ Color=0,0,0
[BackgroundIntense]
Color=0,0,0
[BackgroundFaint]
Color=0,0,0
[Color0]
Color=0,0,0
[Color0Intense]
Color=104,104,104
[Color0Faint]
Color=24,24,24
[Color1]
Color=250,142,8
[Color1Intense]
Color=255,84,84
[Color1Faint]
Color=101,25,0
[Color2]
Color=24,178,24
[Color2Intense]
Color=84,255,84
[Color2Faint]
Color=0,101,0
[Color3]
Color=178,104,24
[Color3Intense]
Color=255,255,84
[Color3Faint]
Color=101,74,0
[Color4]
Color=30,71,152
[Color4Intense]
Color=84,84,255
[Color4Faint]
Color=0,24,102
[Color5]
Color=225,30,225
[Color5Intense]
Color=255,84,255
[Color5Faint]
Color=95,5,95
[Color6]
Color=0,134,223
[Color6Intense]
Color=255,0,4
[Color6Faint]
Color=0,94,163
[Color7]
Color=255,255,255
[Color7Intense]
Color=50,50,50
[Color7Faint]
Color=101,101,101
[Foreground]
Color=255,0,0
@@ -59,6 +86,9 @@ Color=255,0,0
Bold=true
Color=24,240,24
[ForegroundFaint]
Color=205,0,0
[General]
Description=Red on Black
Opacity=1

View File

@@ -4,60 +4,90 @@ Color=7,54,66
[Color0Intense]
Color=0,43,54
[Color0Faint]
Color=6,48,59
[Color1]
Color=220,50,47
[Color1Intense]
Color=203,75,22
[Color1Faint]
Color=147,33,31
[Color2]
Color=133,153,0
[Color2Intense]
Color=88,110,117
[Color2Faint]
Color=94,106,0
[Color3]
Color=181,137,0
[Color3Intense]
Color=101,123,131
[Color3Faint]
Color=138,103,0
[Color4]
Color=38,139,210
[Color4Intense]
Color=131,148,150
[Color4Faint]
Color=20,77,115
[Color5]
Color=211,54,130
[Color5Intense]
Color=108,113,196
[Color5Faint]
Color=120,30,75
[Color6]
Color=42,161,152
[Color6Intense]
Color=147,161,161
[Color6Faint]
Color=24,94,88
[Color7]
Color=238,232,213
[Color7Intense]
Color=253,246,227
[Color7Faint]
Color=171,167,154
[Background]
Color=0,43,54
[BackgroundIntense]
Color=7,54,66
[BackgroundFaint]
Color=0,43,54
[Foreground]
Color=131,148,150
[ForegroundIntense]
Color=147,161,161
[ForegroundFaint]
Color=106,119,121
[General]
Description=Solarized
Opacity=1

View File

@@ -4,60 +4,90 @@ Color=7,54,66
[Color0Intense]
Color=0,43,54
[Color0Faint]
Color=8,65,80
[Color1]
Color=220,50,47
[Color1Intense]
Color=203,75,22
[Color1Faint]
Color=222,81,81
[Color2]
Color=133,153,0
[Color2Intense]
Color=88,110,117
[Color2Faint]
Color=153,168,39
[Color3]
Color=181,137,0
[Color3Intense]
Color=101,123,131
[Color3Faint]
Color=213,170,49
[Color4]
Color=38,139,210
[Color4Intense]
Color=131,148,150
[Color4Faint]
Color=80,173,226
[Color5]
Color=211,54,130
[Color5Intense]
Color=108,113,196
[Color5Faint]
Color=223,92,158
[Color6]
Color=42,161,152
[Color6Intense]
Color=147,161,161
[Color6Faint]
Color=78,211,200
[Color7]
Color=238,232,213
[Color7Intense]
Color=253,246,227
[Color7Faint]
Color=238,232,213
[Background]
Color=253,246,227
[BackgroundIntense]
Color=238,232,213
[BackgroundFaint]
Color=253,246,227
[Foreground]
Color=101,123,131
[ForegroundIntense]
Color=88,110,117
[ForegroundFaint]
Color=141,172,182
[General]
Description=Solarized Light
Opacity=1

View File

@@ -4,54 +4,81 @@ Color=0,0,0
[BackgroundIntense]
Color=0,0,0
[BackgroundFaint]
Color=0,0,0
[Color0]
Color=0,0,0
[Color0Intense]
Color=104,104,104
[Color0Faint]
Color=24,24,24
[Color1]
Color=178,24,24
[Color1Intense]
Color=255,84,84
[Color1Faint]
Color=101,0,0
[Color2]
Color=24,178,24
[Color2Intense]
Color=84,255,84
[Color2Faint]
Color=0,101,0
[Color3]
Color=178,104,24
[Color3Intense]
Color=255,255,84
[Color3Faint]
Color=101,74,0
[Color4]
Color=24,24,178
[Color4Intense]
Color=84,84,255
[Color4Faint]
Color=0,0,101
[Color5]
Color=178,24,178
[Color5Intense]
Color=255,84,255
[Color5Faint]
Color=95,5,95
[Color6]
Color=24,178,178
[Color6Intense]
Color=84,255,255
[Color6Faint]
Color=24,178,178
[Color7]
Color=178,178,178
[Color7Intense]
Color=255,255,255
[Color7Faint]
Color=101,101,101
[Foreground]
Color=255,255,255
@@ -59,6 +86,9 @@ Color=255,255,255
Bold=true
Color=255,255,255
[ForegroundFaint]
Color=255,255,255
[General]
Description=White on Black
Opacity=1

View File

@@ -30,20 +30,25 @@ namespace Konsole
{
typedef unsigned char LineProperty;
typedef quint16 RenditionFlags;
const int LINE_DEFAULT = 0;
const int LINE_WRAPPED = (1 << 0);
const int LINE_DOUBLEWIDTH = (1 << 1);
const int LINE_DOUBLEHEIGHT = (1 << 2);
const int DEFAULT_RENDITION = 0;
const int RE_BOLD = (1 << 0);
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_ITALIC = (1 << 4);
const int RE_CURSOR = (1 << 5);
const int RE_EXTENDED_CHAR = (1 << 6);
const RenditionFlags DEFAULT_RENDITION = 0;
const RenditionFlags RE_BOLD = (1 << 0);
const RenditionFlags RE_BLINK = (1 << 1);
const RenditionFlags RE_UNDERLINE = (1 << 2);
const RenditionFlags RE_REVERSE = (1 << 3); // Screen only
const RenditionFlags RE_ITALIC = (1 << 4);
const RenditionFlags RE_CURSOR = (1 << 5);
const RenditionFlags RE_EXTENDED_CHAR = (1 << 6);
const RenditionFlags RE_FAINT = (1 << 7);
const RenditionFlags RE_STRIKEOUT = (1 << 8);
const RenditionFlags RE_CONCEAL = (1 << 9);
const RenditionFlags RE_OVERLINE = (1 << 10);
/**
* Unicode character in the range of U+2500 ~ U+257F are known as line
@@ -81,7 +86,7 @@ public:
explicit inline Character(quint16 _c = ' ',
CharacterColor _f = CharacterColor(COLOR_SPACE_DEFAULT, DEFAULT_FORE_COLOR),
CharacterColor _b = CharacterColor(COLOR_SPACE_DEFAULT, DEFAULT_BACK_COLOR),
quint8 _r = DEFAULT_RENDITION,
RenditionFlags _r = DEFAULT_RENDITION,
bool _real = true)
: character(_c)
, rendition(_r)
@@ -98,7 +103,7 @@ public:
quint16 character;
/** A combination of RENDITION flags which specify options for drawing the character. */
quint8 rendition;
RenditionFlags rendition;
/** The foreground color used to draw this character. */
CharacterColor foregroundColor;

View File

@@ -113,7 +113,7 @@ inline bool operator != (const ColorEntry& a, const ColorEntry& b)
// Colors
#define BASE_COLORS (2+8)
#define INTENSITIES 2
#define INTENSITIES 3
#define TABLE_COLORS (INTENSITIES*BASE_COLORS)
#define DEFAULT_FORE_COLOR 0
@@ -131,6 +131,8 @@ inline bool operator != (const ColorEntry& a, const ColorEntry& b)
3 - Index(256) - u: 16..255 v:0 w:0
4 - RGB - u: 0..255 v:0..256 w:0..256
``intense'' is either 0 (normal), 1 (intensive), or 2 (faint)
Default color space has two separate colors, namely
default foreground and default background color.
*/
@@ -178,7 +180,7 @@ public:
break;
case COLOR_SPACE_SYSTEM:
_u = co & 7;
_v = (co >> 3) & 1;
_v = (co >> 3) & 3;
break;
case COLOR_SPACE_256:
_u = co & 255;
@@ -208,6 +210,14 @@ public:
*/
void setIntensive();
/**
* Set this color as a faint system color.
*
* This is only applicable if the color is using the COLOR_SPACE_DEFAULT or COLOR_SPACE_SYSTEM
* color spaces.
*/
void setFaint();
/**
* Returns the color within the specified color @p palette
*
@@ -278,9 +288,9 @@ inline QColor CharacterColor::color(const ColorEntry* base) const
{
switch (_colorSpace) {
case COLOR_SPACE_DEFAULT:
return base[_u + 0 + (_v ? BASE_COLORS : 0)].color;
return base[_u + 0 + (_v * BASE_COLORS)].color;
case COLOR_SPACE_SYSTEM:
return base[_u + 2 + (_v ? BASE_COLORS : 0)].color;
return base[_u + 2 + (_v * BASE_COLORS)].color;
case COLOR_SPACE_256:
return color256(_u, base);
case COLOR_SPACE_RGB:
@@ -300,6 +310,14 @@ inline void CharacterColor::setIntensive()
_v = 1;
}
}
inline void CharacterColor::setFaint()
{
if (_colorSpace == COLOR_SPACE_SYSTEM || _colorSpace == COLOR_SPACE_DEFAULT) {
_v = 2;
}
}
}
#endif // CHARACTERCOLOR_H

View File

@@ -62,7 +62,19 @@ const ColorEntry ColorScheme::defaultTable[TABLE_COLORS] = {
ColorEntry(QColor(0x54, 0x54, 0xFF)),
ColorEntry(QColor(0xFF, 0x54, 0xFF)),
ColorEntry(QColor(0x54, 0xFF, 0xFF)),
ColorEntry(QColor(0xFF, 0xFF, 0xFF))
ColorEntry(QColor(0xFF, 0xFF, 0xFF)),
// Here are faint intensities, which may not be good.
// faint versions
ColorEntry(QColor(0x00, 0x00, 0x00)),
ColorEntry(QColor(0xFF, 0xFF, 0xFF)),
ColorEntry(QColor(0x00, 0x00, 0x00)),
ColorEntry(QColor(0x65, 0x00, 0x00)),
ColorEntry(QColor(0x00, 0x65, 0x00)),
ColorEntry(QColor(0x65, 0x5E, 0x00)),
ColorEntry(QColor(0x00, 0x00, 0x65)),
ColorEntry(QColor(0x65, 0x00, 0x65)),
ColorEntry(QColor(0x00, 0x65, 0x65)),
ColorEntry(QColor(0x65, 0x65, 0x65))
};
const char* const ColorScheme::colorNames[TABLE_COLORS] = {
@@ -85,7 +97,17 @@ const char* const ColorScheme::colorNames[TABLE_COLORS] = {
"Color4Intense",
"Color5Intense",
"Color6Intense",
"Color7Intense"
"Color7Intense",
"ForegroundFaint",
"BackgroundFaint",
"Color0Faint",
"Color1Faint",
"Color2Faint",
"Color3Faint",
"Color4Faint",
"Color5Faint",
"Color6Faint",
"Color7Faint"
};
const char* const ColorScheme::translatedColorNames[TABLE_COLORS] = {
I18N_NOOP2("@item:intable palette", "Foreground"),
@@ -107,7 +129,17 @@ const char* const ColorScheme::translatedColorNames[TABLE_COLORS] = {
I18N_NOOP2("@item:intable palette", "Color 5 (Intense)"),
I18N_NOOP2("@item:intable palette", "Color 6 (Intense)"),
I18N_NOOP2("@item:intable palette", "Color 7 (Intense)"),
I18N_NOOP2("@item:intable palette", "Color 8 (Intense)")
I18N_NOOP2("@item:intable palette", "Color 8 (Intense)"),
I18N_NOOP2("@item:intable palette", "Foreground (Faint)"),
I18N_NOOP2("@item:intable palette", "Background (Faint)"),
I18N_NOOP2("@item:intable palette", "Color 1 (Faint)"),
I18N_NOOP2("@item:intable palette", "Color 2 (Faint)"),
I18N_NOOP2("@item:intable palette", "Color 3 (Faint)"),
I18N_NOOP2("@item:intable palette", "Color 4 (Faint)"),
I18N_NOOP2("@item:intable palette", "Color 5 (Faint)"),
I18N_NOOP2("@item:intable palette", "Color 6 (Faint)"),
I18N_NOOP2("@item:intable palette", "Color 7 (Faint)"),
I18N_NOOP2("@item:intable palette", "Color 8 (Faint)")
};
QString ColorScheme::colorNameForIndex(int index)
@@ -305,6 +337,11 @@ void ColorScheme::readColorEntry(const KConfig& config , int index)
{
KConfigGroup configGroup = config.group(colorNameForIndex(index));
if (!configGroup.hasKey("Color") && _table != 0) {
setColorTableEntry(index, _table[index%BASE_COLORS]);
return;
}
ColorEntry entry;
entry.color = configGroup.readEntry("Color", QColor());

View File

@@ -47,11 +47,12 @@ using namespace Konsole;
// colorTable is half the length of _table in ColorScheme class
// since intense colors are in a separated column
const int COLOR_TABLE_ROW_LENGTH = TABLE_COLORS / 2;
const int COLOR_TABLE_ROW_LENGTH = TABLE_COLORS / 3;
const int NAME_COLUMN = 0; // column 0 : color names
const int COLOR_COLUMN = 1; // column 1 : actual colors
const int INTENSE_COLOR_COLUMN = 2; // column 2 : intense colors
const int FAINT_COLOR_COLUMN = 3; // column 2 : faint colors
ColorSchemeEditor::ColorSchemeEditor(QWidget* aParent)
: QDialog(aParent)
@@ -104,19 +105,21 @@ ColorSchemeEditor::ColorSchemeEditor(QWidget* aParent)
connect(_ui->wallpaperPath, &QLineEdit::textChanged, this, &Konsole::ColorSchemeEditor::wallpaperPathChanged);
// color table
_ui->colorTable->setColumnCount(3);
_ui->colorTable->setColumnCount(4);
_ui->colorTable->setRowCount(COLOR_TABLE_ROW_LENGTH);
QStringList labels;
labels << i18nc("@label:listbox Column header text for color names", "Name")
<< i18nc("@label:listbox Column header text for the actual colors", "Color")
<< i18nc("@label:listbox Column header text for the actual intense colors", "Intense color");
<< i18nc("@label:listbox Column header text for the actual intense colors", "Intense color")
<< i18nc("@label:listbox Column header text for the actual faint colors", "Faint color");
_ui->colorTable->setHorizontalHeaderLabels(labels);
// Set resize mode for colorTable columns
_ui->colorTable->horizontalHeader()->setSectionResizeMode(NAME_COLUMN, QHeaderView::ResizeToContents);
_ui->colorTable->horizontalHeader()->setSectionResizeMode(COLOR_COLUMN, QHeaderView::Stretch);
_ui->colorTable->horizontalHeader()->setSectionResizeMode(INTENSE_COLOR_COLUMN, QHeaderView::Stretch);
_ui->colorTable->horizontalHeader()->setSectionResizeMode(FAINT_COLOR_COLUMN, QHeaderView::Stretch);
QTableWidgetItem* item = new QTableWidgetItem(QStringLiteral("Test"));
_ui->colorTable->setItem(0, 0, item);
@@ -147,7 +150,7 @@ ColorSchemeEditor::~ColorSchemeEditor()
void ColorSchemeEditor::editColorItem(QTableWidgetItem* item)
{
// ignore if this is not a color column
if (item->column() != COLOR_COLUMN && item->column() != INTENSE_COLOR_COLUMN) {
if (item->column() != COLOR_COLUMN && item->column() != INTENSE_COLOR_COLUMN && item->column() != FAINT_COLOR_COLUMN) {
return;
}
@@ -157,11 +160,16 @@ void ColorSchemeEditor::editColorItem(QTableWidgetItem* item)
item->setBackground(color);
int colorSchemeRow = item->row();
// Intense colors row are in the bottom half of the color table
// Intense colors row are in the middle third of the color table
if (item->column() == INTENSE_COLOR_COLUMN) {
colorSchemeRow += COLOR_TABLE_ROW_LENGTH;
}
// and the faint color rows are in the middle third of the color table
if (item->column() == FAINT_COLOR_COLUMN) {
colorSchemeRow += 2*COLOR_TABLE_ROW_LENGTH;
}
ColorEntry entry(_colors->colorEntry(colorSchemeRow));
entry.color = color;
_colors->setColorTableEntry(colorSchemeRow, entry);
@@ -268,9 +276,15 @@ void ColorSchemeEditor::setupColorTable(const ColorScheme* colors)
colorItemIntense->setFlags(colorItem->flags() & ~Qt::ItemIsEditable & ~Qt::ItemIsSelectable);
colorItemIntense->setToolTip(i18nc("@info:tooltip", "Click to choose intense color"));
QTableWidgetItem* colorItemFaint = new QTableWidgetItem();
colorItemFaint->setBackground(table[2*COLOR_TABLE_ROW_LENGTH + row].color);
colorItemFaint->setFlags(colorItem->flags() & ~Qt::ItemIsEditable & ~Qt::ItemIsSelectable);
colorItemFaint->setToolTip(i18nc("@info:tooltip", "Click to choose Faint color"));
_ui->colorTable->setItem(row, NAME_COLUMN, nameItem);
_ui->colorTable->setItem(row, COLOR_COLUMN, colorItem);
_ui->colorTable->setItem(row, INTENSE_COLOR_COLUMN, colorItemIntense);
_ui->colorTable->setItem(row, FAINT_COLOR_COLUMN, colorItemFaint);
}
// ensure that color names are as fully visible as possible
_ui->colorTable->resizeColumnToContents(0);

View File

@@ -193,7 +193,7 @@ public:
CharacterColor fgColor, bgColor;
quint16 startPos;
quint8 rendition;
RenditionFlags rendition;
bool isRealCharacter;
};

View File

@@ -347,35 +347,22 @@ void Screen::setDefaultMargins()
/*
Clarifying rendition here and in the display.
currently, the display's color table is
0 1 2 .. 9 10 .. 17
dft_fg, dft_bg, dim 0..7, intensive 0..7
The rendition attributes are
_currentForeground, _currentBackground contain values 0..8;
- 0 = default color
- 1..8 = ansi specified color
attribute
--------------
RE_UNDERLINE
RE_BLINK
RE_BOLD
RE_REVERSE
RE_TRANSPARENT
RE_FAINT
RE_STRIKEOUT
RE_CONCEAL
RE_OVERLINE
re_fg, re_bg contain values 0..17
due to the TerminalDisplay's color table
rendition attributes are
attr widget screen
-------------- ------ ------
RE_UNDERLINE XX XX affects foreground only
RE_BLINK XX XX affects foreground only
RE_BOLD XX XX affects foreground only
RE_REVERSE -- XX
RE_TRANSPARENT XX -- affects background only
RE_INTENSIVE XX -- affects foreground only
Note that RE_BOLD is used in both widget
and screen rendition. Since xterm/vt102
is to poor to distinguish between bold
(which is a font attribute) and intensive
(which is a color attribute), we translate
this and RE_BOLD in falls eventually apart
into RE_BOLD and RE_INTENSIVE.
Depending on settings, bold may be rendered as a heavier font
in addition to a different color.
*/
void Screen::reverseRendition(Character& p) const
@@ -398,8 +385,13 @@ void Screen::updateEffectiveRendition()
_effectiveBackground = _currentBackground;
}
if (_currentRendition & RE_BOLD)
_effectiveForeground.setIntensive();
if (_currentRendition & RE_BOLD) {
if (!(_currentRendition & RE_FAINT))
_effectiveForeground.setIntensive();
} else {
if (_currentRendition & RE_FAINT)
_effectiveForeground.setFaint();
}
}
void Screen::copyFromHistory(Character* dest, int startLine, int count) const
@@ -990,13 +982,13 @@ void Screen::clearEntireLine()
clearImage(loc(0, _cuY), loc(_columns - 1, _cuY), ' ');
}
void Screen::setRendition(int rendention)
void Screen::setRendition(RenditionFlags rendention)
{
_currentRendition |= rendention;
updateEffectiveRendition();
}
void Screen::resetRendition(int rendention)
void Screen::resetRendition(RenditionFlags rendention)
{
_currentRendition &= ~rendention;
updateEffectiveRendition();

View File

@@ -43,6 +43,7 @@
namespace Konsole
{
class TerminalCharacterDecoder;
class TerminalDisplay;
class HistoryType;
@@ -270,14 +271,14 @@ public:
*
* @see Character::rendition
*/
void setRendition(int rendition);
void setRendition(RenditionFlags rendition);
/**
* Disables the given @p rendition flag. Rendition flags control the appearance
* of characters on the screen.
*
* @see Character::rendition
*/
void resetRendition(int rendition);
void resetRendition(RenditionFlags rendition);
/**
* Sets the cursor's foreground color.
@@ -673,7 +674,7 @@ private:
// cursor color and rendition info
CharacterColor _currentForeground;
CharacterColor _currentBackground;
quint8 _currentRendition;
RenditionFlags _currentRendition;
// margins ----------------
int _topMargin;
@@ -696,7 +697,7 @@ private:
// effective colors and rendition ------------
CharacterColor _effectiveForeground; // These are derived from
CharacterColor _effectiveBackground; // the cu_* variables above
quint8 _effectiveRendition; // to speed up operation
RenditionFlags _effectiveRendition; // to speed up operation
class SavedState
{
@@ -706,7 +707,7 @@ private:
int cursorColumn;
int cursorLine;
quint8 rendition;
RenditionFlags rendition;
CharacterColor foreground;
CharacterColor background;
};

View File

@@ -140,7 +140,7 @@ private:
QTextStream* _output;
const ColorEntry* _colorTable;
bool _innerSpanOpen;
quint8 _lastRendition;
RenditionFlags _lastRendition;
CharacterColor _lastForeColor;
CharacterColor _lastBackColor;
};

View File

@@ -814,6 +814,10 @@ void TerminalDisplay::drawCharacters(QPainter& painter,
if (_textBlinking && (style->rendition & RE_BLINK))
return;
// don't draw concealed characters
if (style->rendition & RE_CONCEAL)
return;
// setup bold and underline
bool useBold;
ColorEntry::FontWeight weight = style->fontWeight(_colorTable);
@@ -823,14 +827,20 @@ void TerminalDisplay::drawCharacters(QPainter& painter,
useBold = (weight == ColorEntry::Bold) ? true : false;
const bool useUnderline = style->rendition & RE_UNDERLINE || font().underline();
const bool useItalic = style->rendition & RE_ITALIC || font().italic();
const bool useStrikeOut = style->rendition & RE_STRIKEOUT || font().strikeOut();
const bool useOverline = style->rendition & RE_OVERLINE || font().overline();
QFont font = painter.font();
if (font.bold() != useBold
|| font.underline() != useUnderline
|| font.italic() != useItalic) {
|| font.italic() != useItalic
|| font.strikeOut() != useStrikeOut
|| font.overline() != useOverline) {
font.setBold(useBold);
font.setUnderline(useUnderline);
font.setItalic(useItalic);
font.setStrikeOut(useStrikeOut);
font.setOverline(useOverline);
painter.setFont(font);
}
@@ -1163,7 +1173,7 @@ void TerminalDisplay::updateImage()
continue;
const bool lineDraw = newLine[x + 0].isLineChar();
const bool doubleWidth = (x + 1 == columnsToUpdate) ? false : (newLine[x + 1].character == 0);
const quint8 cr = newLine[x].rendition;
const RenditionFlags cr = newLine[x].rendition;
const CharacterColor clipboard = newLine[x].backgroundColor;
if (newLine[x].foregroundColor != cf) cf = newLine[x].foregroundColor;
const int lln = columnsToUpdate - x;
@@ -1518,7 +1528,7 @@ void TerminalDisplay::drawContents(QPainter& paint, const QRect& rect)
const bool doubleWidth = (_image[ qMin(loc(x, y) + 1, _imageSize) ].character == 0);
const CharacterColor currentForeground = _image[loc(x, y)].foregroundColor;
const CharacterColor currentBackground = _image[loc(x, y)].backgroundColor;
const quint8 currentRendition = _image[loc(x, y)].rendition;
const RenditionFlags currentRendition = _image[loc(x, y)].rendition;
while (x + len <= rlx &&
_image[loc(x + len, y)].foregroundColor == currentForeground &&

View File

@@ -576,18 +576,27 @@ 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', 2) : _currentScreen-> setRendition (RE_FAINT ); break;
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;
case TY_CSI_PS('m', 8) : _currentScreen-> setRendition (RE_CONCEAL ); break;
case TY_CSI_PS('m', 9) : _currentScreen-> setRendition (RE_STRIKEOUT); break;
case TY_CSI_PS('m', 53) : _currentScreen-> setRendition (RE_OVERLINE ); break;
case TY_CSI_PS('m', 10) : /* IGNORED: mapping related */ break; //LINUX
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', 21) : _currentScreen->resetRendition (RE_BOLD ); break;
case TY_CSI_PS('m', 22) : _currentScreen->resetRendition (RE_BOLD );
_currentScreen->resetRendition (RE_FAINT ); 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;
case TY_CSI_PS('m', 28) : _currentScreen->resetRendition (RE_CONCEAL ); break;
case TY_CSI_PS('m', 29) : _currentScreen->resetRendition (RE_STRIKEOUT); break;
case TY_CSI_PS('m', 55) : _currentScreen->resetRendition (RE_OVERLINE ); break;
case TY_CSI_PS('m', 30) : _currentScreen->setForeColor (COLOR_SPACE_SYSTEM, 0); break;
case TY_CSI_PS('m', 31) : _currentScreen->setForeColor (COLOR_SPACE_SYSTEM, 1); break;

View File

@@ -50,7 +50,19 @@ const ColorEntry CharacterColorTest::DefaultColorTable[TABLE_COLORS] = {
ColorEntry(QColor(0x54, 0x54, 0xFF)),
ColorEntry(QColor(0xFF, 0x54, 0xFF)),
ColorEntry(QColor(0x54, 0xFF, 0xFF)),
ColorEntry(QColor(0xFF, 0xFF, 0xFF))
ColorEntry(QColor(0xFF, 0xFF, 0xFF)),
// Here are faint intensities, which may not be good.
// faint versions
ColorEntry(QColor(0x00, 0x00, 0x00)),
ColorEntry(QColor(0xFF, 0xFF, 0xFF)),
ColorEntry(QColor(0x00, 0x00, 0x00)),
ColorEntry(QColor(0x65, 0x00, 0x00)),
ColorEntry(QColor(0x00, 0x65, 0x00)),
ColorEntry(QColor(0x65, 0x5E, 0x00)),
ColorEntry(QColor(0x00, 0x00, 0x65)),
ColorEntry(QColor(0x65, 0x00, 0x65)),
ColorEntry(QColor(0x00, 0x65, 0x65)),
ColorEntry(QColor(0x65, 0x65, 0x65))
};
void CharacterColorTest::init()