billiob pushed a commit to branch master.

commit d5cc45a6906094dc19aa62d30415cb3c28b523da
Author: Boris Faure <[email protected]>
Date:   Sun Apr 21 23:18:03 2013 +0200

    compat: add ugly testing code to change between 80/132 cols
---
 src/bin/termpty.h    |  6 ++++++
 src/bin/termptyesc.c | 28 ++++++++++++++++++++++++----
 2 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/src/bin/termpty.h b/src/bin/termpty.h
index 9c172fd..99b46fa 100644
--- a/src/bin/termpty.h
+++ b/src/bin/termpty.h
@@ -37,6 +37,9 @@ typedef struct _Termexp       Termexp;
 //#define SUPPORT_ITALIC   1
 #define SUPPORT_DBLWIDTH 1
 
+// Only for testing purpose
+//#define SUPPORT_80_132_COLUMNS 1
+
 struct _Termatt
 {
    unsigned char fg, bg;
@@ -61,6 +64,9 @@ struct _Termatt
    unsigned short autowrapped : 1;
    unsigned short newline : 1;
    unsigned short tab : 1;
+#if defined(SUPPORT_80_132_COLUMNS)
+   unsigned short is_80_132_mode_allowed : 1;
+#endif
 };
 
 struct _Termstate
diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index 59fa40b..aa5ffd7 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -5,6 +5,9 @@
 #include "termptyesc.h"
 #include "termptyops.h"
 #include "termptyext.h"
+#if defined(SUPPORT_80_132_COLUMNS)
+#include "termio.h"
+#endif
 
 #undef CRITICAL
 #undef ERR
@@ -69,7 +72,7 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, 
Eina_Unicode *ce)
    if (cc == ce) return 0;
    *b = 0;
    b = buf;
-//   DBG(" CSI: '%c' args '%s'", *cc, buf);
+   DBG(" CSI: '%c' args '%s'", *cc, (char *) buf);
    switch (*cc)
      {
       case 'm': // color set
@@ -548,9 +551,23 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, 
Eina_Unicode *ce)
                                  handled = 1;
                                  ty->state.kbd_lock = mode;
                                  break;
-                               case 3: // should we handle this?
+                               case 3: // 132 column mode… should we handle 
this?
                                  handled = 1;
-                                 ERR("TODO: 132 column mode %i", mode);
+#if defined(SUPPORT_80_132_COLUMNS)
+                                 if (ty->state.att.is_80_132_mode_allowed)
+                                   {
+                                      /* ONLY FOR TESTING PURPOSE FTM */
+                                      Evas_Object *wn;
+                                      int w, h;
+
+                                      wn = termio_win_get(ty->obj);
+                                      elm_win_size_step_get(wn, &w, &h);
+                                      evas_object_resize(wn,
+                                                         4 + (mode ? 132 : 80) 
* w,
+                                                         4 + 24 * h);
+                                      termpty_resize(ty, mode ? 132 : 80, 24);
+                                   }
+#endif
                                  break;
                                case 4:
                                  handled = 1;
@@ -620,7 +637,10 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, 
Eina_Unicode *ce)
                                  break;
                                case 40:
                                  handled = 1;
-                                 ERR("TODO: Allow 80 -> 132 Mode");
+                                 // INF("XXX: Allow 80 -> 132 Mode %i", mode);
+#if defined(SUPPORT_80_132_COLUMNS)
+                                 ty->state.att.is_80_132_mode_allowed = mode;
+#endif
                                  break;
                                case 45: // ignore
                                  handled = 1;

-- 

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev

Reply via email to