billiob pushed a commit to branch master.

http://git.enlightenment.org/apps/terminology.git/commit/?id=b4ba773e17027c160667cd5bd7c9dfaf541ff878

commit b4ba773e17027c160667cd5bd7c9dfaf541ff878
Author: Boris Faure <bill...@gmail.com>
Date:   Sun Mar 1 17:18:45 2015 +0100

    fix CSI DECSET 1049. Should fix T725
---
 src/bin/termpty.c    |  3 ---
 src/bin/termptyesc.c | 34 +++++++++++++++++++++-------------
 2 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/src/bin/termpty.c b/src/bin/termpty.c
index 1fef59f..f4271a9 100644
--- a/src/bin/termpty.c
+++ b/src/bin/termpty.c
@@ -1101,7 +1101,6 @@ termpty_screen_swap(Termpty *ty)
 {
    Termcell *tmp_screen;
    int tmp_circular_offset;
-   int tmp_appcursor = ty->state.appcursor;
 
    tmp_screen = ty->screen;
    ty->screen = ty->screen2;
@@ -1116,8 +1115,6 @@ termpty_screen_swap(Termpty *ty)
    ty->circular_offset = ty->circular_offset2;
    ty->circular_offset2 = tmp_circular_offset;
 
-   ty->state.appcursor = tmp_appcursor;
-
    ty->altbuf = !ty->altbuf;
 
    if (ty->cb.cancel_sel.func)
diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index 56cc215..8452d69 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -110,6 +110,23 @@ _handle_cursor_control(Termpty *ty, const Eina_Unicode *cc)
 }
 
 static void
+_switch_to_alternative_screen(Termpty *ty, int mode)
+{
+   DBG("switch to alternative screen, mode:%d", mode);
+   if (ty->altbuf)
+     {
+        // if we are looking at alt buf now,
+        // clear main buf before we swap it back
+        // into the screen2 save (so save is
+        // clear)
+        _termpty_clear_all(ty);
+     }
+   // swap screen content now
+   if (mode != ty->altbuf)
+     termpty_screen_swap(ty);
+}
+
+static void
 _handle_esc_csi_reset_mode(Termpty *ty, Eina_Unicode cc, Eina_Unicode *b)
 {
    int mode = 0, priv = 0, arg;
@@ -290,26 +307,17 @@ _handle_esc_csi_reset_mode(Termpty *ty, Eina_Unicode cc, 
Eina_Unicode *b)
                         DBG("Ignored screen mode %i", arg);
                         break;
                      case 1047:
-                     case 1049:
                      case 47:
-                        DBG("DDD: switch buf");
-                        if (ty->altbuf)
-                          {
-                             // if we are looking at alt buf now,
-                             // clear main buf before we swap it back
-                             // into the screen2 save (so save is
-                             // clear)
-                             _termpty_clear_all(ty);
-                          }
-                        // swap screen content now
-                        if (mode != ty->altbuf)
-                          termpty_screen_swap(ty);
+                        _switch_to_alternative_screen(ty, mode);
                         break;
                      case 1048:
+                     case 1049:
                         if (mode)
                           _termpty_cursor_copy(&(ty->state), &(ty->save));
                         else
                           _termpty_cursor_copy(&(ty->save), &(ty->state));
+                        if (arg == 1049)
+                          _switch_to_alternative_screen(ty, mode);
                         break;
                      case 2004:
                         ty->bracketed_paste = mode;

-- 


Reply via email to