[haiku-commits] haiku: hrev45706 - src/apps/terminal

  • From: zharik@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 23 May 2013 22:02:23 +0200 (CEST)

hrev45706 adds 1 changeset to branch 'master'
old head: 3bbef9dd76c624c594c739c17ead26e81afc2581
new head: 7c8e63e1719ff47f050692b6bf288fd9f1af9981
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=7c8e63e+%5E3bbef9d

----------------------------------------------------------------------------

7c8e63e: Terminal: fix handling utf-8 characters in OSC commands
  
  Process the Operating System Control command in multibyte-aware way.
  That fixes corresponding behavior for latest versions of Midnight
  Commander;

                                        [ Siarzhuk Zharski <zharik@xxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev45706
Commit:      7c8e63e1719ff47f050692b6bf288fd9f1af9981
URL:         http://cgit.haiku-os.org/haiku/commit/?id=7c8e63e
Author:      Siarzhuk Zharski <zharik@xxxxxx>
Date:        Mon May 20 11:50:44 2013 UTC

----------------------------------------------------------------------------

1 file changed, 14 insertions(+)
src/apps/terminal/TermParse.cpp | 14 ++++++++++++++

----------------------------------------------------------------------------

diff --git a/src/apps/terminal/TermParse.cpp b/src/apps/terminal/TermParse.cpp
index c2b1eda..b86fbe5 100644
--- a/src/apps/terminal/TermParse.cpp
+++ b/src/apps/terminal/TermParse.cpp
@@ -1048,8 +1048,19 @@ TermParse::EscParse()
                                                uchar params[512];
                                                // fill the buffer until BEL, 
ST or something else.
                                                bool isParsed = false;
+                                               int32 skipCount = 0; // take 
care about UTF-8 characters
                                                for (uint i = 0; !isParsed && i 
< sizeof(params); i++) {
                                                        params[i] = 
_NextParseChar();
+
+                                                       if (skipCount > 0) {
+                                                               skipCount--;
+                                                               continue;
+                                                       }
+
+                                                       skipCount = 
UTF8Char::ByteCount(params[i]) - 1;
+                                                       if (skipCount > 0)
+                                                               continue;
+
                                                        switch (params[i]) {
                                                                // BEL
                                                                case 0x07:
@@ -1074,6 +1085,9 @@ TermParse::EscParse()
                                                        params[i] = '\0';
                                                }
 
+                                               // watchdog for the 'end of 
buffer' case
+                                               params[sizeof(params) - 1] = 
'\0';
+
                                                if (isParsed)
                                                        
_ProcessOperatingSystemControls(params);
 


Other related posts:

  • » [haiku-commits] haiku: hrev45706 - src/apps/terminal - zharik