summaryrefslogtreecommitdiff
path: root/vui.c
diff options
context:
space:
mode:
Diffstat (limited to 'vui.c')
-rw-r--r--vui.c28
1 files changed, 2 insertions, 26 deletions
diff --git a/vui.c b/vui.c
index 1384746..caf4654 100644
--- a/vui.c
+++ b/vui.c
@@ -197,6 +197,8 @@ void vui_curs_pos(int x, int y) {
win.curs_y = y;
}
+/* TODO: use something better than signal() */
+/* does sigaction allow for a context pointer? */
static void on_resized(int _) {
adjust_win_size();
if (win.redraw_fn) {
@@ -495,39 +497,19 @@ chg_colors:;
*ptr = to;
}
-unsigned vui_changes = 0;
-unsigned vui_max_change = 0;
-unsigned vui_out_chars = 0;
-int scrolled_x = 0, scrolled_y = 0;
-
void vui_scroll_buf(VuiBuffer *b, int dx, int dy);
void vui_blit(void) {
VuiBuffer *front = win.front;
VuiBuffer *back = win.back;
- // vui_outf(CSI "H" CSI "0m");
- // vui_outs(CSI "2J");
- // vui_outs(CSI "3J");
static VuiAttr attr_last = ATTR_DEFAULT;
static unsigned cur_x = 0;
static unsigned cur_y = 0;
- /*
- vui_outs(CSI "H" CSI "0m");
- attr_last = ATTR_DEFAULT;
- cur_x = 0;
- cur_y = 0;
- */
-
- scrolled_x = win.scroll_x;
- scrolled_y = win.scroll_y;
-
- //win.redraw_all = 1;
if (win.redraw_all) {
vui_outs(CSI "H" CSI "2J" CSI "0m");
attr_last = ATTR_DEFAULT;
- vui_changes = COLS * LINES;
unsigned max = COLS * LINES;
for (unsigned i = 0; i < max; i++) {
attr_chg(&attr_last, front->attr[i]);
@@ -542,9 +524,6 @@ void vui_blit(void) {
goto end;
}
- vui_changes = 0;
- vui_max_change = 0;
-
if (win.scroll_x || win.scroll_y) {
if ((unsigned)abs(win.scroll_x) >= COLS || (unsigned)abs(win.scroll_y) > LINES) {
vui_outs(CSI "2J");
@@ -598,12 +577,10 @@ scrolled:
VuiAttr a = ATTR(x0, y);
while (x < COLS && !bchr_equiv(back, front, (y * COLS) + x) && BATTR(front, x, y) == a) x++;
if (x0 != x) {
- vui_changes++;
curs_move(&cur_x, &cur_y, x0, y);
attr_chg(&attr_last, a);
vui_outvcn(&CHR(x0, y), x - x0);
cur_x = x;
- if (x - x0 > vui_max_change) vui_max_change = x - x0;
}
}
}
@@ -613,7 +590,6 @@ end:
curs_move(&cur_x, &cur_y, win.curs_x, win.curs_y);
}
- vui_out_chars = vui_outn;
vui_out_flush();
memcpy(back->chr, front->chr, sizeof(*back->chr) * (back->width * back->height));
memcpy(back->attr, front->attr, sizeof(*back->attr) * (back->width * back->height));