diff --git a/lib/Screen.cpp b/lib/Screen.cpp index fa03652..6104764 100644 --- a/lib/Screen.cpp +++ b/lib/Screen.cpp @@ -226,6 +226,28 @@ void Screen::insertChars(int n) screenLines[cuY].resize(columns); } +void Screen::repeatChars(int count) + //=REP +{ + if (count == 0) + { + count = 1; + } + /** + * 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 < count; i++) + { + displayCharacter(lastDrawnChar); + } +} + void Screen::deleteLines(int n) { if (n == 0) n = 1; // Default @@ -663,6 +685,8 @@ void Screen::displayCharacter(unsigned short c) currentChar.backgroundColor = effectiveBackground; currentChar.rendition = effectiveRendition; + lastDrawnChar = c; + int i = 0; int newCursorX = cuX + w--; while(w) diff --git a/lib/Screen.h b/lib/Screen.h index 6316ad4..ea526ac 100644 --- a/lib/Screen.h +++ b/lib/Screen.h @@ -197,6 +197,11 @@ public: * If @p n is 0 then one character is inserted. */ void insertChars(int n); + /** + * Repeat the preceeding graphic character @count times, including SPACE. + * If @count is 0 then the character is repeated once. + */ + void repeatChars(int count); /** * Removes @p n lines beginning from the current cursor position. * The position of the cursor is not altered. @@ -667,6 +672,9 @@ private: // last position where we added a character int lastPos; + // used in REP (repeating char) + unsigned short lastDrawnChar; + static Character defaultChar; }; diff --git a/lib/Vt102Emulation.cpp b/lib/Vt102Emulation.cpp index dc77a9d..077ad9f 100644 --- a/lib/Vt102Emulation.cpp +++ b/lib/Vt102Emulation.cpp @@ -224,7 +224,7 @@ void Vt102Emulation::initTokenizer() charClass[i] |= CTL; for(i = 32;i < 256; ++i) charClass[i] |= CHR; - for(s = (quint8*)"@ABCDGHILMPSTXZcdfry"; *s; ++s) + for(s = (quint8*)"@ABCDGHILMPSTXZbcdfry"; *s; ++s) charClass[*s] |= CPN; // resize = \e[8;;t for(s = (quint8*)"t"; *s; ++s) @@ -667,6 +667,7 @@ void Vt102Emulation::processToken(int token, int p, int q) case TY_CSI_PN('T' ) : _currentScreen->scrollDown (p ); break; case TY_CSI_PN('X' ) : _currentScreen->eraseChars (p ); break; case TY_CSI_PN('Z' ) : _currentScreen->backtab (p ); break; + case TY_CSI_PN('b' ) : _currentScreen->repeatChars (p ); break; case TY_CSI_PN('c' ) : reportTerminalType ( ); break; //VT100 case TY_CSI_PN('d' ) : _currentScreen->setCursorY (p ); break; //LINUX case TY_CSI_PN('f' ) : _currentScreen->setCursorYX (p, q); break; //VT100