From 081f27552bf4a200ae2cf124c0d9c7d7266aae4b Mon Sep 17 00:00:00 2001 From: Boris Faure Date: Sat, 16 Feb 2013 18:16:25 +0000 Subject: [PATCH] fix clearing lines with circular buffer. Fixes #2263. SVN revision: 84004 --- src/bin/termptyops.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/bin/termptyops.c b/src/bin/termptyops.c index 37d34258..98410947 100644 --- a/src/bin/termptyops.c +++ b/src/bin/termptyops.c @@ -285,10 +285,26 @@ _termpty_clear_screen(Termpty *ty, Termpty_Clear mode) _termpty_clear_line(ty, mode, ty->w); if (ty->state.cy < (ty->h - 1)) { + int l = ty->h - (ty->state.cy + 1); + cells = &(TERMPTY_SCREEN(ty, 0, (ty->state.cy + 1))); - _text_clear(ty, cells, - ty->w * (ty->h - ty->circular_offset - 1 - ty->state.cy), - 0, EINA_TRUE); + if (l > ty->circular_offset) + { + 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); + } } break; case TERMPTY_CLR_BEGIN: