From 1d738cd9c586dcbcaeee9e45df04c77cf27694ca Mon Sep 17 00:00:00 2001 From: Waldo Bastian Date: Sun, 1 Sep 2002 05:14:24 +0000 Subject: [PATCH] CCMAIL: 37770-done@bugs.kde.org Add support CBT and CHT (backward tab and forward tab) svn path=/trunk/kdebase/konsole/; revision=174983 --- konsole/TEScreen.cpp | 20 ++++++++++++++++++-- konsole/TEScreen.h | 3 ++- konsole/TEmuVt102.cpp | 16 +++++++++------- 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/konsole/TEScreen.cpp b/konsole/TEScreen.cpp index 84647ea0..2403ebaf 100644 --- a/konsole/TEScreen.cpp +++ b/konsole/TEScreen.cpp @@ -650,10 +650,26 @@ void TEScreen::BackSpace() /*! */ -void TEScreen::Tabulate() +void TEScreen::Tabulate(int n) { // note that TAB is a format effector (does not write ' '); - cursorRight(1); while(cuX < columns-1 && !tabstops[cuX]) cursorRight(1); + if (n == 0) n = 1; + while((n > 0) && (cuX < columns-1)) + { + cursorRight(1); while((cuX < columns-1) && !tabstops[cuX]) cursorRight(1); + n--; + } +} + +void TEScreen::backTabulate(int n) +{ + // note that TAB is a format effector (does not write ' '); + if (n == 0) n = 1; + while((n > 0) && (cuX > 0)) + { + cursorLeft(1); while((cuX > 0) && !tabstops[cuX]) cursorLeft(1); + n--; + } } void TEScreen::clearTabStops() diff --git a/konsole/TEScreen.h b/konsole/TEScreen.h index bc215238..69976e80 100644 --- a/konsole/TEScreen.h +++ b/konsole/TEScreen.h @@ -65,7 +65,8 @@ public: // these are all `Screen' operations // void Return (); void BackSpace (); - void Tabulate (); + void Tabulate (int n = 1); + void backTabulate(int n); // // Editing // diff --git a/konsole/TEmuVt102.cpp b/konsole/TEmuVt102.cpp index d3f9a0df..e722a8cf 100644 --- a/konsole/TEmuVt102.cpp +++ b/konsole/TEmuVt102.cpp @@ -257,13 +257,13 @@ void TEmuVt102::pushToToken(int cc) void TEmuVt102::initTokenizer() { int i; UINT8* 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*)"@ABCDGHLMPXcdfry"; *s; s++) tbl[*s] |= CPN; - 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(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*)"@ABCDGHILMPXZcdfry"; *s; s++) tbl[*s] |= CPN; + 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; resetToken(); } @@ -559,10 +559,12 @@ void TEmuVt102::tau( int token, int p, int q ) case TY_CSI_PN('D' ) : scr->cursorLeft (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; case TY_CSI_PN('L' ) : scr->insertLines (p ); break; case TY_CSI_PN('M' ) : scr->deleteLines (p ); break; case TY_CSI_PN('P' ) : scr->deleteChars (p ); break; case TY_CSI_PN('X' ) : scr->eraseChars (p ); break; + case TY_CSI_PN('Z' ) : scr->backTabulate (p ); break; case TY_CSI_PN('c' ) : reportTerminalType ( ); break; //VT100 case TY_CSI_PN('d' ) : scr->setCursorY (p ); break; //LINUX case TY_CSI_PN('f' ) : scr->setCursorYX (p, q); break; //VT100