summaryrefslogtreecommitdiffstats
path: root/konsole/konsole/TEScreen.cpp
diff options
context:
space:
mode:
authorKurt Hindenburg <kurt.hindenburg@gmail.com>2018-02-04 14:09:28 -0500
committerSlávek Banko <slavek.banko@axis.cz>2021-10-11 10:03:11 +0200
commit4934beb5506ba7564e0f397781cd7fe7d49eb0c0 (patch)
tree0206b9796b965245847719db4f2354b9874fcc08 /konsole/konsole/TEScreen.cpp
parent6a2392888f03f6efb263ba83e63125b19d0a9733 (diff)
downloadtdebase-4934beb5506ba7564e0f397781cd7fe7d49eb0c0.tar.gz
tdebase-4934beb5506ba7564e0f397781cd7fe7d49eb0c0.zip
Konsole: Add support for ECMA-48 REP: repeating previous character
Patch by btown using lxde/qtermwidget@60221da by @yan12125 ECMA-48 8.3.103 describes the sequence CSI Pn b for repeating the previous character in the data stream. This sequence has been present in XTerm since January 1997 and has been added to the latest terminfo entry for xterm-new and derived entries such as xterm-256color. https://phabricator.kde.org/D10064 Taken from KDE patches and adapted to TDE. Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'konsole/konsole/TEScreen.cpp')
-rw-r--r--konsole/konsole/TEScreen.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/konsole/konsole/TEScreen.cpp b/konsole/konsole/TEScreen.cpp
index 9bd62ff4d..d1d7985a5 100644
--- a/konsole/konsole/TEScreen.cpp
+++ b/konsole/konsole/TEScreen.cpp
@@ -81,7 +81,8 @@ TEScreen::TEScreen(int l, int c)
ef_fg(cacol()), ef_bg(cacol()), ef_re(0),
sa_cuX(0), sa_cuY(0),
sa_cu_re(0), sa_cu_fg(cacol()), sa_cu_bg(cacol()),
- lastPos(-1)
+ lastPos(-1),
+ lastDrawnChar(0)
{
/*
this->lines = lines;
@@ -300,6 +301,26 @@ void TEScreen::insertChars(int n)
clearImage(loc(cuX,cuY),loc(q-1,cuY),' ');
}
+void TEScreen::repeatChars(int n)
+{
+ if (n == 0)
+ {
+ n = 1; // Default
+ }
+
+ // From ECMA-48 version 5, section 8.3.103:
+ // "If the character preceding REP is a control function or part of a
+ // control function, the effect of REP is not defined by this Standard."
+ //
+ // So, a "normal" program should always use REP immediately after a visible
+ // character (those other than escape sequences). So, lastDrawnChar can be
+ // safely used.
+ for (int i = 0; i < n; i++)
+ {
+ ShowCharacter(lastDrawnChar);
+ }
+}
+
/*! delete `n' lines starting from (including) the cursor position.
The cursor is not moved by the operation.
@@ -762,6 +783,8 @@ void TEScreen::ShowCharacter(unsigned short c)
lastPos = i;
+ lastDrawnChar = c;
+
cuX += w--;
while(w)