Terminal: implement ECMA-48 "REP"
fix #16724 Change-Id: Ie9f8252393a65a0101a6d78db2360f48bb52bc73 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3607 Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
b9e03b90a5
commit
242adb20f3
@@ -121,7 +121,8 @@ BasicTerminalBuffer::BasicTerminalBuffer()
|
|||||||
fSavedOriginMode(false),
|
fSavedOriginMode(false),
|
||||||
fTabStops(NULL),
|
fTabStops(NULL),
|
||||||
fEncoding(M_UTF8),
|
fEncoding(M_UTF8),
|
||||||
fCaptureFile(-1)
|
fCaptureFile(-1),
|
||||||
|
fLast()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -625,6 +626,7 @@ BasicTerminalBuffer::InsertChar(UTF8Char c)
|
|||||||
{
|
{
|
||||||
//debug_printf("BasicTerminalBuffer::InsertChar('%.*s' (%d), %#lx)\n",
|
//debug_printf("BasicTerminalBuffer::InsertChar('%.*s' (%d), %#lx)\n",
|
||||||
//(int)c.ByteCount(), c.bytes, c.bytes[0], attributes);
|
//(int)c.ByteCount(), c.bytes, c.bytes[0], attributes);
|
||||||
|
fLast = c;
|
||||||
int32 width = c.IsFullWidth() ? FULL_WIDTH : HALF_WIDTH;
|
int32 width = c.IsFullWidth() ? FULL_WIDTH : HALF_WIDTH;
|
||||||
|
|
||||||
if (fSoftWrappedCursor || (fCursor.x + width) > fWidth)
|
if (fSoftWrappedCursor || (fCursor.x + width) > fWidth)
|
||||||
@@ -1857,4 +1859,11 @@ BasicTerminalBuffer::CaptureChar(char ch)
|
|||||||
write(fCaptureFile, &ch, 1);
|
write(fCaptureFile, &ch, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BasicTerminalBuffer::InsertLastChar()
|
||||||
|
{
|
||||||
|
InsertChar(fLast);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ public:
|
|||||||
void SetInsertMode(int flag);
|
void SetInsertMode(int flag);
|
||||||
void InsertSpace(int32 num);
|
void InsertSpace(int32 num);
|
||||||
void InsertLines(int32 numLines);
|
void InsertLines(int32 numLines);
|
||||||
|
void InsertLastChar();
|
||||||
|
|
||||||
// delete chars/lines
|
// delete chars/lines
|
||||||
inline void EraseChars(int32 numChars);
|
inline void EraseChars(int32 numChars);
|
||||||
@@ -250,6 +251,8 @@ protected:
|
|||||||
int fEncoding;
|
int fEncoding;
|
||||||
int fCaptureFile;
|
int fCaptureFile;
|
||||||
|
|
||||||
|
UTF8Char fLast;
|
||||||
|
|
||||||
// listener/dirty region management
|
// listener/dirty region management
|
||||||
TerminalBufferDirtyInfo fDirtyInfo;
|
TerminalBufferDirtyInfo fDirtyInfo;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1213,6 +1213,18 @@ TermParse::EscParse()
|
|||||||
fBuffer->MoveCursorUp(row);
|
fBuffer->MoveCursorUp(row);
|
||||||
parsestate = groundtable;
|
parsestate = groundtable;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CASE_REP: // ESC [...b repeat last graphic char
|
||||||
|
{
|
||||||
|
int repetitions = param[0];
|
||||||
|
int maxRepetitions = fBuffer->Width() * fBuffer->Height();
|
||||||
|
if (repetitions > maxRepetitions)
|
||||||
|
repetitions = maxRepetitions;
|
||||||
|
for (int i = 0; i < repetitions; i++)
|
||||||
|
fBuffer->InsertLastChar();
|
||||||
|
parsestate = groundtable;
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1119,7 +1119,7 @@ CASE_GROUND_STATE,
|
|||||||
/* ` a b c */
|
/* ` a b c */
|
||||||
CASE_GROUND_STATE,
|
CASE_GROUND_STATE,
|
||||||
CASE_GROUND_STATE,
|
CASE_GROUND_STATE,
|
||||||
CASE_GROUND_STATE,
|
CASE_REP,
|
||||||
CASE_DA1,
|
CASE_DA1,
|
||||||
/* d e f g */
|
/* d e f g */
|
||||||
CASE_VPA,
|
CASE_VPA,
|
||||||
|
|||||||
@@ -101,3 +101,4 @@
|
|||||||
#define CASE_CFT 98
|
#define CASE_CFT 98
|
||||||
#define CASE_INDEX 99
|
#define CASE_INDEX 99
|
||||||
#define CASE_NEXT_LINE 100
|
#define CASE_NEXT_LINE 100
|
||||||
|
#define CASE_REP 101
|
||||||
|
|||||||
Reference in New Issue
Block a user