qemacs-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemacs-commit] qemacs shell.c


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs shell.c
Date: Tue, 08 Apr 2008 09:33:18 +0000

CVSROOT:        /cvsroot/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        08/04/08 09:33:18

Modified files:
        .              : shell.c 

Log message:
        simplified extended escape sequence handling

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/shell.c?cvsroot=qemacs&r1=1.49&r2=1.50

Patches:
Index: shell.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/shell.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -b -r1.49 -r1.50
--- shell.c     8 Apr 2008 09:29:38 -0000       1.49
+++ shell.c     8 Apr 2008 09:33:18 -0000       1.50
@@ -49,7 +49,6 @@
     TTY_STATE_ESC2,
     TTY_STATE_CSI,
     TTY_STATE_STRING,
-    TTY_STATE_STRING2,
 };
 
 typedef struct ShellState {
@@ -62,7 +61,7 @@
     int has_params[MAX_ESC_PARAMS];
     int nb_esc_params;
     int state;
-    int esc1;
+    int esc1, esc2;
     int shifted;
     int grab_keys;
     EditBuffer *b;
@@ -774,6 +773,7 @@
         break;
     case TTY_STATE_ESC2:
         s->state = TTY_STATE_NORM;
+        s->esc2 = c;
         switch (ESC2(s->esc1, c)) {
         case ESC2('(','B'):     /* exit_alt_charset_mode */
             s->shifted = 0;
@@ -785,29 +785,33 @@
         case ESC2(')','0'):
         case ESC2('*','B'):
         case ESC2('+','B'):
-        case ESC2(']','R'):
-            /* XXX: ??? */
+            /* XXX: Todo */
             break;
-        case ESC2(']','0'):     /* xterm's set-window-title */
+        case ESC2(']','0'):     /* xterm's set-window-title and icon */
+        case ESC2(']','1'):     /* xterm's set-window-title */
+        case ESC2(']','2'):     /* xterm's set-window-title */
+        case ESC2(']','4'):     /* xterm's define-extended color */
+        case ESC2(']','W'):     /* word-set (define char wordness) */
             s->state = TTY_STATE_STRING;
             break;
-        case ESC2(']','4'):     /* xterm's define-extended color */
-            /* Parse syntax: \033]4;4;16;rgb:00/00/00\033\134 */
-            s->state = TTY_STATE_STRING2;
+        case ESC2(']','P'):     /* linux set palette */
+        case ESC2(']','R'):     /* linux reset palette */
+            /* XXX: Todo */
             break;
         }
         break;
     case TTY_STATE_STRING:
-        /* ignore string parameter upto \a (^G) */
-        if (c == '\007') {
-            /* CG: should store window caption */
+        /* CG: should store the string */
+        /* Stop string on CR or LF, for protection */
+        if (c == '\012' || c == '\015') {
             s->state = TTY_STATE_NORM;
-        }
         break;
-    case TTY_STATE_STRING2:
-        /* ignore string parameter upto ESC \ */
-        if (c == '\\') {
-            /* CG: should parse color definition string */
+        }
+        /* Stop string on \a (^G) or M-\ -- need better test for ESC \ */
+        if (c == '\007' || c == 0234 || c == '\\') {
+            /* CG: ESC2(']','0') should store window caption */
+            /* CG: ESC2(']','4') should parse color definition string */
+            /* (example: "\033]4;16;rgb:00/00/00\033\134" ) */
             s->state = TTY_STATE_NORM;
         }
         break;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]