billiob pushed a commit to branch master.

commit 604a9abd8597b407519a98bc7f8ebcaa54dd67ff
Author: Boris Faure <[email protected]>
Date:   Mon May 27 22:10:18 2013 +0200

    compat: fix scrolling not clearing some text
    
    Test case was provided by weechat.
---
 src/bin/termptyesc.c |  4 ++--
 src/bin/termptyops.c | 18 ++++++++----------
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index e68aa9e..5a65080 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -490,13 +490,13 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, 
Eina_Unicode *ce)
         DBG("scroll up N lines");
         arg = _csi_arg_get(&b);
         if (arg < 1) arg = 1;
-        for (i = 0; i < arg; i++) _termpty_text_scroll(ty, EINA_FALSE);
+        for (i = 0; i < arg; i++) _termpty_text_scroll(ty, EINA_TRUE);
         break;
       case 'T': // scroll down N lines
         DBG("scroll down N lines");
         arg = _csi_arg_get(&b);
         if (arg < 1) arg = 1;
-        for (i = 0; i < arg; i++) _termpty_text_scroll_rev(ty, EINA_FALSE);
+        for (i = 0; i < arg; i++) _termpty_text_scroll_rev(ty, EINA_TRUE);
         break;
       case 'M': // delete N lines - cy
       case 'L': // insert N lines - cy
diff --git a/src/bin/termptyops.c b/src/bin/termptyops.c
index 9256536..2547038 100644
--- a/src/bin/termptyops.c
+++ b/src/bin/termptyops.c
@@ -82,14 +82,12 @@ _termpty_text_scroll(Termpty *ty, Eina_Bool clear)
      }
    DBG("... scroll!!!!! [%i->%i]", start_y, end_y);
 
-   if (!clear)
-     return;
-
    if (start_y == 0 && end_y == ty->h - 1)
      {
        // screen is a circular buffer now
        cells2 = &(ty->screen[ty->circular_offset * ty->w]);
-       _text_clear(ty, cells2, ty->w, 0, EINA_TRUE);
+       if (clear)
+          _text_clear(ty, cells2, ty->w, 0, EINA_TRUE);
 
        ty->circular_offset++;
        if (ty->circular_offset >= ty->h)
@@ -104,7 +102,8 @@ _termpty_text_scroll(Termpty *ty, Eina_Bool clear)
             cells2 = &(ty->screen[(y + 1) * ty->w]);
             termpty_cell_copy(ty, cells2, cells, ty->w);
          }
-       _text_clear(ty, cells2, ty->w, 0, EINA_TRUE);
+       if (clear)
+          _text_clear(ty, cells2, ty->w, 0, EINA_TRUE);
      }
 }
 
@@ -121,9 +120,6 @@ _termpty_text_scroll_rev(Termpty *ty, Eina_Bool clear)
      }
    DBG("... scroll rev!!!!! [%i->%i]", start_y, end_y);
 
-   if (!clear)
-     return;
-
    if (start_y == 0 && end_y == ty->h - 1)
      {
        // screen is a circular buffer now
@@ -132,7 +128,8 @@ _termpty_text_scroll_rev(Termpty *ty, Eina_Bool clear)
          ty->circular_offset = ty->h - 1;
 
        cells = &(ty->screen[ty->circular_offset * ty->w]);
-       _text_clear(ty, cells, ty->w, 0, EINA_TRUE);
+       if (clear)
+          _text_clear(ty, cells, ty->w, 0, EINA_TRUE);
      }
    else
      {
@@ -144,7 +141,8 @@ _termpty_text_scroll_rev(Termpty *ty, Eina_Bool clear)
             termpty_cell_copy(ty, cells, cells2, ty->w);
          }
        y = start_y;
-       _text_clear(ty, cells, ty->w, 0, EINA_TRUE);
+       if (clear)
+          _text_clear(ty, cells, ty->w, 0, EINA_TRUE);
      }
 }
 

-- 

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

Build for Windows Store.

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

Reply via email to