summaryrefslogtreecommitdiffstats
path: root/konsole/konsole/TEScreen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'konsole/konsole/TEScreen.cpp')
-rw-r--r--konsole/konsole/TEScreen.cpp97
1 files changed, 85 insertions, 12 deletions
diff --git a/konsole/konsole/TEScreen.cpp b/konsole/konsole/TEScreen.cpp
index 9bd62ff4d..8f2473e31 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;
@@ -175,7 +176,7 @@ void TEScreen::cursorLeft(int n)
}
/*!
- Move the cursor left.
+ Move the cursor right.
The cursor will not move beyond the rightmost column.
*/
@@ -188,6 +189,50 @@ void TEScreen::cursorRight(int n)
}
/*!
+ Move the cursor at most n lines next
+*/
+
+void TEScreen::cursorNextLine(int n)
+//=CNL
+{
+ if (n == 0)
+ {
+ n = 1; // Default
+ }
+ cuX = 0;
+ while (n > 0)
+ {
+ if (cuY < lines - 1)
+ {
+ cuY += 1;
+ }
+ n--;
+ }
+}
+
+/*!
+ Move the cursor at most n lines previous
+*/
+
+void TEScreen::cursorPrevLine(int n)
+//=CPL
+{
+ if (n == 0)
+ {
+ n = 1; // Default
+ }
+ cuX = 0;
+ while (n > 0)
+ {
+ if (cuY > 0)
+ {
+ cuY -= 1;
+ }
+ n--;
+ }
+}
+
+/*!
Set top and bottom margin.
*/
@@ -300,6 +345,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 +827,8 @@ void TEScreen::ShowCharacter(unsigned short c)
lastPos = i;
+ lastDrawnChar = c;
+
cuX += w--;
while(w)
@@ -802,10 +869,22 @@ void TEScreen::scrollUp(int n)
void TEScreen::scrollUp(int from, int n)
{
- if (n <= 0 || from + n > bmargin) return;
- //FIXME: make sure `tmargin', `bmargin', `from', `n' is in bounds.
- moveImage(loc(0,from),loc(0,from+n),loc(columns-1,bmargin));
- clearImage(loc(0,bmargin-n+1),loc(columns-1,bmargin),' ');
+ if (n <= 0)
+ {
+ return;
+ }
+ if (from > bmargin)
+ {
+ return;
+ }
+ if ((from + n) > bmargin)
+ {
+ n = bmargin + 1 - from;
+ }
+
+ //FIXME: make sure `tmargin', `bmargin', `from', `n' is in bounds.
+ moveImage(loc(0, from), loc(0, from+n), loc(columns, bmargin));
+ clearImage(loc(0, bmargin-n+1), loc(columns-1, bmargin), ' ');
}
void TEScreen::scrollDown(int n)
@@ -1013,12 +1092,6 @@ void TEScreen::clearToBeginOfScreen()
void TEScreen::clearEntireScreen()
{
- // Add entire screen to history
- for (int i = 0; i < (lines-1); i++)
- {
- addHistLine(); scrollUp(0,1);
- }
-
clearImage(loc(0,0),loc(columns-1,lines-1),' ');
}