From 4180b45e5f7c2c2cc0ef1d346eabd021d368d744 Mon Sep 17 00:00:00 2001
From: Michele Calgaro <michele.calgaro@yahoo.it>
Date: Sun, 14 Jun 2026 18:16:19 +0900
Subject: konsole: some code renaming and restructing.

Rename some classes and files for better clarity. The code is inspired
and partially taken from KDE's current Konsole code.

Details:
- class 'cacol' renamed to 'CharacterColor'
- class 'ca' renamed to 'Character'
- file 'TECommon.h' split into 'Character.h' and 'CharacterColor.h'

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
---
 konsole/konsole/Character.h         |  98 +++++++++++++++
 konsole/konsole/CharacterColor.h    | 228 ++++++++++++++++++++++++++++++++++
 konsole/konsole/Makefile.am         |   2 +-
 konsole/konsole/TECommon.h          | 236 ------------------------------------
 konsole/konsole/TEHistory.cpp       |  46 +++----
 konsole/konsole/TEHistory.h         |  28 ++---
 konsole/konsole/TEPty.cpp           |   6 +-
 konsole/konsole/TEScreen.cpp        |  98 +++++++--------
 konsole/konsole/TEScreen.h          |  26 ++--
 konsole/konsole/TEWidget.cpp        | 124 +++++++++----------
 konsole/konsole/TEWidget.h          |  12 +-
 konsole/konsole/TEmuVt102.cpp       |  88 +++++++-------
 konsole/konsole/TEmulation.cpp      |   2 +-
 konsole/konsole/konsole_wcwidth.cpp |   2 +-
 konsole/konsole/schema.cpp          |  44 +++----
 konsole/konsole/schema.h            |   2 +-
 16 files changed, 566 insertions(+), 476 deletions(-)
 create mode 100644 konsole/konsole/Character.h
 create mode 100644 konsole/konsole/CharacterColor.h
 delete mode 100644 konsole/konsole/TECommon.h

