Backported commit 66c83048 from KDE's Konsole source code.

66c830484c
This relates to issue TDE/tde#71.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>

-------------------------------------------------------------
Original commit info:
From: Luis Alves <luisalves05@gmail.com>
Date: Wed, 10 Jun 2020 17:34:15 -0300
Subject: Add new ANSI sequences CNL and CPL

- It implements Cursor Next Line (CNL) sequence.
- It implments Cursor Previous Line (CPL) sequence.
- Ex: echo -e "Hello\e[3EWorld" or echo -e "Hello\e[3FWorld"
-------------------------------------------------------------
pull/240/head
Michele Calgaro 2 years ago
parent 013b337217
commit d397267391
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -192,6 +192,43 @@ void TEScreen::cursorRight(int n)
Set top and bottom margin. Set top and bottom margin.
*/ */
void TEScreen::cursorNextLine(int n)
//=CNL
{
if (n == 0)
{
n = 1; // Default
}
cuX = 0;
while (n > 0)
{
if (cuY < lines - 1)
{
cuY += 1;
}
n--;
}
}
void TEScreen::cursorPrevLine(int n)
//=CPL
{
if (n == 0)
{
n = 1; // Default
}
cuX = 0;
while (n > 0)
{
if (cuY > 0)
{
cuY -= 1;
}
n--;
}
}
void TEScreen::setMargins(int top, int bot) void TEScreen::setMargins(int top, int bot)
//=STBM //=STBM
{ {

@ -52,14 +52,16 @@ public: // these are all `Screen' operations
// //
// Cursor Movement // Cursor Movement
// //
void cursorUp (int n); void cursorUp (int n);
void cursorDown (int n); void cursorDown (int n);
void cursorLeft (int n); void cursorLeft (int n);
void cursorRight (int n); void cursorRight (int n);
void setCursorY (int y); void cursorNextLine(int n);
void setCursorX (int x); void cursorPrevLine(int n);
void setCursorYX (int y, int x); void setCursorY (int y);
void setMargins (int t, int b); void setCursorX (int x);
void setCursorYX (int y, int x);
void setMargins (int t, int b);
// //
// Cursor Movement with Scrolling // Cursor Movement with Scrolling
// //

@ -172,7 +172,7 @@ void TEmuVt102::reset()
// Tokens ------------------------------------------------------------------ -- // Tokens ------------------------------------------------------------------ --
/* /*
Since the tokens are the central notion if this section, we've put them Since the tokens are the central notion in this section, we've put them
in front. They provide the syntactical elements used to represent the in front. They provide the syntactical elements used to represent the
terminals operations as byte sequences. terminals operations as byte sequences.
@ -267,7 +267,7 @@ void TEmuVt102::initTokenizer()
for(i = 0; i < 256; i++) tbl[ i] = 0; for(i = 0; i < 256; i++) tbl[ i] = 0;
for(i = 0; i < 32; i++) tbl[ i] |= CTL; for(i = 0; i < 32; i++) tbl[ i] |= CTL;
for(i = 32; i < 256; i++) tbl[ i] |= CHR; for(i = 32; i < 256; i++) tbl[ i] |= CHR;
for(s = (UINT8*)"@ABCDGHILMPSTXZbcdfry"; *s; s++) tbl[*s] |= CPN; for(s = (UINT8*)"@ABCDEFGHILMPSTXZbcdfry"; *s; s++) tbl[*s] |= CPN;
// resize = \e[8;<row>;<col>t // resize = \e[8;<row>;<col>t
for(s = (UINT8*)"t"; *s; s++) tbl[*s] |= CPS; for(s = (UINT8*)"t"; *s; s++) tbl[*s] |= CPS;
for(s = (UINT8*)"0123456789" ; *s; s++) tbl[*s] |= DIG; for(s = (UINT8*)"0123456789" ; *s; s++) tbl[*s] |= DIG;
@ -621,6 +621,8 @@ switch( N )
case TY_CSI_PN('B' ) : scr->cursorDown (p ); break; //VT100 case TY_CSI_PN('B' ) : scr->cursorDown (p ); break; //VT100
case TY_CSI_PN('C' ) : scr->cursorRight (p ); break; //VT100 case TY_CSI_PN('C' ) : scr->cursorRight (p ); break; //VT100
case TY_CSI_PN('D' ) : scr->cursorLeft (p ); break; //VT100 case TY_CSI_PN('D' ) : scr->cursorLeft (p ); break; //VT100
case TY_CSI_PN('E' ) : scr->cursorNextLine (p ); break; //VT100
case TY_CSI_PN('F' ) : scr->cursorPrevLine (p ); break; //VT100
case TY_CSI_PN('G' ) : scr->setCursorX (p ); break; //LINUX case TY_CSI_PN('G' ) : scr->setCursorX (p ); break; //LINUX
case TY_CSI_PN('H' ) : scr->setCursorYX (p, q); break; //VT100 case TY_CSI_PN('H' ) : scr->setCursorYX (p, q); break; //VT100
case TY_CSI_PN('I' ) : scr->Tabulate (p ); break; case TY_CSI_PN('I' ) : scr->Tabulate (p ); break;

Loading…
Cancel
Save