[haiku-commits] Change in haiku[master]: Terminal: implement ECMA-48 "REP"

  • From: Gerrit <review@xxxxxxxxxxxxxxxxxxx>
  • To: waddlesplash <waddlesplash@xxxxxxxxx>, haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 6 Jan 2021 20:19:47 +0000

From Jérôme Duval <jerome.duval@xxxxxxxxx>:

Jérôme Duval has uploaded this change for review. ( 
https://review.haiku-os.org/c/haiku/+/3607 ;)


Change subject: Terminal: implement ECMA-48 "REP"
......................................................................

Terminal: implement ECMA-48 "REP"

fix #16724
---
M src/apps/terminal/BasicTerminalBuffer.cpp
M src/apps/terminal/BasicTerminalBuffer.h
M src/apps/terminal/TermParse.cpp
M src/apps/terminal/VTPrsTbl.c
M src/apps/terminal/VTparse.h
5 files changed, 27 insertions(+), 2 deletions(-)



  git pull ssh://git.haiku-os.org:22/haiku refs/changes/07/3607/1

diff --git a/src/apps/terminal/BasicTerminalBuffer.cpp 
b/src/apps/terminal/BasicTerminalBuffer.cpp
index 43e3629..06dfd6c 100644
--- a/src/apps/terminal/BasicTerminalBuffer.cpp
+++ b/src/apps/terminal/BasicTerminalBuffer.cpp
@@ -121,7 +121,8 @@
        fSavedOriginMode(false),
        fTabStops(NULL),
        fEncoding(M_UTF8),
-       fCaptureFile(-1)
+       fCaptureFile(-1),
+       fLast()
 {
 }

@@ -625,6 +626,7 @@
 {
 //debug_printf("BasicTerminalBuffer::InsertChar('%.*s' (%d), %#lx)\n",
 //(int)c.ByteCount(), c.bytes, c.bytes[0], attributes);
+       fLast = c;
        int32 width = c.IsFullWidth() ? FULL_WIDTH : HALF_WIDTH;
 
        if (fSoftWrappedCursor || (fCursor.x + width) > fWidth)
@@ -1857,4 +1859,11 @@
                write(fCaptureFile, &ch, 1);
 }

+
+void
+BasicTerminalBuffer::InsertLastChar()
+{
+       InsertChar(fLast);
+}
+
 #endif
diff --git a/src/apps/terminal/BasicTerminalBuffer.h 
b/src/apps/terminal/BasicTerminalBuffer.h
index c1ad050..418f014 100644
--- a/src/apps/terminal/BasicTerminalBuffer.h
+++ b/src/apps/terminal/BasicTerminalBuffer.h
@@ -141,6 +141,7 @@
                        void                            SetInsertMode(int flag);
                        void                            InsertSpace(int32 num);
                        void                            InsertLines(int32 
numLines);
+                       void                            InsertLastChar();
 
                        // delete chars/lines
        inline  void                            EraseChars(int32 numChars);
@@ -250,6 +251,8 @@
                        int                                     fEncoding;
                        int                                     fCaptureFile;

+                       UTF8Char                        fLast;
+
                        // listener/dirty region management
                        TerminalBufferDirtyInfo fDirtyInfo;
 };
diff --git a/src/apps/terminal/TermParse.cpp b/src/apps/terminal/TermParse.cpp
index 0a2b71a..d925ade 100644
--- a/src/apps/terminal/TermParse.cpp
+++ b/src/apps/terminal/TermParse.cpp
@@ -1213,6 +1213,18 @@
                                        fBuffer->MoveCursorUp(row);
                                        parsestate = groundtable;
                                        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:
                                        break;
                        }
diff --git a/src/apps/terminal/VTPrsTbl.c b/src/apps/terminal/VTPrsTbl.c
index 62e85e9..ac43bb9 100644
--- a/src/apps/terminal/VTPrsTbl.c
+++ b/src/apps/terminal/VTPrsTbl.c
@@ -1119,7 +1119,7 @@
 /*     `               a               b               c       */
 CASE_GROUND_STATE,
 CASE_GROUND_STATE,
-CASE_GROUND_STATE,
+CASE_REP,
 CASE_DA1,
 /*     d               e               f               g       */
 CASE_VPA,
diff --git a/src/apps/terminal/VTparse.h b/src/apps/terminal/VTparse.h
index b0342a2..c93ab21 100644
--- a/src/apps/terminal/VTparse.h
+++ b/src/apps/terminal/VTparse.h
@@ -101,3 +101,4 @@
 #define CASE_CFT 98
 #define CASE_INDEX 99
 #define CASE_NEXT_LINE 100
+#define CASE_REP 101

--
To view, visit https://review.haiku-os.org/c/haiku/+/3607
To unsubscribe, or for help writing mail filters, visit 
https://review.haiku-os.org/settings

Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: Ie9f8252393a65a0101a6d78db2360f48bb52bc73
Gerrit-Change-Number: 3607
Gerrit-PatchSet: 1
Gerrit-Owner: Jérôme Duval <jerome.duval@xxxxxxxxx>
Gerrit-MessageType: newchange

Other related posts:

  • » [haiku-commits] Change in haiku[master]: Terminal: implement ECMA-48 "REP" - Gerrit