Commit 822f771c authored by Jekyll Wu's avatar Jekyll Wu
Browse files

Trivial clean up of code style

parent cda59521
......@@ -54,17 +54,18 @@ const int RE_EXTENDED_CHAR = (1 << 5);
*/
inline bool isSupportedLineChar(quint16 codePoint)
{
if ((codePoint & 0xFF80) != 0x2500)
if ((codePoint & 0xFF80) != 0x2500) {
return false;
}
uchar index = (codePoint & 0x007F);
if ((index >= 0x04 && index <= 0x0B) ||
(index >= 0x4C && index <= 0x4F) ||
(index >= 0x6D && index <= 0x73)) {
return false;
} else {
return true;
}
return true;
}
/**
......@@ -91,7 +92,11 @@ public:
CharacterColor _b = CharacterColor(COLOR_SPACE_DEFAULT, DEFAULT_BACK_COLOR),
quint8 _r = DEFAULT_RENDITION,
bool _real = true)
: character(_c), rendition(_r), foregroundColor(_f), backgroundColor(_b), isRealCharacter(_real) {}
: character(_c)
, rendition(_r)
, foregroundColor(_f)
, backgroundColor(_b)
, isRealCharacter(_real) { }
/** The unicode character value for this character.
*
......@@ -106,6 +111,7 @@ public:
/** The foreground color used to draw this character. */
CharacterColor foregroundColor;
/** The color used to draw this character's background. */
CharacterColor backgroundColor;
......@@ -137,6 +143,7 @@ public:
* rendition and colors.
*/
friend bool operator == (const Character& a, const Character& b);
/**
* Compares two characters and returns true if they have different unicode character values,
* renditions or colors.
......@@ -144,14 +151,19 @@ public:
friend bool operator != (const Character& a, const Character& b);
inline bool isLineChar() const {
if (rendition & RE_EXTENDED_CHAR)
if (rendition & RE_EXTENDED_CHAR) {
return false;
return isSupportedLineChar(character);
} else {
return isSupportedLineChar(character);
}
}
inline bool isSpace() const {
return (rendition & RE_EXTENDED_CHAR) ? false : QChar(character).isSpace();
if (rendition & RE_EXTENDED_CHAR) {
return false;
} else {
return QChar(character).isSpace();
}
}
};
......@@ -170,10 +182,9 @@ inline bool operator != (const Character& a, const Character& b)
inline bool Character::equalsFormat(const Character& other) const
{
return
backgroundColor == other.backgroundColor &&
foregroundColor == other.foregroundColor &&
rendition == other.rendition;
return backgroundColor == other.backgroundColor &&
foregroundColor == other.foregroundColor &&
rendition == other.rendition;
}
inline ColorEntry::FontWeight Character::fontWeight(const ColorEntry* base) const
......@@ -185,6 +196,7 @@ inline ColorEntry::FontWeight Character::fontWeight(const ColorEntry* base) cons
else
return ColorEntry::UseCurrentFormat;
}
}
Q_DECLARE_TYPEINFO(Konsole::Character, Q_MOVABLE_TYPE);
......
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