diff --git a/konsole/konsole/Character.h b/konsole/konsole/Character.h
new file mode 100644
index 000000000..04033b949
--- /dev/null
+++ b/konsole/konsole/Character.h
@@ -0,0 +1,98 @@
+/*
+    This file is part of Konsole, an X terminal.
+    Copyright (C) 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+    02110-1301  USA.
+*/
+
+#ifndef CHARACTER_H
+#define CHARACTER_H
+
+#include <CharacterColor.h>
+
+
+// Rendition attributes
+#define DEFAULT_RENDITION  0
+#define RE_BOLD            (1 << 0)
+#define RE_BLINK           (1 << 1)
+#define RE_UNDERLINE       (1 << 2)
+#define RE_REVERSE         (1 << 3)
+#define RE_INTENSIVE       (1 << 3)
+#define RE_CURSOR          (1 << 4)
+
+
+/*
+   Character represents a single character in the terminal.
+   It consists of a unicode character value, foreground and background colors
+   and a set of rendition attributes which specify how it should be drawn.
+*/
+class Character
+{
+  public:
+    /*
+       Constructs a new character.
+
+       @param _c The unicode character value of this character.
+       @param _f The foreground color used to draw the character.
+       @param _b The color used to draw the character's background.
+       @param _r A set of rendition flags which specify how this character is to be drawn.
+    */
+    explicit constexpr Character(
+            uint16_t _c       = ' ',
+            CharacterColor _f = CharacterColor(COLOR_SPACE_DEFAULT, DEFAULT_FORE_COLOR),
+            CharacterColor _b = CharacterColor(COLOR_SPACE_DEFAULT, DEFAULT_BACK_COLOR),
+            uint8_t  _r       = DEFAULT_RENDITION)
+         : m_character(_c), m_rendition(_r), m_fgColor(_f), m_bgColor(_b) {}
+
+    bool isTransparent(const ColorEntry *base) const;
+    bool isBold(const ColorEntry *base) const;
+
+    constexpr bool operator==(const Character &other) const;
+    constexpr bool operator!=(const Character &other) const;
+
+  public:
+    uint16_t        m_character; // character
+    uint8_t         m_rendition; // rendition
+    CharacterColor  m_fgColor;   // foreground color
+    CharacterColor  m_bgColor;   // background color
+};
+
+inline constexpr bool Character::operator==(const Character &other) const
+{
+  return m_character == other.m_character &&
+         m_rendition == other.m_rendition &&
+         m_fgColor   == other.m_fgColor   &&
+         m_bgColor   == other.m_bgColor;
+}
+
+inline constexpr bool Character::operator!=(const Character &other) const
+{
+  return !operator==(other);
+}
+
+inline bool Character::isTransparent(const ColorEntry* base) const
+{
+  return (m_bgColor.m_cs == COLOR_SPACE_DEFAULT && base[m_bgColor.m_u     + (m_bgColor.m_v ? BASE_COLORS : 0)].m_transparent) ||
+         (m_bgColor.m_cs == COLOR_SPACE_SYSTEM  && base[m_bgColor.m_u + 2 + (m_bgColor.m_v ? BASE_COLORS : 0)].m_transparent);
+}
+
+inline bool Character::isBold(const ColorEntry* base) const
+{
+  return (m_fgColor.m_cs == COLOR_SPACE_DEFAULT && base[m_fgColor.m_u     + (m_fgColor.m_v ? BASE_COLORS : 0)].m_bold) ||
+         (m_fgColor.m_cs == COLOR_SPACE_SYSTEM  && base[m_fgColor.m_u + 2 + (m_fgColor.m_v ? BASE_COLORS : 0)].m_bold);
+}
+
+#endif
diff --git a/konsole/konsole/CharacterColor.h b/konsole/konsole/CharacterColor.h
new file mode 100644
index 000000000..f4735f161
--- /dev/null
+++ b/konsole/konsole/CharacterColor.h
@@ -0,0 +1,228 @@
+/*
+    This file is part of Konsole, an X terminal.
+    Copyright (C) 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+    02110-1301  USA.
+*/
+
+#ifndef CHARACTERCOLOR_H
+#define CHARACTERCOLOR_H
+
+#include <cstdint>
+
+#include <tqcolor.h>
+
+
+// Represent colors in the default table and color schemas
+class ColorEntry
+{
+  public:
+    explicit ColorEntry(TQColor c, bool tr, bool b) : m_color(c), m_transparent(tr), m_bold(b) {}
+    ColorEntry() : m_transparent(false), m_bold(false) {} // default constructors
+
+    ColorEntry& operator=(const ColorEntry &rhs)
+    {
+      if (this != &rhs)
+      {
+        m_color = rhs.m_color;
+        m_transparent = rhs.m_transparent;
+        m_bold = rhs.m_bold;
+      }
+      return *this;
+    }
+
+  public:
+    TQColor m_color;
+    bool    m_transparent; // if used on background color
+    bool    m_bold;        // if used on foreground color
+};
+
+
+// Color spaces
+#define COLOR_SPACE_UNDEFINED 0
+#define COLOR_SPACE_DEFAULT   1
+#define COLOR_SPACE_SYSTEM    2
+#define COLOR_SPACE_256       3
+#define COLOR_SPACE_RGB       4
+
+/*
+   Color index in the base color table:
+         0 : default foreground  (normal)   (COLOR_SPACE_DEFAULT)
+         1 : default background  (normal)   (COLOR_SPACE_DEFAULT)
+     2 - 9 : system colors       (normal)   (COLOR_SPACE_SYSTEM)
+        10 : default foreground  (intense)  (COLOR_SPACE_DEFAULT)
+        11 : default background  (intense)  (COLOR_SPACE_DEFAULT)
+   12 - 19 : system colors       (intense)  (COLOR_SPACE_SYSTEM)
+
+
+   Color index in the 256 color table:
+     0 -   7 : system colors     (normal)   (COLOR_SPACE_SYSTEM)
+     8 -  15 : system colors     (intense)  (COLOR_SPACE_SYSTEM)
+    16 - 231 : 6 × 6 × 6 cube (216 colors)  (COLOR_SPACE_RGB)
+   232 - 255 : grayscale from dark to light (COLOR_SPACE_RGB)
+
+*/
+
+// Base color table contains default and system color spaces
+#define BASE_COLORS   (2+8)
+#define INTENSITIES   2
+#define TABLE_COLORS  (INTENSITIES * BASE_COLORS)
+
+// Default foreground, default background color index
+#define DEFAULT_FORE_COLOR 0
+#define DEFAULT_BACK_COLOR 1
+
+
+/*
+   CharacterColor describes the color of a single character on the
+   terminal and is represented as one of the available color spaces.
+
+   m_cs  - color space - other members's value
+   0     - Undefined   - m_u:  0,      m_v:0        m_w:0
+   1     - Default     - m_u:  0..1    m_v:intense  m_w:0
+   2     - System      - m_u:  0..7    m_v:intense  m_w:0
+   3     - Index(256)  - m_u: 16..255  m_v:0        m_w:0
+   4     - RGB         - m_u:  0..255  m_v:0..255   m_w:0..255
+
+   `intense' is either 0 (normal) or 1 (intense)
+*/
+class CharacterColor
+{
+  friend class Character;
+
+  public:
+    constexpr CharacterColor();
+    constexpr CharacterColor(uint8_t cs, int color);
+
+    constexpr bool isValid() const;
+    void setIntensive();
+    TQColor color(const ColorEntry *base) const;
+
+    constexpr bool operator==(const CharacterColor &other) const;
+    constexpr bool operator!=(const CharacterColor &other) const;
+
+  private:
+    uint8_t m_cs; // color space
+    uint8_t m_u;
+    uint8_t m_v;
+    uint8_t m_w;
+};
+
+// Create an undefined character color
+inline constexpr CharacterColor::CharacterColor()
+        : m_cs(COLOR_SPACE_UNDEFINED), m_u(0), m_v(0), m_w(0)
+{
+}
+
+// Create a new CharacterColor with colorSpace 'cs' and value 'color'
+inline constexpr CharacterColor::CharacterColor(uint8_t cs, int color)
+        : m_cs(cs), m_u(0), m_v(0), m_w(0)
+{
+  switch (m_cs)
+  {
+    case COLOR_SPACE_DEFAULT:
+      m_u = color & 0x01;
+      break;
+
+    case COLOR_SPACE_SYSTEM:
+      m_u = color & 0x07;
+      m_v = (color >> 3) & 0x01;
+      break;
+
+    case COLOR_SPACE_256:
+      m_u = color & 0xFF;
+      break;
+
+    case COLOR_SPACE_RGB:
+      m_u = (color >> 16) & 0xFF; // r
+      m_v = (color >> 8) & 0xFF;  // g
+      m_w = color & 0xFF;         // b
+      break;
+
+    default:
+      m_cs = COLOR_SPACE_UNDEFINED;
+      break;
+  }
+}
+
+// Return true if this is a valid character color
+inline constexpr bool CharacterColor::isValid() const
+{
+  return m_cs != COLOR_SPACE_UNDEFINED;
+}
+
+inline void CharacterColor::setIntensive()
+{
+  if (m_cs == COLOR_SPACE_SYSTEM || m_cs == COLOR_SPACE_DEFAULT)
+  {
+    m_v = 1;
+  }
+}
+
+inline constexpr bool CharacterColor::operator==(const CharacterColor &other) const
+{
+  return m_cs == other.m_cs &&
+         m_u  == other.m_u  &&
+         m_v  == other.m_v  &&
+         m_w  == other.m_w;
+}
+
+inline constexpr bool CharacterColor::operator!=(const CharacterColor &other) const
+{
+  return !operator==(other);
+}
+
+inline const TQColor color256(uint8_t u, const ColorEntry *base)
+{
+  //   0..15: system colors
+  if (u < 8) return base[u+2].m_color;
+  u -= 8;
+  if (u < 8) return base[u+2+BASE_COLORS].m_color;
+  u -= 8;
+
+  //  16..231: 6x6x6 rgb color cube
+  if (u < 216) return TQColor(255 * ((u / 36) % 6) / 5,
+                              255 * ((u /  6) % 6) / 5,
+                              255 * ((u /  1) % 6) / 5);
+  u -= 216;
+
+  // 232..255: gray, leaving out black and white
+  int gray = u*10+8; return TQColor(gray,gray,gray);
+}
+
+inline TQColor CharacterColor::color(const ColorEntry *base) const
+{
+  switch (m_cs)
+  {
+    case COLOR_SPACE_DEFAULT:
+      return base[m_u + (m_v ? BASE_COLORS : 0)].m_color;
+
+    case COLOR_SPACE_SYSTEM:
+      return base[m_u + 2 + (m_v ? BASE_COLORS : 0)].m_color;
+
+    case COLOR_SPACE_256:
+      return color256(m_u, base);
+
+    case COLOR_SPACE_RGB:
+      return TQColor(m_u, m_v, m_w);
+
+    default:
+      return TQColor();
+  }
+  return TQColor();
+}
+
+#endif
diff --git a/konsole/konsole/Makefile.am b/konsole/konsole/Makefile.am
index d3b60b89a..9e72b534f 100644
--- a/konsole/konsole/Makefile.am
+++ b/konsole/konsole/Makefile.am
@@ -49,7 +49,7 @@ konsole_la_LIBADD = $(LIB_TDEUI) $(LIB_TDEIO) $(LIB_TDEPRINT) $(LIBUTIL) $(XTEST
 # kcmkonsole_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_TQT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor
 
 noinst_HEADERS = TEWidget.h TEPty.h TEmulation.h TEmuVt102.h \
-	TECommon.h TEScreen.h konsole.h schema.h session.h konsole_wcwidth.h \
+	Character.h CharacterColor.h TEScreen.h konsole.h schema.h session.h konsole_wcwidth.h \
 	kwrited.h TEHistory.h keytrans.h default.keytab.h BlockArray.h \
         konsolebookmarkhandler.h konsolebookmarkmenu.h zmodem_dialog.h \
         printsettings.h linefont.h
diff --git a/konsole/konsole/TECommon.h b/konsole/konsole/TECommon.h
deleted file mode 100644
index a48e82c63..000000000
--- a/konsole/konsole/TECommon.h
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
-    This file is part of Konsole, an X terminal.
-    Copyright (C) 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-    02110-1301  USA.
-*/
-
-/*! \file TECommon.h
-    \brief Definitions shared between TEScreen and TEWidget.
-*/
-
-#ifndef TECOMMON_H
-#define TECOMMON_H
-
-#include <tqcolor.h>
-
-#ifndef UINT8
-typedef unsigned char UINT8;
-#endif
-
-#ifndef UINT16
-typedef unsigned short UINT16;
-#endif
-
-// Color Table Elements ///////////////////////////////////////////////
-
-/*!
-*/
-struct ColorEntry
-{
-  ColorEntry(TQColor c, bool tr, bool b) : color(c), transparent(tr), bold(b) {}
-  ColorEntry() : transparent(false), bold(false) {} // default constructors
-  void operator=(const ColorEntry& rhs) { 
-       color = rhs.color; 
-       transparent = rhs.transparent; 
-       bold = rhs.bold; 
-  }
-  TQColor color;
-  bool   transparent; // if used on bg
-  bool   bold;        // if used on fg
-};
-
-// Attributed Character Representations ///////////////////////////////
-
-// Colors
-
-#define BASE_COLORS   (2+8)
-#define INTENSITIES   2
-#define TABLE_COLORS  (INTENSITIES*BASE_COLORS)
-
-#define DEFAULT_FORE_COLOR 0
-#define DEFAULT_BACK_COLOR 1
-
-#define DEFAULT_RENDITION  0
-#define RE_BOLD            (1 << 0)
-#define RE_BLINK           (1 << 1)
-#define RE_UNDERLINE       (1 << 2)
-#define RE_REVERSE         (1 << 3) // Screen only
-#define RE_INTENSIVE       (1 << 3) // Widget only
-#define RE_CURSOR          (1 << 4)
-
-
-/* cacol is a union of the various color spaces.
-
-   Assignment is as follows:
-
-   Type  - Space        - Values
-
-   0     - Undefined   - u:  0,      v:0        w:0
-   1     - Default     - u:  0..1    v:intense  w:0
-   2     - System      - u:  0..7    v:intense  w:0
-   3     - Index(256)  - u: 16..255  v:0        w:0
-   4     - RGB         - u:  0..255  v:0..256   w:0..256
-
-   Default colour space has two separate colours, namely
-   default foreground and default background colour.
-*/
-
-#define CO_UND 0
-#define CO_DFT 1
-#define CO_SYS 2
-#define CO_256 3
-#define CO_RGB 4
-
-class cacol
-{
-public:
-  cacol();
-  cacol(UINT8 space, int color);
-  UINT8 t; // color space indicator
-  UINT8 u; // various bytes representing the data in the respective ...
-  UINT8 v; // ... color space. C++ does not do unions, so we cannot ...
-  UINT8 w; // ... express ourselfs here, properly.
-  void toggleIntensive(); // Hack or helper?
-  TQColor color(const ColorEntry* base) const;
-  friend bool operator == (cacol a, cacol b);
-  friend bool operator != (cacol a, cacol b);
-};
-
-#if 0
-inline cacol::cacol(UINT8 _t, UINT8 _u, UINT8 _v, UINT8 _w)
-: t(_t), u(_u), v(_v), w(_w)
-{
-}
-#else
-inline cacol::cacol(UINT8 ty, int co)
-: t(ty), u(0), v(0), w(0)
-{
-  switch (t)
-  {
-    case CO_UND:                                break;
-    case CO_DFT: u = co&  1;                    break;
-    case CO_SYS: u = co&  7; v = (co>>3)&1;     break;
-    case CO_256: u = co&255;                    break;
-    case CO_RGB: u = co>>16; v = co>>8; w = co; break;
-    default    : t = 0;                         break;
-  }
-}
-#endif
-
-inline cacol::cacol() // undefined, really
-: t(CO_UND), u(0), v(0), w(0)
-{
-}
-
-inline bool operator == (cacol a, cacol b)
-{ 
-  return a.t == b.t && a.u == b.u && a.v == b.v && a.w == b.w;
-}
-
-inline bool operator != (cacol a, cacol b)
-{
-  return a.t != b.t || a.u != b.u || a.v != b.v || a.w != b.w;
-}
-
-inline const TQColor color256(UINT8 u, const ColorEntry* base)
-{
-  //   0.. 16: system colors
-  if (u <   8) return base[u+2            ].color;
-  u -= 8;
-  if (u <   8) return base[u+2+BASE_COLORS].color;
-  u -= 8;
-
-  //  16..231: 6x6x6 rgb color cube
-  if (u < 216) return TQColor(255*((u/36)%6)/5,
-                             255*((u/ 6)%6)/5,
-                             255*((u/ 1)%6)/5); u -= 216;
-  
-  // 232..255: gray, leaving out black and white
-  int gray = u*10+8; return TQColor(gray,gray,gray);
-}
-
-inline TQColor cacol::color(const ColorEntry* base) const
-{
-  switch (t)
-  {
-    case CO_DFT: return base[u+0+(v?BASE_COLORS:0)].color;
-    case CO_SYS: return base[u+2+(v?BASE_COLORS:0)].color;
-    case CO_256: return color256(u,base);
-    case CO_RGB: return TQColor(u,v,w);
-    default    : return TQColor(255,0,0); // diagnostic catch all
-  }
-}
-
-inline void cacol::toggleIntensive()
-{
-  if (t == CO_SYS || t == CO_DFT)
-  {
-    v = !v;
-  }
-}
-
-/*! \class ca
- *  \brief a character with rendition attributes.
-*/
-
-class ca
-{
-public:
-  inline ca(UINT16 _c = ' ',
-            cacol  _f = cacol(CO_DFT,DEFAULT_FORE_COLOR),
-            cacol  _b = cacol(CO_DFT,DEFAULT_BACK_COLOR),
-            UINT8  _r = DEFAULT_RENDITION)
-       : c(_c), r(_r), f(_f), b(_b) {}
-public:
-  UINT16 c; // character
-  UINT8  r; // rendition
-  cacol  f; // foreground color
-  cacol  b; // background color
-public:
-  //FIXME: following a hack to cope with various color spaces
-  // it brings the rendition pipeline further out of balance,
-  // which it was anyway as the result of various additions.
-  bool   isTransparent(const ColorEntry* base) const;
-  bool   isBold(const ColorEntry* base) const;
-public:
-  friend bool operator == (ca a, ca b);
-  friend bool operator != (ca a, ca b);
-};
-
-inline bool operator == (ca a, ca b)
-{ 
-  return a.c == b.c && a.f == b.f && a.b == b.b && a.r == b.r;
-}
-
-inline bool operator != (ca a, ca b)
-{
-  return a.c != b.c || a.f != b.f || a.b != b.b || a.r != b.r;
-}
-
-inline bool ca::isTransparent(const ColorEntry* base) const
-{
-  return ((b.t == CO_DFT) && base[b.u+0+(b.v?BASE_COLORS:0)].transparent)
-      || ((b.t == CO_SYS) && base[b.u+2+(b.v?BASE_COLORS:0)].transparent);
-}
-
-inline bool ca::isBold(const ColorEntry* base) const
-{
-  return ((f.t == CO_DFT) && base[f.u+0+(f.v?BASE_COLORS:0)].bold)
-      || ((f.t == CO_SYS) && base[f.u+2+(f.v?BASE_COLORS:0)].bold);
-}
-
-#endif // TECOMMON_H
diff --git a/konsole/konsole/TEHistory.cpp b/konsole/konsole/TEHistory.cpp
index f4df945c8..4908a2481 100644
--- a/konsole/konsole/TEHistory.cpp
+++ b/konsole/konsole/TEHistory.cpp
@@ -161,7 +161,7 @@ int HistoryScrollFile::getLines()
 
 int HistoryScrollFile::getLineLen(int lineno)
 {
-  return (startOfLine(lineno+1) - startOfLine(lineno)) / sizeof(ca);
+  return (startOfLine(lineno+1) - startOfLine(lineno)) / sizeof(Character);
 }
 
 bool HistoryScrollFile::isWrappedLine(int lineno)
@@ -185,14 +185,14 @@ int HistoryScrollFile::startOfLine(int lineno)
   return cells.len();
 }
 
