aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/termptyops.c
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2013-04-18 23:12:15 +0200
committerBoris Faure <billiob@gmail.com>2013-06-09 12:03:51 +0200
commitf5cad4ff7f3298b3ea4f18df85f6c1e50c6d8024 (patch)
tree188e93e8fe77846e4be09607ddeefd6a0c477adf /src/bin/termptyops.c
parentcompat: add some csi dec private modes TODOs (diff)
downloadterminology-f5cad4ff7f3298b3ea4f18df85f6c1e50c6d8024.tar.gz
compat: only clear cells when scrolling to add text
and to delete lines, but not when just moving the cursor
Diffstat (limited to 'src/bin/termptyops.c')
-rw-r--r--src/bin/termptyops.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/bin/termptyops.c b/src/bin/termptyops.c
index 624ab9d..9256536 100644
--- a/src/bin/termptyops.c
+++ b/src/bin/termptyops.c
@@ -59,7 +59,7 @@ termpty_text_save_top(Termpty *ty, Termcell *cells, ssize_t w_max)
}
void
-_termpty_text_scroll(Termpty *ty)
+_termpty_text_scroll(Termpty *ty, Eina_Bool clear)
{
Termcell *cells = NULL, *cells2;
int y, start_y = 0, end_y = ty->h - 1;
@@ -82,6 +82,9 @@ _termpty_text_scroll(Termpty *ty)
}
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
@@ -90,7 +93,7 @@ _termpty_text_scroll(Termpty *ty)
ty->circular_offset++;
if (ty->circular_offset >= ty->h)
- ty->circular_offset = 0;
+ ty->circular_offset = 0;
}
else
{
@@ -106,7 +109,7 @@ _termpty_text_scroll(Termpty *ty)
}
void
-_termpty_text_scroll_rev(Termpty *ty)
+_termpty_text_scroll_rev(Termpty *ty, Eina_Bool clear)
{
Termcell *cells, *cells2 = NULL;
int y, start_y = 0, end_y = ty->h - 1;
@@ -118,12 +121,15 @@ _termpty_text_scroll_rev(Termpty *ty)
}
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
ty->circular_offset--;
if (ty->circular_offset < 0)
- ty->circular_offset = ty->h - 1;
+ ty->circular_offset = ty->h - 1;
cells = &(ty->screen[ty->circular_offset * ty->w]);
_text_clear(ty, cells, ty->w, 0, EINA_TRUE);
@@ -143,27 +149,27 @@ _termpty_text_scroll_rev(Termpty *ty)
}
void
-_termpty_text_scroll_test(Termpty *ty)
+_termpty_text_scroll_test(Termpty *ty, Eina_Bool clear)
{
int e = ty->h;
if (ty->state.scroll_y2 != 0) e = ty->state.scroll_y2;
if (ty->state.cy >= e)
{
- _termpty_text_scroll(ty);
+ _termpty_text_scroll(ty, clear);
ty->state.cy = e - 1;
}
}
void
-_termpty_text_scroll_rev_test(Termpty *ty)
+_termpty_text_scroll_rev_test(Termpty *ty, Eina_Bool clear)
{
int b = 0;
- if (ty->state.scroll_y2 != 0) b = ty->state.scroll_y1;
+ if (ty->state.scroll_y1 != 0) b = ty->state.scroll_y1;
if (ty->state.cy < b)
{
- _termpty_text_scroll_rev(ty);
+ _termpty_text_scroll_rev(ty, clear);
ty->state.cy = b;
}
}
@@ -185,7 +191,7 @@ _termpty_text_append(Termpty *ty, const Eina_Unicode *codepoints, int len)
ty->state.wrapnext = 0;
ty->state.cx = 0;
ty->state.cy++;
- _termpty_text_scroll_test(ty);
+ _termpty_text_scroll_test(ty, EINA_TRUE);
cells = &(TERMPTY_SCREEN(ty, 0, ty->state.cy));
}
if (ty->state.insert)