diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2021-12-13 16:28:32 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2021-12-13 18:49:08 +0900 |
commit | d397267391a4bbf21bf070e4c0f19b618914aab2 (patch) | |
tree | a0bb9d551a14a7f2620bdc01b1a036f94df1dabd /konsole | |
parent | 013b337217f10bf5f9d027757c5d4cc8fbb19988 (diff) | |
download | tdebase-d397267391a4bbf21bf070e4c0f19b618914aab2.tar.gz tdebase-d397267391a4bbf21bf070e4c0f19b618914aab2.zip |
Backported commit 66c83048 from KDE's Konsole source code.
https://invent.kde.org/utilities/konsole/-/commit/66c830484c3e042284b23114ab51f99a706cea9e
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"
-------------------------------------------------------------
Diffstat (limited to 'konsole')
-rw-r--r-- | konsole/konsole/TEScreen.cpp | 37 | ||||
-rw-r--r-- | konsole/konsole/TEScreen.h | 18 | ||||
-rw-r--r-- | konsole/konsole/TEmuVt102.cpp | 6 |
3 files changed, 51 insertions, 10 deletions
diff --git a/konsole/konsole/TEScreen.cpp b/konsole/konsole/TEScreen.cpp index f0ca2b176..cd8c07b31 100644 --- a/konsole/konsole/TEScreen.cpp +++ b/konsole/konsole/TEScreen.cpp @@ -192,6 +192,43 @@ void TEScreen::cursorRight(int n) 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) //=STBM { diff --git a/konsole/konsole/TEScreen.h b/konsole/konsole/TEScreen.h index 557a07e4c..a28aab949 100644 --- a/konsole/konsole/TEScreen.h +++ b/konsole/konsole/TEScreen.h @@ -52,14 +52,16 @@ public: // these are all `Screen' operations // // Cursor Movement // - void cursorUp (int n); - void cursorDown (int n); - void cursorLeft (int n); - void cursorRight (int n); - void setCursorY (int y); - void setCursorX (int x); - void setCursorYX (int y, int x); - void setMargins (int t, int b); + void cursorUp (int n); + void cursorDown (int n); + void cursorLeft (int n); + void cursorRight (int n); + void cursorNextLine(int n); + void cursorPrevLine(int n); + void setCursorY (int y); + void setCursorX (int x); + void setCursorYX (int y, int x); + void setMargins (int t, int b); // // Cursor Movement with Scrolling // diff --git a/konsole/konsole/TEmuVt102.cpp b/konsole/konsole/TEmuVt102.cpp index b5ca0ea5b..fb38b6e18 100644 --- a/konsole/konsole/TEmuVt102.cpp +++ b/konsole/konsole/TEmuVt102.cpp @@ -172,7 +172,7 @@ void TEmuVt102::reset() // 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 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 < 32; i++) tbl[ i] |= CTL; 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 for(s = (UINT8*)"t"; *s; s++) tbl[*s] |= CPS; 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('C' ) : scr->cursorRight (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('H' ) : scr->setCursorYX (p, q); break; //VT100 case TY_CSI_PN('I' ) : scr->Tabulate (p ); break; |