-void HistoryScrollFile::getCells(int lineno, int colno, int count, ca res[])
+void HistoryScrollFile::getCells(int lineno, int colno, int count, Character res[])
 {
-  cells.get((unsigned char*)res,count*sizeof(ca),startOfLine(lineno)+colno*sizeof(ca));
+  cells.get((unsigned char*)res,count*sizeof(Character),startOfLine(lineno)+colno*sizeof(Character));
 }
 
-void HistoryScrollFile::addCells(ca text[], int count)
+void HistoryScrollFile::addCells(Character text[], int count)
 {
-  cells.add((unsigned char*)text,count*sizeof(ca));
+  cells.add((unsigned char*)text,count*sizeof(Character));
 }
 
 void HistoryScrollFile::addLine(bool previousWrapped)
@@ -222,7 +222,7 @@ HistoryScrollBuffer::~HistoryScrollBuffer()
   }
 }
 
-void HistoryScrollBuffer::addCells(ca a[], int count)
+void HistoryScrollBuffer::addCells(Character a[], int count)
 {
   histline* newLine = new histline;
 
@@ -269,7 +269,7 @@ bool HistoryScrollBuffer::isWrappedLine(int lineno)
   return m_wrappedLine[adjustLineNb(lineno)];
 }
 
-void HistoryScrollBuffer::getCells(int lineno, int colno, int count, ca res[])
+void HistoryScrollBuffer::getCells(int lineno, int colno, int count, Character res[])
 {
   if (!count) return;
 
@@ -280,13 +280,13 @@ void HistoryScrollBuffer::getCells(int lineno, int colno, int count, ca res[])
   histline *l = m_histBuffer[lineno];
 
   if (!l) {
-    memset(res, 0, count * sizeof(ca));
+    memset(res, 0, count * sizeof(Character));
     return;
   }
 
   assert(colno <= (int) l->size() - count);
 
-  memcpy(res, l->data() + colno, count * sizeof(ca));
+  memcpy(res, l->data() + colno, count * sizeof(Character));
 }
 
 void HistoryScrollBuffer::setMaxNbLines(unsigned int nbLines)
@@ -363,11 +363,11 @@ bool HistoryScrollNone::isWrappedLine(int /*lineno*/)
   return false;
 }
 
-void HistoryScrollNone::getCells(int, int, int, ca [])
+void HistoryScrollNone::getCells(int, int, int, Character [])
 {
 }
 
-void HistoryScrollNone::addCells(ca [], int)
+void HistoryScrollNone::addCells(Character [], int)
 {
 }
 
@@ -410,34 +410,34 @@ bool HistoryScrollBlockArray::isWrappedLine(int /*lineno*/)
 }
 
 void HistoryScrollBlockArray::getCells(int lineno, int colno,
-                                       int count, ca res[])
+                                       int count, Character res[])
 {
   if (!count) return;
 
   const Block *b = m_blockArray.at(lineno);
 
   if (!b) {
-    memset(res, 0, count * sizeof(ca)); // still better than random data
+    memset(res, 0, count * sizeof(Character)); // still better than random data
     return;
   }
 
-  assert(((colno + count) * sizeof(ca)) < ENTRIES);
-  memcpy(res, b->data + (colno * sizeof(ca)), count * sizeof(ca));
+  assert(((colno + count) * sizeof(Character)) < ENTRIES);
+  memcpy(res, b->data + (colno * sizeof(Character)), count * sizeof(Character));
 }
 
