billiob pushed a commit to branch master.

commit 8e9443a58c96a5c3a03d45b14d6d2736b60cd208
Author: Boris Faure <[email protected]>
Date:   Sat Apr 6 22:13:12 2013 +0200

    fix clearing screen till the end
---
 src/bin/termptyops.c | 23 ++++++-----------------
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/src/bin/termptyops.c b/src/bin/termptyops.c
index 3ade9fe..1115113 100644
--- a/src/bin/termptyops.c
+++ b/src/bin/termptyops.c
@@ -278,7 +278,6 @@ _termpty_clear_screen(Termpty *ty, Termpty_Clear mode)
 {
    Termcell *cells;
 
-   cells = &(TERMPTY_SCREEN(ty, 0, 0));
    switch (mode)
      {
       case TERMPTY_CLR_END:
@@ -287,23 +286,11 @@ _termpty_clear_screen(Termpty *ty, Termpty_Clear mode)
           {
              int l = ty->h - (ty->state.cy + 1);
 
-             cells = &(TERMPTY_SCREEN(ty, 0, (ty->state.cy + 1)));
-             if (l > ty->circular_offset)
+             while (l)
                {
-                  cells = &(TERMPTY_SCREEN(ty, 0, (ty->state.cy + 1)));
-                  _text_clear(ty, cells,
-                              ty->w * (ty->circular_offset - l),
-                               0, EINA_TRUE);
-                  cells = ty->screen;
-                  _text_clear(ty, cells,
-                              ty->w * ty->circular_offset,
-                               0, EINA_TRUE);
-               }
-             else
-               {
-                  _text_clear(ty, cells,
-                              ty->w * l,
-                              0, EINA_TRUE);
+                  cells = &(TERMPTY_SCREEN(ty, 0, (ty->state.cy + l)));
+                  _text_clear(ty, cells, ty->w, 0, EINA_TRUE);
+                  l--;
                }
           }
         break;
@@ -313,6 +300,8 @@ _termpty_clear_screen(Termpty *ty, Termpty_Clear mode)
            // First clear from circular > height, then from 0 to circular
            int y = ty->state.cy + ty->circular_offset;
 
+            cells = &(TERMPTY_SCREEN(ty, 0, 0));
+
            if (y < ty->h)
              {
                _text_clear(ty, cells, ty->w * ty->state.cy, 0, EINA_TRUE);

-- 

------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html

Reply via email to