-void HistoryScrollBlockArray::addCells(ca a[], int count)
+void HistoryScrollBlockArray::addCells(Character a[], int count)
 {
   Block *b = m_blockArray.lastBlock();
 
   if (!b) return;
 
   // put cells in block's data
-  assert((count * sizeof(ca)) < ENTRIES);
+  assert((count * sizeof(Character)) < ENTRIES);
 
   memset(b->data, 0, ENTRIES);
 
-  memcpy(b->data, a, count * sizeof(ca));
-  b->size = count * sizeof(ca);
+  memcpy(b->data, a, count * sizeof(Character));
+  b->size = count * sizeof(Character);
 
   size_t res = m_blockArray.newBlock();
   assert (res > 0);
@@ -546,13 +546,13 @@ HistoryScroll* HistoryTypeBuffer::getScroll(HistoryScroll *old) const
     if (lines > (int) m_nbLines)
        startLine = lines - m_nbLines;
 
-    ca line[LINE_SIZE];
+    Character line[LINE_SIZE];
     for(int i = startLine; i < lines; i++)
     {
        int size = old->getLineLen(i);
        if (size > LINE_SIZE)
        {
-          ca *tmp_line = new ca[size];
+          Character *tmp_line = new Character[size];
           old->getCells(i, 0, size, tmp_line);
           newScroll->addCells(tmp_line, size);
           newScroll->addLine(old->isWrappedLine(i));
@@ -595,14 +595,14 @@ HistoryScroll* HistoryTypeFile::getScroll(HistoryScroll *old) const
 
   HistoryScroll *newScroll = new HistoryScrollFile(m_fileName);
 
-  ca line[LINE_SIZE];
+  Character line[LINE_SIZE];
   int lines = old->getLines();
   for(int i = 0; i < lines; i++)
   {
      int size = old->getLineLen(i);
      if (size > LINE_SIZE)
      {
-        ca *tmp_line = new ca[size];
+        Character *tmp_line = new Character[size];
         old->getCells(i, 0, size, tmp_line);
         newScroll->addCells(tmp_line, size);
         newScroll->addLine(old->isWrappedLine(i));
diff --git a/konsole/konsole/TEHistory.h b/konsole/konsole/TEHistory.h
index 812c9eaed..717d46478 100644
--- a/konsole/konsole/TEHistory.h
+++ b/konsole/konsole/TEHistory.h
@@ -27,7 +27,7 @@
 
 #include <tdetempfile.h>
 
-#include "TECommon.h"
+#include "Character.h"
 
 #if 1
 /*
@@ -69,14 +69,14 @@ public:
   // access to history
   virtual int  getLines() = 0;
   virtual int  getLineLen(int lineno) = 0;
-  virtual void getCells(int lineno, int colno, int count, ca res[]) = 0;
+  virtual void getCells(int lineno, int colno, int count, Character res[]) = 0;
   virtual bool isWrappedLine(int lineno) = 0;
 
   // backward compatibility (obsolete)
-  ca   getCell(int lineno, int colno) { ca res; getCells(lineno,colno,1,&res); return res; }
+  Character   getCell(int lineno, int colno) { Character res; getCells(lineno,colno,1,&res); return res; }
 
   // adding lines.
-  virtual void addCells(ca a[], int count) = 0;
+  virtual void addCells(Character a[], int count) = 0;
   virtual void addLine(bool previousWrapped=false) = 0;
 
   const HistoryType& getType() { return *m_histType; }
@@ -100,10 +100,10 @@ public:
 
   virtual int  getLines();
   virtual int  getLineLen(int lineno);
-  virtual void getCells(int lineno, int colno, int count, ca res[]);
+  virtual void getCells(int lineno, int colno, int count, Character res[]);
   virtual bool isWrappedLine(int lineno);
 
-  virtual void addCells(ca a[], int count);
+  virtual void addCells(Character a[], int count);
   virtual void addLine(bool previousWrapped=false);
 
 private:
@@ -111,7 +111,7 @@ private:
 
   TQString m_logFileName;
   HistoryFile index; // lines Row(int)
-  HistoryFile cells; // text  Row(ca)
+  HistoryFile cells; // text  Row(Character)
   HistoryFile lineflags; // flags Row(unsigned char)
 };
 
@@ -122,17 +122,17 @@ private:
 class HistoryScrollBuffer : public HistoryScroll
 {
 public:
-  typedef TQMemArray<ca> histline;
+  typedef TQMemArray<Character> histline;
 
   HistoryScrollBuffer(unsigned int maxNbLines = 1000);
   virtual ~HistoryScrollBuffer();
 
   virtual int  getLines();
   virtual int  getLineLen(int lineno);
-  virtual void getCells(int lineno, int colno, int count, ca res[]);
+  virtual void getCells(int lineno, int colno, int count, Character res[]);
   virtual bool isWrappedLine(int lineno);
 
-  virtual void addCells(ca a[], int count);
+  virtual void addCells(Character a[], int count);
   virtual void addLine(bool previousWrapped=false);
 
   void setMaxNbLines(unsigned int nbLines);
@@ -165,10 +165,10 @@ public:
 
   virtual int  getLines();
   virtual int  getLineLen(int lineno);
-  virtual void getCells(int lineno, int colno, int count, ca res[]);
+  virtual void getCells(int lineno, int colno, int count, Character res[]);
   virtual bool isWrappedLine(int lineno);
 
-  virtual void addCells(ca a[], int count);
+  virtual void addCells(Character a[], int count);
   virtual void addLine(bool previousWrapped=false);
 };
 
@@ -185,10 +185,10 @@ public:
 
   virtual int  getLines();
   virtual int  getLineLen(int lineno);
-  virtual void getCells(int lineno, int colno, int count, ca res[]);
+  virtual void getCells(int lineno, int colno, int count, Character res[]);
   virtual bool isWrappedLine(int lineno);
 
-  virtual void addCells(ca a[], int count);
+  virtual void addCells(Character a[], int count);
   virtual void addLine(bool previousWrapped=false);
 
 protected:
diff --git a/konsole/konsole/TEPty.cpp b/konsole/konsole/TEPty.cpp
index 5e7aefa5b..a57502618 100644
--- a/konsole/konsole/TEPty.cpp
+++ b/konsole/konsole/TEPty.cpp
@@ -32,7 +32,7 @@
     \brief Ptys provide a pseudo terminal connection to a program.
 
     Although closely related to pipes, these pseudo terminal connections have
-    some ability, that makes it nessesary to uses them. Most importent, they
+    some ability, that makes it necessary to use them. Most important, they
     know about changing screen sizes and UNIX job control.
 
     Within the terminal emulation framework, this class represents the
@@ -64,11 +64,11 @@
     over the (obsolete) predecessor.
 
     There's a sinister ioctl(2), signal(2) and job control stuff
-    nessesary to make everything work as it should.
+    necessary to make everything work as it should.
 
     Much of the stuff can be simplified by using openpty from glibc2.
     Compatibility issues with obsolete installations and other unixes
-    my prevent this.
+    may prevent this.
 */
 #ifdef HAVE_CONFIG_H
 #include <config.h>
diff --git a/konsole/konsole/TEScreen.cpp b/konsole/konsole/TEScreen.cpp
index 8f2473e31..b185eae3c 100644
--- a/konsole/konsole/TEScreen.cpp
+++ b/konsole/konsole/TEScreen.cpp
@@ -68,19 +68,19 @@
 TEScreen::TEScreen(int l, int c)
   : lines(l),
     columns(c),
-    image(new ca[(lines+1)*columns]),
+    image(new Character[(lines+1)*columns]),
     histCursor(0),
     hist(new HistoryScrollNone()),
     cuX(0), cuY(0),
-    cu_fg(cacol()), cu_bg(cacol()), cu_re(0),
+    cu_fg(CharacterColor()), cu_bg(CharacterColor()), cu_re(0),
     tmargin(0), bmargin(0),
     tabstops(0),
     sel_begin(0), sel_TL(0), sel_BR(0),
     sel_busy(false),
     columnmode(false),
-    ef_fg(cacol()), ef_bg(cacol()), ef_re(0),
+    ef_fg(CharacterColor()), ef_bg(CharacterColor()), ef_re(0),
     sa_cuX(0), sa_cuY(0),
-    sa_cu_re(0), sa_cu_fg(cacol()), sa_cu_bg(cacol()),
+    sa_cu_re(0), sa_cu_fg(CharacterColor()), sa_cu_bg(CharacterColor()),
     lastPos(-1),
     lastDrawnChar(0)
 {
@@ -91,7 +91,7 @@ TEScreen::TEScreen(int l, int c)
     // we add +1 here as under some weired circumstances konsole crashes
     // reading out of bound. As a crash is worse, we afford the minimum
     // of added memory
-    image      = (ca*) malloc((lines+1)*columns*sizeof(ca));
+    image      = (Character*) malloc((lines+1)*columns*sizeof(Character));
     tabstops   = NULL; initTabStops();
     cuX = cuY = sa_cu_re = cu_re = sa_cu_fg = cu_fg = sa_cu_bg = cu_bg = 0;
 
@@ -486,7 +486,7 @@ void TEScreen::resizeImage(int new_lines, int new_columns)
 
   // make new image
 
-  ca* newimg = new ca[(new_lines+1)*new_columns];
+  Character* newimg = new Character[(new_lines+1)*new_columns];
   TQBitArray newwrapped(new_lines+1);
   clearSelection();
 
@@ -494,10 +494,10 @@ void TEScreen::resizeImage(int new_lines, int new_columns)
   for (int y = 0; y < new_lines; y++) {
     for (int x = 0; x < new_columns; x++)
     {
-      newimg[y*new_columns+x].c = ' ';
-      newimg[y*new_columns+x].f = cacol(CO_DFT,DEFAULT_FORE_COLOR);
-      newimg[y*new_columns+x].b = cacol(CO_DFT,DEFAULT_BACK_COLOR);
-      newimg[y*new_columns+x].r = DEFAULT_RENDITION;
+      newimg[y*new_columns+x].m_character = ' ';
+      newimg[y*new_columns+x].m_fgColor = CharacterColor(COLOR_SPACE_DEFAULT,DEFAULT_FORE_COLOR);
+      newimg[y*new_columns+x].m_bgColor = CharacterColor(COLOR_SPACE_DEFAULT,DEFAULT_BACK_COLOR);
+      newimg[y*new_columns+x].m_rendition = DEFAULT_RENDITION;
     }
     newwrapped[y]=false;
   }
@@ -507,10 +507,10 @@ void TEScreen::resizeImage(int new_lines, int new_columns)
   for (int y = 0; y < cpy_lines; y++) {
     for (int x = 0; x < cpy_columns; x++)
     {
-      newimg[y*new_columns+x].c = image[loc(x,y)].c;
-      newimg[y*new_columns+x].f = image[loc(x,y)].f;
-      newimg[y*new_columns+x].b = image[loc(x,y)].b;
-      newimg[y*new_columns+x].r = image[loc(x,y)].r;
+      newimg[y*new_columns+x].m_character = image[loc(x,y)].m_character;
+      newimg[y*new_columns+x].m_fgColor = image[loc(x,y)].m_fgColor;
+      newimg[y*new_columns+x].m_bgColor = image[loc(x,y)].m_bgColor;
+      newimg[y*new_columns+x].m_rendition = image[loc(x,y)].m_rendition;
     }
     newwrapped[y]=line_wrapped[y];
   }
@@ -563,9 +563,9 @@ void TEScreen::resizeImage(int new_lines, int new_columns)
    into RE_BOLD and RE_INTENSIVE.
 */
 
-void TEScreen::reverseRendition(ca* p)
-{ cacol f = p->f; cacol b = p->b;
-  p->f = b; p->b = f; //p->r &= ~RE_TRANSPARENT;
+void TEScreen::reverseRendition(Character* p)
+{ CharacterColor f = p->m_fgColor; CharacterColor b = p->m_bgColor;
+  p->m_fgColor = b; p->m_bgColor = f; //p->r &= ~RE_TRANSPARENT;
 }
 
 void TEScreen::effectiveRendition()
@@ -583,7 +583,7 @@ void TEScreen::effectiveRendition()
     ef_bg = cu_bg;
   }
   if (cu_re & RE_BOLD)
-    ef_fg.toggleIntensive();
+    ef_fg.setIntensive();
 }
 
 /*!
@@ -596,7 +596,7 @@ void TEScreen::effectiveRendition()
 
 */
 
-ca* TEScreen::getCookedImage()
+Character* TEScreen::getCookedImage()
 {
 /*kdDebug() << "sel_begin=" << sel_begin << "(" << sel_begin/columns << "," << sel_begin%columns << ")"
   << "  sel_TL=" << sel_TL << "(" << sel_TL/columns << "," << sel_TL%columns << ")"
@@ -604,8 +604,8 @@ ca* TEScreen::getCookedImage()
   << "  histcursor=" << histCursor << endl;*/
 
   int x,y;
-  ca* merged = (ca*)malloc((lines*columns+1)*sizeof(ca));
-  ca dft(' ',cacol(CO_DFT,DEFAULT_FORE_COLOR),cacol(CO_DFT,DEFAULT_BACK_COLOR),DEFAULT_RENDITION);
+  Character* merged = (Character*)malloc((lines*columns+1)*sizeof(Character));
+  Character dft(' ',CharacterColor(COLOR_SPACE_DEFAULT,DEFAULT_FORE_COLOR),CharacterColor(COLOR_SPACE_DEFAULT,DEFAULT_BACK_COLOR),DEFAULT_RENDITION);
   merged[lines*columns] = dft;
 
 //  kdDebug(1211) << "InGetCookedImage" << endl;
@@ -660,7 +660,7 @@ ca* TEScreen::getCookedImage()
 
   int loc_ = loc(cuX, cuY+hist->getLines()-histCursor);
   if(getMode(MODE_Cursor) && loc_ < columns*lines)
-    merged[loc(cuX,cuY+(hist->getLines()-histCursor))].r|=RE_CURSOR;
+    merged[loc(cuX,cuY+(hist->getLines()-histCursor))].m_rendition|=RE_CURSOR;
   return merged;
 }
 
@@ -714,7 +714,7 @@ void TEScreen::clear()
 void TEScreen::BackSpace()
 {
   cuX = TQMAX(0,cuX-1);
-  if (BS_CLEARS) image[loc(cuX,cuY)].c = ' ';
+  if (BS_CLEARS) image[loc(cuX,cuY)].m_character = ' ';
 }
 
 /*!
@@ -820,10 +820,10 @@ void TEScreen::ShowCharacter(unsigned short c)
 
   checkSelection(i, i); // check if selection is still valid.
 
-  image[i].c = c;
-  image[i].f = ef_fg;
-  image[i].b = ef_bg;
-  image[i].r = ef_re;
+  image[i].m_character = c;
+  image[i].m_fgColor = ef_fg;
+  image[i].m_bgColor = ef_bg;
+  image[i].m_rendition = ef_re;
   
   lastPos = i;
 
@@ -834,10 +834,10 @@ void TEScreen::ShowCharacter(unsigned short c)
   while(w)
   {
      i++;
-     image[i].c = 0;
-     image[i].f = ef_fg;
-     image[i].b = ef_bg;
-     image[i].r = ef_re;
+     image[i].m_character = 0;
+     image[i].m_fgColor = ef_fg;
+     image[i].m_bgColor = ef_bg;
+     image[i].m_rendition = ef_re;
      w--;
   }
 }
@@ -847,10 +847,10 @@ void TEScreen::compose(TQString compose)
   if (lastPos == -1)
      return;
      
-  TQChar c(image[lastPos].c);
+  TQChar c(image[lastPos].m_character);
   compose.prepend(c);
   compose.compose();
-  image[lastPos].c = compose[0].unicode();
+  image[lastPos].m_character = compose[0].unicode();
 }
 
 // Region commands -------------------------------------------------------------
@@ -998,10 +998,10 @@ void TEScreen::clearImage(int loca, int loce, char c)
   {
     // Use the current colors but the default rendition
     // Check with: echo -e '\033[41;33;07m\033[2Khello world\033[00m'
-    image[i].c = c;
-    image[i].f = cu_fg;
-    image[i].b = cu_bg;
-    image[i].r = DEFAULT_RENDITION;
+    image[i].m_character = c;
+    image[i].m_fgColor = cu_fg;
+    image[i].m_bgColor = cu_bg;
+    image[i].m_rendition = DEFAULT_RENDITION;
   }
 
   for (i = loca/columns; i<=loce/columns; i++)
@@ -1023,7 +1023,7 @@ void TEScreen::moveImage(int dst, int loca, int loce)
     return;
   }
   //kdDebug(1211) << "Using memmove to scroll up" << endl;
-  memmove(&image[dst],&image[loca],(loce-loca+1)*sizeof(ca));
+  memmove(&image[dst],&image[loca],(loce-loca+1)*sizeof(Character));
   for (int i=0;i<=(loce-loca+1)/columns;i++)
     line_wrapped[(dst/columns)+i]=line_wrapped[(loca/columns)+i];
   if (lastPos != -1)
@@ -1155,8 +1155,8 @@ void TEScreen::resetRendition(int re)
 
 void TEScreen::setDefaultRendition()
 {
-  setForeColor(CO_DFT,DEFAULT_FORE_COLOR);
-  setBackColor(CO_DFT,DEFAULT_BACK_COLOR);
+  setForeColor(COLOR_SPACE_DEFAULT,DEFAULT_FORE_COLOR);
+  setBackColor(COLOR_SPACE_DEFAULT,DEFAULT_BACK_COLOR);
   cu_re   = DEFAULT_RENDITION;
   effectiveRendition();
 }
@@ -1165,7 +1165,7 @@ void TEScreen::setDefaultRendition()
 */
 void TEScreen::setForeColor(int space, int color)
 {
-  cu_fg = cacol(space, color);
+  cu_fg = CharacterColor(space, color);
   effectiveRendition();
 }
 
@@ -1173,7 +1173,7 @@ void TEScreen::setForeColor(int space, int color)
 */
 void TEScreen::setBackColor(int space, int color)
 {
-  cu_bg = cacol(space, color);
+  cu_bg = CharacterColor(space, color);
   effectiveRendition();
 }
 
@@ -1242,7 +1242,7 @@ bool TEScreen::testIsSelected(const int x,const int y)
   }
 }
 
-static bool isSpace(UINT16 c)
+static bool isSpace(uint16_t c)
 {
   if ((c > 32) && (c < 127))
      return false;
@@ -1354,7 +1354,7 @@ void TEScreen::getSelText(bool preserve_line_breaks, TQTextStream *stream)
 
 	  while (hX < eol && hX <= sel_Right % columns)
           {
-            TQ_UINT16 c = hist->getCell(hY, hX++).c;
+            TQ_UINT16 c = hist->getCell(hY, hX++).m_character;
             if (c)
               m[d++] = c;
             s++;
@@ -1366,7 +1366,7 @@ void TEScreen::getSelText(bool preserve_line_breaks, TQTextStream *stream)
       }
       else {				// or from screen image.
         if (testIsSelected((s - hist_BR) % columns, (s - hist_BR) / columns)) {
-          TQ_UINT16 c = image[s++ - hist_BR].c;
+          TQ_UINT16 c = image[s++ - hist_BR].m_character;
           if (c) {
             m[d++] = c;
             newlineneeded = true;
@@ -1407,7 +1407,7 @@ void TEScreen::getSelText(bool preserve_line_breaks, TQTextStream *stream)
 
           while (hX < eol)
           {
-              TQ_UINT16 c = hist->getCell(hY, hX++).c;
+              TQ_UINT16 c = hist->getCell(hY, hX++).m_character;
               if (c)
                  m[d++] = c;
               s++;
@@ -1456,7 +1456,7 @@ void TEScreen::getSelText(bool preserve_line_breaks, TQTextStream *stream)
         if (eol < sel_BR)
         {
             while ((eol > s) &&
-                   (!image[eol - hist_BR].c || isSpace(image[eol - hist_BR].c)) &&
+                   (!image[eol - hist_BR].m_character || isSpace(image[eol - hist_BR].m_character)) &&
                    !line_wrapped[(eol-hist_BR)/columns])
             {
                 eol--;
@@ -1474,7 +1474,7 @@ void TEScreen::getSelText(bool preserve_line_breaks, TQTextStream *stream)
 
         while (s <= eol)
         {
-            TQ_UINT16 c = image[s++ - hist_BR].c;
+            TQ_UINT16 c = image[s++ - hist_BR].m_character;
             if (c)
                  m[d++] = c;
         }
@@ -1544,7 +1544,7 @@ void TEScreen::addHistLine()
   // we have to take care about scrolling, too...
 
   if (hasScroll())
-  { ca dft;
+  { Character dft;
 
     int end = columns-1;
     while (end >= 0 && image[end] == dft && !line_wrapped[0])
diff --git a/konsole/konsole/TEScreen.h b/konsole/konsole/TEScreen.h
index a28aab949..3cb302a79 100644
--- a/konsole/konsole/TEScreen.h
+++ b/konsole/konsole/TEScreen.h
@@ -21,7 +21,7 @@
 #ifndef TESCREEN_H
 #define TESCREEN_H
 
-#include "TECommon.h"
+#include "Character.h"
 #include "TEHistory.h"
 
 #define MODE_Origin    0
@@ -147,7 +147,7 @@ public: // these are all `Screen' operations
     //
     void resizeImage(int new_lines, int new_columns);
     //
-    ca*  getCookedImage();
+    Character*  getCookedImage();
     TQBitArray getCookedLineWrapped();
 
     /*! return the number of lines. */
@@ -194,7 +194,7 @@ private: // helper
     void initTabStops();
 
     void effectiveRendition();
-    void reverseRendition(ca* p);
+    void reverseRendition(Character* p);
 
     /*
        The state of the screen is more complex as one would
@@ -210,7 +210,7 @@ private: // helper
 
     int lines;
     int columns;
-    ca *image; // [lines][columns]
+    Character *image; // [lines][columns]
     TQBitArray line_wrapped; // [lines]
 
     // history buffer ---------------
@@ -225,9 +225,9 @@ private: // helper
 
     // cursor color and rendition info
 
-    cacol cu_fg;      // foreground
-    cacol cu_bg;      // background
-    UINT8 cu_re;      // rendition
+    CharacterColor cu_fg;      // foreground
+    CharacterColor cu_bg;      // background
+    uint8_t cu_re;      // rendition
 
     // margins ----------------
 
@@ -252,9 +252,9 @@ private: // helper
 
     // effective colors and rendition ------------
 
-    cacol ef_fg;      // These are derived from
-    cacol ef_bg;      // the cu_* variables above
-    UINT8 ef_re;      // to speed up operation
+    CharacterColor ef_fg;      // These are derived from
+    CharacterColor ef_bg;      // the cu_* variables above
+    uint8_t ef_re;      // to speed up operation
 
     //
     // save cursor, rendition & states ------------
@@ -267,9 +267,9 @@ private: // helper
 
     // rendition info
 
-    UINT8 sa_cu_re;
-    cacol sa_cu_fg;
-    cacol sa_cu_bg;
+    uint8_t sa_cu_re;
+    CharacterColor sa_cu_fg;
+    CharacterColor sa_cu_bg;
     
     // last position where we added a character
     int lastPos;
diff --git a/konsole/konsole/TEWidget.cpp b/konsole/konsole/TEWidget.cpp
index 33dcf7f79..019f832eb 100644
--- a/konsole/konsole/TEWidget.cpp
+++ b/konsole/konsole/TEWidget.cpp
@@ -94,7 +94,7 @@
 #define yMouseScroll 1
 
 #define REPCHAR   "ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
-                  "abcdefgjijklmnopqrstuvwxyz" \
+                  "abcdefghijklmnopqrstuvwxyz" \
                   "0123456789./+@"
 
 extern bool argb_visual; // declared in main.cpp and konsole_part.cpp
@@ -154,7 +154,7 @@ TQColor TEWidget::getDefaultBackColor()
 {
   if (defaultBgColor.isValid())
     return defaultBgColor;
-  return color_table[DEFAULT_BACK_COLOR].color;
+  return color_table[DEFAULT_BACK_COLOR].m_color;
 }
 
 const ColorEntry* TEWidget::getColorTable() const
@@ -575,7 +575,7 @@ static void drawLineChar(TQPainter& paint, int x, int y, int w, int h, uchar cod
 }
 
 void TEWidget::drawTextFixed(TQPainter &paint, int x, int y,
-                             TQString& str, const ca *attr)
+                             TQString& str, const Character *attr)
 {
   TQString drawstr;
   unsigned int nc=0;
@@ -584,7 +584,7 @@ void TEWidget::drawTextFixed(TQPainter &paint, int x, int y,
   {
     drawstr = str.at(i);
     // Add double of the width if next c is 0;
-    if ((attr+nc+1)->c) // This may access image[image_size] See makeImage()
+    if ((attr+nc+1)->m_character) // This may access image[image_size] See makeImage()
     {
       w = font_w;
       nc++;
@@ -618,14 +618,14 @@ void TEWidget::drawTextFixed(TQPainter &paint, int x, int y,
 */
 
 void TEWidget::drawAttrStr(TQPainter &paint, TQRect rect,
-                           TQString& str, const ca *attr, bool pm, bool clear)
+                           TQString& str, const Character *attr, bool pm, bool clear)
 {
   int a = font_a + m_lineSpacing / 2;
-  TQColor fColor = printerFriendly ? TQt::black : attr->f.color(color_table);
-  TQColor bColor = attr->b.color(color_table);
+  TQColor fColor = printerFriendly ? TQt::black : attr->m_fgColor.color(color_table);
+  TQColor bColor = attr->m_bgColor.color(color_table);
   TQString drawstr;
 
-  if ((attr->r & RE_CURSOR) && !isPrinting)
+  if ((attr->m_rendition & RE_CURSOR) && !isPrinting)
     cursorRect = rect;
 
   // Paint background
@@ -635,14 +635,14 @@ void TEWidget::drawAttrStr(TQPainter &paint, TQRect rect,
     {
       if (pm)
         paint.setBackgroundMode( TQt::TransparentMode );
-      if (clear || (blinking && (attr->r & RE_BLINK))) {
+      if (clear || (blinking && (attr->m_rendition & RE_BLINK))) {
         erase(rect);
       }
     }
     else
     {
-      if (pm || clear || (blinking && (attr->r & RE_BLINK)) ||
-          (attr->b == cacol(CO_DFT, colorsSwapped ? DEFAULT_FORE_COLOR : DEFAULT_BACK_COLOR)) )
+      if (pm || clear || (blinking && (attr->m_rendition & RE_BLINK)) ||
+          (attr->m_bgColor == CharacterColor(COLOR_SPACE_DEFAULT, colorsSwapped ? DEFAULT_FORE_COLOR : DEFAULT_BACK_COLOR)) )
       {
         // draw background colors with 75% opacity
         if ( draw_translucent_background_colors && argb_visual && tqAlpha(blend_color) < 0xff )
@@ -696,7 +696,7 @@ void TEWidget::drawAttrStr(TQPainter &paint, TQRect rect,
   }
 
   // Paint cursor
-  if ((attr->r & RE_CURSOR) && !isPrinting) {
+  if ((attr->m_rendition & RE_CURSOR) && !isPrinting) {
     paint.setBackgroundMode( TQt::TransparentMode );
     int h = font_h - m_lineSpacing;
     TQRect r(rect.x(),rect.y()+m_lineSpacing/2,rect.width(),h);
@@ -715,7 +715,7 @@ void TEWidget::drawAttrStr(TQPainter &paint, TQRect rect,
     }
   }
 
-  if (!(blinking && (attr->r & RE_BLINK)))
+  if (!(blinking && (attr->m_rendition & RE_BLINK)))
   {
     // ### Disabled for now, since it causes problems with characters
     // that use the full width and/or height of the character cells.
@@ -790,7 +790,7 @@ void TEWidget::drawAttrStr(TQPainter &paint, TQRect rect,
       }
       paint.setClipping(false);
     }
-    if (attr->r & RE_UNDERLINE)
+    if (attr->m_rendition & RE_UNDERLINE)
       paint.drawLine(rect.left(), rect.y()+a+1,
                      rect.right(),rect.y()+a+1 );
   }
@@ -823,7 +823,7 @@ void TEWidget::setCursorPos(const int curx, const int cury)
     The size of the new image may or may not match the size of the widget.
 */
 
-void TEWidget::setImage(const ca* const newimg, int lines, int columns)
+void TEWidget::setImage(const Character* const newimg, int lines, int columns)
 {
   if (!image)
      updateImageSize(); // Create image
@@ -839,8 +839,8 @@ void TEWidget::setImage(const ca* const newimg, int lines, int columns)
   int    tLy = tL.y();
   hasBlinker = false;
 
-  cacol cf;       // undefined
-  cacol cb;       // undefined
+  CharacterColor cf;       // undefined
+  CharacterColor cb;       // undefined
   int   cr  = -1; // undefined
 
   int lins = TQMIN(this->lines,  TQMAX(0,lines  ));
@@ -851,8 +851,8 @@ void TEWidget::setImage(const ca* const newimg, int lines, int columns)
 //{ static int cnt = 0; printf("setImage %d\n",cnt++); }
   for (y = 0; y < lins; y++)
   {
-    const ca*       lcl = &image[y*this->columns];
-    const ca* const ext = &newimg[y*columns];
+    const Character*       lcl = &image[y*this->columns];
+    const Character* const ext = &newimg[y*columns];
 
     // The dirty mask indicates which characters need repainting. We also
     // mark surrounding neighbours dirty, in case the character exceeds
@@ -878,31 +878,31 @@ void TEWidget::setImage(const ca* const newimg, int lines, int columns)
     if (!resizing) // not while resizing, we're expecting a paintEvent
     for (x = 0; x < cols; x++)
     {
-      hasBlinker |= (ext[x].r & RE_BLINK);
+      hasBlinker |= (ext[x].m_rendition & RE_BLINK);
       // Start drawing if this character or the next one differs.
       // We also take the next one into account to handle the situation
       // where characters exceed their cell width.
       if (dirtyMask[x])
       {
-        TQ_UINT16 c = ext[x+0].c;
+        TQ_UINT16 c = ext[x+0].m_character;
         if ( !c )
             continue;
         int p = 0;
         disstrU[p++] = c; //fontMap(c);
         bool lineDraw = isLineChar(c);
-        bool doubleWidth = (ext[x+1].c == 0);
-        cr = ext[x].r;
-        cb = ext[x].b;
-        if (ext[x].f != cf) cf = ext[x].f;
+        bool doubleWidth = (ext[x+1].m_character == 0);
+        cr = ext[x].m_rendition;
+        cb = ext[x].m_bgColor;
+        if (ext[x].m_fgColor != cf) cf = ext[x].m_fgColor;
         int lln = cols - x;
         for (len = 1; len < lln; len++)
         {
-          c = ext[x+len].c;
+          c = ext[x+len].m_character;
           if (!c)
             continue; // Skip trailing part of multi-col chars.
 
-          if (ext[x+len].f != cf || ext[x+len].b != cb || ext[x+len].r != cr ||
-              !dirtyMask[x+len] || isLineChar(c) != lineDraw || (ext[x+len+1].c == 0) != doubleWidth)
+          if (ext[x+len].m_fgColor != cf || ext[x+len].m_bgColor != cb || ext[x+len].m_rendition != cr ||
+              !dirtyMask[x+len] || isLineChar(c) != lineDraw || (ext[x+len+1].m_character == 0) != doubleWidth)
             break;
 
           disstrU[p++] = c; //fontMap(c);
@@ -943,7 +943,7 @@ void TEWidget::setImage(const ca* const newimg, int lines, int columns)
     dirtyMask--; // Set back
 
     // finally, make `image' become `newimg'.
-    memcpy((void*)lcl,(const void*)ext,cols*sizeof(ca));
+    memcpy((void*)lcl,(const void*)ext,cols*sizeof(Character));
   }
   drawFrame( &paint );
   paint.end();
@@ -1125,7 +1125,7 @@ void TEWidget::paintContents(TQPainter &paint, const TQRect &rect, bool pm)
   TQChar *disstrU = new TQChar[columns];
   for (int y = luy; y <= rly; y++)
   {
-    TQ_UINT16 c = image[loc(lux,y)].c;
+    TQ_UINT16 c = image[loc(lux,y)].m_character;
     int x = lux;
     if(!c && x)
       x--; // Search for start of multi-col char
@@ -1133,28 +1133,28 @@ void TEWidget::paintContents(TQPainter &paint, const TQRect &rect, bool pm)
     {
       int len = 1;
       int p = 0;
-      c = image[loc(x,y)].c;
+      c = image[loc(x,y)].m_character;
       if (c)
          disstrU[p++] = c; //fontMap(c);
       bool lineDraw = isLineChar(c);
-      bool doubleWidth = (image[loc(x,y)+1].c == 0);
-      cacol cf = image[loc(x,y)].f;
-      cacol cb = image[loc(x,y)].b;
-      int   cr = image[loc(x,y)].r;
+      bool doubleWidth = (image[loc(x,y)+1].m_character == 0);
+      CharacterColor cf = image[loc(x,y)].m_fgColor;
+      CharacterColor cb = image[loc(x,y)].m_bgColor;
+      int   cr = image[loc(x,y)].m_rendition;
       while (x+len <= rlx &&
-             image[loc(x+len,y)].f == cf &&
-             image[loc(x+len,y)].b == cb &&
-             image[loc(x+len,y)].r == cr &&
-             (image[loc(x+len,y)+1].c == 0) == doubleWidth &&
-             isLineChar( c = image[loc(x+len,y)].c) == lineDraw) // Assignment!
+             image[loc(x+len,y)].m_fgColor == cf &&
+             image[loc(x+len,y)].m_bgColor == cb &&
+             image[loc(x+len,y)].m_rendition == cr &&
+             (image[loc(x+len,y)+1].m_character == 0) == doubleWidth &&
+             isLineChar( c = image[loc(x+len,y)].m_character) == lineDraw) // Assignment!
       {
         if (c)
           disstrU[p++] = c; //fontMap(c);
-        if (doubleWidth) // assert((image[loc(x+len,y)+1].c == 0)), see above if condition
+        if (doubleWidth) // assert((image[loc(x+len,y)+1].m_character == 0)), see above if condition
           len++; // Skip trailing part of multi-column char
         len++;
       }
-      if ((x+len < columns) && (!image[loc(x+len,y)].c))
+      if ((x+len < columns) && (!image[loc(x+len,y)].m_character))
         len++; // Adjust for trailing part of multi-column char
 
       if (!isBlinkEvent || (cr & RE_BLINK))
@@ -1217,7 +1217,7 @@ void TEWidget::propagateSize()
 
 void TEWidget::updateImageSize()
 {
-  ca* oldimg = image;
+  Character* oldimg = image;
   int oldlin = lines;
   int oldcol = columns;
   makeImage();
@@ -1228,7 +1228,7 @@ void TEWidget::updateImageSize()
   {
     for (int lin = 0; lin < lins; lin++)
       memcpy((void*)&image[columns*lin],
-             (void*)&oldimg[oldcol*lin],cols*sizeof(ca));
+             (void*)&oldimg[oldcol*lin],cols*sizeof(Character));
     free(oldimg); //FIXME: try new,delete
   }
 
@@ -1471,8 +1471,8 @@ void TEWidget::extendSelection( TQPoint pos )
     TQPoint left = left_not_right ? here : iPntSelCorr;
     i = loc(left.x(),left.y());
     if (i>=0 && i<=image_size) {
-      selClass = charClass(image[i].c);
-      while ( ((left.x()>0) || (left.y()>0 && m_line_wrapped[left.y()-1])) && charClass(image[i-1].c) == selClass )
+      selClass = charClass(image[i].m_character);
+      while ( ((left.x()>0) || (left.y()>0 && m_line_wrapped[left.y()-1])) && charClass(image[i-1].m_character) == selClass )
       { i--; if (left.x()>0) left.rx()--; else {left.rx()=columns-1; left.ry()--;} }
     }
 
@@ -1480,8 +1480,8 @@ void TEWidget::extendSelection( TQPoint pos )
     TQPoint right = left_not_right ? iPntSelCorr : here;
     i = loc(right.x(),right.y());
     if (i>=0 && i<=image_size) {
-      selClass = charClass(image[i].c);
-      while( ((right.x()<columns-1) || (right.y()<lines-1 && m_line_wrapped[right.y()])) && charClass(image[i+1].c) == selClass )
+      selClass = charClass(image[i].m_character);
+      while( ((right.x()<columns-1) || (right.y()<lines-1 && m_line_wrapped[right.y()])) && charClass(image[i+1].m_character) == selClass )
       { i++; if (right.x()<columns-1) right.rx()++; else {right.rx()=0; right.ry()++; } }
     }
 
@@ -1551,10 +1551,10 @@ void TEWidget::extendSelection( TQPoint pos )
     {
       i = loc(right.x(),right.y());
       if (i>=0 && i<=image_size) {
-        selClass = charClass(image[i-1].c);
+        selClass = charClass(image[i-1].m_character);
         if (selClass == ' ')
         {
-          while ( right.x() < columns-1 && charClass(image[i+1].c) == selClass && (right.y()<lines-1) && !m_line_wrapped[right.y()])
+          while ( right.x() < columns-1 && charClass(image[i+1].m_character) == selClass && (right.y()<lines-1) && !m_line_wrapped[right.y()])
           { i++; right.rx()++; }
           if (right.x() < columns-1)
             right = left_not_right ? iPntSelCorr : here;
@@ -1670,11 +1670,11 @@ void TEWidget::mouseDoubleClickEvent(TQMouseEvent* ev)
   word_selection_mode = true;
 
   // find word boundaries...
-  int selClass = charClass(image[i].c);
+  int selClass = charClass(image[i].m_character);
   {
     // set the start...
      int x = bgnSel.x();
-     while ( ((x>0) || (bgnSel.y()>0 && m_line_wrapped[bgnSel.y()-1])) && charClass(image[i-1].c) == selClass )
+     while ( ((x>0) || (bgnSel.y()>0 && m_line_wrapped[bgnSel.y()-1])) && charClass(image[i-1].m_character) == selClass )
      { i--; if (x>0) x--; else {x=columns-1; bgnSel.ry()--;} }
      bgnSel.setX(x);
      emit beginSelectionSignal( bgnSel.x(), bgnSel.y(), false );
@@ -1682,12 +1682,12 @@ void TEWidget::mouseDoubleClickEvent(TQMouseEvent* ev)
      // set the end...
      i = loc( endSel.x(), endSel.y() );
      x = endSel.x();
-     while( ((x<columns-1) || (endSel.y()<lines-1 && m_line_wrapped[endSel.y()])) && charClass(image[i+1].c) == selClass )
+     while( ((x<columns-1) || (endSel.y()<lines-1 && m_line_wrapped[endSel.y()])) && charClass(image[i+1].m_character) == selClass )
      { i++; if (x<columns-1) x++; else {x=0; endSel.ry()++; } }
      endSel.setX(x);
 
      // In word selection mode don't select @ (64) if at end of word.
-     if ( ( TQChar( image[i].c ) == '@' ) && ( ( endSel.x() - bgnSel.x() ) > 0 ) )
+     if ( ( TQChar( image[i].m_character ) == '@' ) && ( ( endSel.x() - bgnSel.x() ) > 0 ) )
        endSel.setX( x - 1 );
 
      actSel = 2; // within selection
@@ -1767,9 +1767,9 @@ void TEWidget::mouseTripleClickEvent(TQMouseEvent* ev)
   if (cuttobeginningofline) {
     // find word boundary start
     int i = loc(iPntSel.x(),iPntSel.y());
-    int selClass = charClass(image[i].c);
+    int selClass = charClass(image[i].m_character);
     int x = iPntSel.x();
-    while ( ((x>0) || (iPntSel.y()>0 && m_line_wrapped[iPntSel.y()-1])) && charClass(image[i-1].c) == selClass )
+    while ( ((x>0) || (iPntSel.y()>0 && m_line_wrapped[iPntSel.y()-1])) && charClass(image[i-1].m_character) == selClass )
     { i--; if (x>0) x--; else {x=columns-1; iPntSel.ry()--;} }
 
     emit beginSelectionSignal( x, iPntSel.y(), false );
@@ -1810,7 +1810,7 @@ bool TEWidget::focusNextPrevChild( bool next )
 }
 
 
-int TEWidget::charClass(UINT16 ch) const
+int TEWidget::charClass(uint16_t ch) const
 {
     TQChar qch=TQChar(ch);
     if ( qch.isSpace() ) return ' ';
@@ -2150,10 +2150,10 @@ void TEWidget::clearImage()
   // We initialize image[image_size] too. See makeImage()
   for (int i = 0; i <= image_size; i++)
   {
-    image[i].c = ' ';
-    image[i].f = cacol(CO_DFT,DEFAULT_FORE_COLOR);
-    image[i].b = cacol(CO_DFT,DEFAULT_BACK_COLOR);
-    image[i].r = DEFAULT_RENDITION;
+    image[i].m_character = ' ';
+    image[i].m_fgColor = CharacterColor(COLOR_SPACE_DEFAULT,DEFAULT_FORE_COLOR);
+    image[i].m_bgColor = CharacterColor(COLOR_SPACE_DEFAULT,DEFAULT_BACK_COLOR);
+    image[i].m_rendition = DEFAULT_RENDITION;
   }
 }
 
@@ -2206,7 +2206,7 @@ void TEWidget::makeImage()
   image_size=lines*columns;
   // We over-commit 1 character so that we can be more relaxed in dealing with
   // certain boundary conditions: image[image_size] is a valid but unused position
-  image = (ca*) malloc((image_size+1)*sizeof(ca));
+  image = (Character*) malloc((image_size+1)*sizeof(Character));
   clearImage();
 }
 
diff --git a/konsole/konsole/TEWidget.h b/konsole/konsole/TEWidget.h
index 047c04b4b..63787c000 100644
--- a/konsole/konsole/TEWidget.h
+++ b/konsole/konsole/TEWidget.h
@@ -31,7 +31,7 @@
 
 #include <tdepopupmenu.h>
 
-#include "TECommon.h"
+#include "Character.h"
 #include "TEScreen.h"
 
 
@@ -83,7 +83,7 @@ public:
     void emitSelection(bool useXselection,bool appendReturn);
     void emitText(TQString text);
 
-    void setImage(const ca* const newimg, int lines, int columns);
+    void setImage(const Character* const newimg, int lines, int columns);
     void setLineWrapped(TQBitArray line_wrapped) { m_line_wrapped=line_wrapped; }
 
     void setCursorPos(const int curx, const int cury);
@@ -185,10 +185,10 @@ protected:
     bool event( TQEvent * );
 
     void drawTextFixed(TQPainter &paint, int x, int y,
-                       TQString& str, const ca *attr);
+                       TQString& str, const Character *attr);
 
     void drawAttrStr(TQPainter &paint, TQRect rect,
-                     TQString& str, const ca *attr, bool pm, bool clear);
+                     TQString& str, const Character *attr, bool pm, bool clear);
     void paintEvent( TQPaintEvent * );
 
     void paintContents(TQPainter &paint, const TQRect &rect, bool pm=false);
@@ -220,7 +220,7 @@ protected:
       TQTextDrag       *dragObject;
     } dragInfo;
 
-    virtual int charClass(UINT16) const;
+    virtual int charClass(uint16_t) const;
 
     void clearImage();
 
@@ -256,7 +256,7 @@ private:
     int columns;
     int contentHeight;
     int contentWidth;
-    ca *image; // [lines][columns]
+    Character *image; // [lines][columns]
     int image_size;
     TQBitArray m_line_wrapped;
 
diff --git a/konsole/konsole/TEmuVt102.cpp b/konsole/konsole/TEmuVt102.cpp
index 94b937c3b..d631639e4 100644
--- a/konsole/konsole/TEmuVt102.cpp
+++ b/konsole/konsole/TEmuVt102.cpp
@@ -263,16 +263,16 @@ void TEmuVt102::pushToToken(int cc)
 #define CPS 64
 
 void TEmuVt102::initTokenizer()
-{ int i; UINT8* s;
+{ int i; uint8_t* s;
   for(i =  0;                      i < 256; i++) tbl[ i]  = 0;
   for(i =  0;                      i <  32; i++) tbl[ i] |= CTL;
   for(i = 32;                      i < 256; i++) tbl[ i] |= CHR;
-  for(s = (UINT8*)"@ABCDEFGHILMPSTXZbcdfry"; *s; s++) tbl[*s] |= CPN;
+  for(s = (uint8_t*)"@ABCDEFGHILMPSTXZbcdfry"; *s; s++) tbl[*s] |= CPN;
 // resize = \e[8;<row>;<col>t
-  for(s = (UINT8*)"t"; *s; s++) tbl[*s] |= CPS;
-  for(s = (UINT8*)"0123456789"        ; *s; s++) tbl[*s] |= DIG;
-  for(s = (UINT8*)"()+*%"             ; *s; s++) tbl[*s] |= SCS;
-  for(s = (UINT8*)"()+*#[]%"          ; *s; s++) tbl[*s] |= GRP;
+  for(s = (uint8_t*)"t"; *s; s++) tbl[*s] |= CPS;
+  for(s = (uint8_t*)"0123456789"        ; *s; s++) tbl[*s] |= DIG;
+  for(s = (uint8_t*)"()+*%"             ; *s; s++) tbl[*s] |= SCS;
+  for(s = (uint8_t*)"()+*#[]%"          ; *s; s++) tbl[*s] |= GRP;
   resetToken();
 }
 
@@ -355,13 +355,13 @@ void TEmuVt102::onRcvChar(int cc)
     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
       i += 2;
-      tau( TY_CSI_PS(cc, argv[i-2]), CO_RGB, (argv[i] << 16) | (argv[i+1] << 8) | argv[i+2]);
+      tau( TY_CSI_PS(cc, argv[i-2]), COLOR_SPACE_RGB, (argv[i] << 16) | (argv[i+1] << 8) | argv[i+2]);
       i += 2;
     }
     else if (cc == 'm' && argc - i >= 2 && (argv[i] == 38 || argv[i] == 48) && argv[i+1] == 5)
     { // ESC[ ... 48;5;<index> ... m -or- ESC[ ... 38;5;<index> ... m
       i += 2;
-      tau( TY_CSI_PS(cc, argv[i-2]), CO_256, argv[i]);
+      tau( TY_CSI_PS(cc, argv[i-2]), COLOR_SPACE_256, argv[i]);
     }
     else              { tau( TY_CSI_PS(cc,argv[i]),    0,   0); }
     resetToken();
@@ -565,49 +565,49 @@ switch( N )
     case TY_CSI_PS('m',   25) : scr->resetRendition     (RE_BLINK    ); break;
     case TY_CSI_PS('m',   27) : scr->resetRendition     (RE_REVERSE  ); break;
 
-    case TY_CSI_PS('m',   30) : scr->setForeColor         (CO_SYS,  0); break;
-    case TY_CSI_PS('m',   31) : scr->setForeColor         (CO_SYS,  1); break;
-    case TY_CSI_PS('m',   32) : scr->setForeColor         (CO_SYS,  2); break;
-    case TY_CSI_PS('m',   33) : scr->setForeColor         (CO_SYS,  3); break;
-    case TY_CSI_PS('m',   34) : scr->setForeColor         (CO_SYS,  4); break;
-    case TY_CSI_PS('m',   35) : scr->setForeColor         (CO_SYS,  5); break;
-    case TY_CSI_PS('m',   36) : scr->setForeColor         (CO_SYS,  6); break;
-    case TY_CSI_PS('m',   37) : scr->setForeColor         (CO_SYS,  7); break;
+    case TY_CSI_PS('m',   30) : scr->setForeColor         (COLOR_SPACE_SYSTEM,  0); break;
+    case TY_CSI_PS('m',   31) : scr->setForeColor         (COLOR_SPACE_SYSTEM,  1); break;
+    case TY_CSI_PS('m',   32) : scr->setForeColor         (COLOR_SPACE_SYSTEM,  2); break;
+    case TY_CSI_PS('m',   33) : scr->setForeColor         (COLOR_SPACE_SYSTEM,  3); break;
+    case TY_CSI_PS('m',   34) : scr->setForeColor         (COLOR_SPACE_SYSTEM,  4); break;
+    case TY_CSI_PS('m',   35) : scr->setForeColor         (COLOR_SPACE_SYSTEM,  5); break;
+    case TY_CSI_PS('m',   36) : scr->setForeColor         (COLOR_SPACE_SYSTEM,  6); break;
+    case TY_CSI_PS('m',   37) : scr->setForeColor         (COLOR_SPACE_SYSTEM,  7); break;
 
     case TY_CSI_PS('m',   38) : scr->setForeColor         (p,       q); break;
 
-    case TY_CSI_PS('m',   39) : scr->setForeColor         (CO_DFT,  0); break;
+    case TY_CSI_PS('m',   39) : scr->setForeColor         (COLOR_SPACE_DEFAULT,  0); break;
 
-    case TY_CSI_PS('m',   40) : scr->setBackColor         (CO_SYS,  0); break;
-    case TY_CSI_PS('m',   41) : scr->setBackColor         (CO_SYS,  1); break;
-    case TY_CSI_PS('m',   42) : scr->setBackColor         (CO_SYS,  2); break;
-    case TY_CSI_PS('m',   43) : scr->setBackColor         (CO_SYS,  3); break;
-    case TY_CSI_PS('m',   44) : scr->setBackColor         (CO_SYS,  4); break;
-    case TY_CSI_PS('m',   45) : scr->setBackColor         (CO_SYS,  5); break;
-    case TY_CSI_PS('m',   46) : scr->setBackColor         (CO_SYS,  6); break;
-    case TY_CSI_PS('m',   47) : scr->setBackColor         (CO_SYS,  7); break;
+    case TY_CSI_PS('m',   40) : scr->setBackColor         (COLOR_SPACE_SYSTEM,  0); break;
+    case TY_CSI_PS('m',   41) : scr->setBackColor         (COLOR_SPACE_SYSTEM,  1); break;
+    case TY_CSI_PS('m',   42) : scr->setBackColor         (COLOR_SPACE_SYSTEM,  2); break;
+    case TY_CSI_PS('m',   43) : scr->setBackColor         (COLOR_SPACE_SYSTEM,  3); break;
+    case TY_CSI_PS('m',   44) : scr->setBackColor         (COLOR_SPACE_SYSTEM,  4); break;
+    case TY_CSI_PS('m',   45) : scr->setBackColor         (COLOR_SPACE_SYSTEM,  5); break;
+    case TY_CSI_PS('m',   46) : scr->setBackColor         (COLOR_SPACE_SYSTEM,  6); break;
+    case TY_CSI_PS('m',   47) : scr->setBackColor         (COLOR_SPACE_SYSTEM,  7); break;
 
     case TY_CSI_PS('m',   48) : scr->setBackColor         (p,       q); break;
 
-    case TY_CSI_PS('m',   49) : scr->setBackColor         (CO_DFT,  1); break;
-
-    case TY_CSI_PS('m',   90) : scr->setForeColor         (CO_SYS,  8); break;
-    case TY_CSI_PS('m',   91) : scr->setForeColor         (CO_SYS,  9); break;
-    case TY_CSI_PS('m',   92) : scr->setForeColor         (CO_SYS, 10); break;
-    case TY_CSI_PS('m',   93) : scr->setForeColor         (CO_SYS, 11); break;
-    case TY_CSI_PS('m',   94) : scr->setForeColor         (CO_SYS, 12); break;
-    case TY_CSI_PS('m',   95) : scr->setForeColor         (CO_SYS, 13); break;
-    case TY_CSI_PS('m',   96) : scr->setForeColor         (CO_SYS, 14); break;
-    case TY_CSI_PS('m',   97) : scr->setForeColor         (CO_SYS, 15); break;
-
-    case TY_CSI_PS('m',  100) : scr->setBackColor         (CO_SYS,  8); break;
-    case TY_CSI_PS('m',  101) : scr->setBackColor         (CO_SYS,  9); break;
-    case TY_CSI_PS('m',  102) : scr->setBackColor         (CO_SYS, 10); break;
-    case TY_CSI_PS('m',  103) : scr->setBackColor         (CO_SYS, 11); break;
-    case TY_CSI_PS('m',  104) : scr->setBackColor         (CO_SYS, 12); break;
-    case TY_CSI_PS('m',  105) : scr->setBackColor         (CO_SYS, 13); break;
-    case TY_CSI_PS('m',  106) : scr->setBackColor         (CO_SYS, 14); break;
-    case TY_CSI_PS('m',  107) : scr->setBackColor         (CO_SYS, 15); break;
+    case TY_CSI_PS('m',   49) : scr->setBackColor         (COLOR_SPACE_DEFAULT,  1); break;
+
+    case TY_CSI_PS('m',   90) : scr->setForeColor         (COLOR_SPACE_SYSTEM,  8); break;
+    case TY_CSI_PS('m',   91) : scr->setForeColor         (COLOR_SPACE_SYSTEM,  9); break;
+    case TY_CSI_PS('m',   92) : scr->setForeColor         (COLOR_SPACE_SYSTEM, 10); break;
+    case TY_CSI_PS('m',   93) : scr->setForeColor         (COLOR_SPACE_SYSTEM, 11); break;
+    case TY_CSI_PS('m',   94) : scr->setForeColor         (COLOR_SPACE_SYSTEM, 12); break;
+    case TY_CSI_PS('m',   95) : scr->setForeColor         (COLOR_SPACE_SYSTEM, 13); break;
+    case TY_CSI_PS('m',   96) : scr->setForeColor         (COLOR_SPACE_SYSTEM, 14); break;
+    case TY_CSI_PS('m',   97) : scr->setForeColor         (COLOR_SPACE_SYSTEM, 15); break;
+
+    case TY_CSI_PS('m',  100) : scr->setBackColor         (COLOR_SPACE_SYSTEM,  8); break;
+    case TY_CSI_PS('m',  101) : scr->setBackColor         (COLOR_SPACE_SYSTEM,  9); break;
+    case TY_CSI_PS('m',  102) : scr->setBackColor         (COLOR_SPACE_SYSTEM, 10); break;
+    case TY_CSI_PS('m',  103) : scr->setBackColor         (COLOR_SPACE_SYSTEM, 11); break;
+    case TY_CSI_PS('m',  104) : scr->setBackColor         (COLOR_SPACE_SYSTEM, 12); break;
+    case TY_CSI_PS('m',  105) : scr->setBackColor         (COLOR_SPACE_SYSTEM, 13); break;
+    case TY_CSI_PS('m',  106) : scr->setBackColor         (COLOR_SPACE_SYSTEM, 14); break;
+    case TY_CSI_PS('m',  107) : scr->setBackColor         (COLOR_SPACE_SYSTEM, 15); break;
 
     case TY_CSI_PS('n',    5) :      reportStatus         (          ); break;
     case TY_CSI_PS('n',    6) :      reportCursorPosition (          ); break;
diff --git a/konsole/konsole/TEmulation.cpp b/konsole/konsole/TEmulation.cpp
index 4a4c709e4..4c4ff5146 100644
--- a/konsole/konsole/TEmulation.cpp
+++ b/konsole/konsole/TEmulation.cpp
@@ -537,7 +537,7 @@ void TEmulation::showBulk()
 
   if (connected)
   {
-    ca* image = scr->getCookedImage();    // get the image
+    Character* image = scr->getCookedImage();    // get the image
     gui->setImage(image,
                   scr->getLines(),
                   scr->getColumns());     // actual refresh
diff --git a/konsole/konsole/konsole_wcwidth.cpp b/konsole/konsole/konsole_wcwidth.cpp
index 5159dfca7..088dc90b6 100644
--- a/konsole/konsole/konsole_wcwidth.cpp
+++ b/konsole/konsole/konsole_wcwidth.cpp
@@ -131,7 +131,7 @@ int konsole_wcwidth_normal(TQ_UINT16 ucs)
       (ucs >= 0xf900 && ucs <= 0xfaff) || /* CJK Compatibility Ideographs */
       (ucs >= 0xfe30 && ucs <= 0xfe6f) || /* CJK Compatibility Forms */
       (ucs >= 0xff00 && ucs <= 0xff5f) || /* Fullwidth Forms */
-      (ucs >= 0xffe0 && ucs <= 0xffe6) /* do not compare UINT16 with 0x20000 ||
+      (ucs >= 0xffe0 && ucs <= 0xffe6) /* do not compare uint16_t with 0x20000 ||
       (ucs >= 0x20000 && ucs <= 0x2ffff) */));
 }
 
diff --git a/konsole/konsole/schema.cpp b/konsole/konsole/schema.cpp
index cf80136f3..cb974a47a 100644
--- a/konsole/konsole/schema.cpp
+++ b/konsole/konsole/schema.cpp
@@ -197,9 +197,9 @@ void ColorSchema::clearSchema()
 
   for (i = 0; i < TABLE_COLORS; i++)
   {
-    m_table[i].color       = TQColor(0,0,0);
-    m_table[i].transparent = 0;
-    m_table[i].bold        = 0;
+    m_table[i].m_color       = TQColor(0,0,0);
+    m_table[i].m_transparent = 0;
+    m_table[i].m_bold        = 0;
   }
   m_title     = i18n("[no title]");
   m_imagePath = "";
@@ -246,9 +246,9 @@ void ColorSchema::writeConfigColor(TDEConfig& c,
 {
   TDEConfigGroupSaver(&c,name);
   c.setGroup(name);
-  c.writeEntry("Color",e.color);
-  c.writeEntry("Transparency",(bool) e.transparent);
-  c.writeEntry("Bold",(bool) e.bold);
+  c.writeEntry("Color",e.m_color);
+  c.writeEntry("Transparency",(bool) e.m_transparent);
+  c.writeEntry("Bold",(bool) e.m_bold);
 }
 
 void ColorSchema::readConfigColor(TDEConfig& c,
@@ -258,9 +258,9 @@ void ColorSchema::readConfigColor(TDEConfig& c,
   TDEConfigGroupSaver(&c,name);
   c.setGroup(name);
 
-  e.color = c.readColorEntry("Color");
-  e.transparent = c.readBoolEntry("Transparent",false);
-  e.bold = c.readBoolEntry("Bold",false);
+  e.m_color = c.readColorEntry("Color");
+  e.m_transparent = c.readBoolEntry("Transparent",false);
+  e.m_bold = c.readBoolEntry("Bold",false);
 }
 
 
@@ -362,10 +362,10 @@ bool ColorSchema::rereadSchemaFile()
         if (!(0 <= cv && cv <= 255         )) continue;
         if (!(0 <= tr && tr <= 1           )) continue;
         if (!(0 <= bo && bo <= 1           )) continue;
-        m_table[fi].color       = TQColor();
-        m_table[fi].color.setHsv(ch,cs,cv);
-        m_table[fi].transparent = tr;
-        m_table[fi].bold        = bo;
+        m_table[fi].m_color       = TQColor();
+        m_table[fi].m_color.setHsv(ch,cs,cv);
+        m_table[fi].m_transparent = tr;
+        m_table[fi].m_bold        = bo;
       }
       if (!strncmp(line,"color",5))
       { int fi,cr,cg,cb,tr,bo;
@@ -377,9 +377,9 @@ bool ColorSchema::rereadSchemaFile()
         if (!(0 <= cb && cb <= 255         )) continue;
         if (!(0 <= tr && tr <= 1           )) continue;
         if (!(0 <= bo && bo <= 1           )) continue;
-        m_table[fi].color       = TQColor(cr,cg,cb);
-        m_table[fi].transparent = tr;
-        m_table[fi].bold        = bo;
+        m_table[fi].m_color       = TQColor(cr,cg,cb);
+        m_table[fi].m_transparent = tr;
+        m_table[fi].m_bold        = bo;
       }
       if (!strncmp(line,"sysfg",5))
       { int fi,tr,bo;
@@ -388,9 +388,9 @@ bool ColorSchema::rereadSchemaFile()
         if (!(0 <= fi && fi <= TABLE_COLORS)) continue;
         if (!(0 <= tr && tr <= 1           )) continue;
         if (!(0 <= bo && bo <= 1           )) continue;
-        m_table[fi].color       = tdeApp->palette().active().text();
-        m_table[fi].transparent = tr;
-        m_table[fi].bold        = bo;
+        m_table[fi].m_color       = tdeApp->palette().active().text();
+        m_table[fi].m_transparent = tr;
+        m_table[fi].m_bold        = bo;
       }
       if (!strncmp(line,"sysbg",5))
       { int fi,tr,bo;
@@ -399,9 +399,9 @@ bool ColorSchema::rereadSchemaFile()
         if (!(0 <= fi && fi <= TABLE_COLORS)) continue;
         if (!(0 <= tr && tr <= 1           )) continue;
         if (!(0 <= bo && bo <= 1           )) continue;
-        m_table[fi].color       = tdeApp->palette().active().base();
-        m_table[fi].transparent = tr;
-        m_table[fi].bold        = bo;
+        m_table[fi].m_color       = tdeApp->palette().active().base();
+        m_table[fi].m_transparent = tr;
+        m_table[fi].m_bold        = bo;
       }
     }
   }
diff --git a/konsole/konsole/schema.h b/konsole/konsole/schema.h
index c32f26221..01fcaf729 100644
--- a/konsole/konsole/schema.h
+++ b/konsole/konsole/schema.h
@@ -44,7 +44,7 @@
 #include <tqstring.h>
 #include <tqptrlist.h>
 
-#include "TECommon.h"
+#include "CharacterColor.h"
 
 #ifndef KONSOLEDEBUG
 /*
-- 
cgit v1.2.3

