From a777c060dc01f77840d842d7ed070ba115520547 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sat, 29 Sep 2007 10:57:39 +0000 Subject: [PATCH] Nuke CLEAR_SCREEN/ENDOFSCREEN and assert scroll region when drawing. These will be reqd for status line(s). --- input.c | 18 ++++++++++++++---- local.c | 16 +--------------- screen.c | 8 ++++---- tmux.h | 8 +++++--- 4 files changed, 24 insertions(+), 26 deletions(-) diff --git a/input.c b/input.c index 7eec90d4..7b2cc79b 100644 --- a/input.c +++ b/input.c @@ -1,4 +1,4 @@ -/* $Id: input.c,v 1.9 2007-09-29 09:50:59 nicm Exp $ */ +/* $Id: input.c,v 1.10 2007-09-29 10:57:39 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -764,6 +764,7 @@ void input_handle_sequence_ed(struct input_ctx *ictx) { uint16_t n; + u_int i; if (ictx->private != '\0') return; @@ -780,12 +781,21 @@ input_handle_sequence_ed(struct input_ctx *ictx) case 0: screen_fill_end_of_screen(ictx->s, ictx->s->cx, ictx->s->cy, SCREEN_DEFDATA, ictx->s->attr, ictx->s->colr); - input_store_zero(ictx->b, CODE_CLEARENDOFSCREEN); + for (i = ictx->s->cy; i < ictx->s->sy; i++) { + input_store_zero(ictx->b, CODE_CLEARLINE); + input_store_two(ictx->b, CODE_CURSORMOVE, i + 1, 1); + } + input_store_two( + ictx->b, CODE_CURSORMOVE, ictx->s->cy + 1, ictx->s->cx + 1); break; case 2: screen_fill_screen( ictx->s, SCREEN_DEFDATA, ictx->s->attr, ictx->s->colr); - input_store_zero(ictx->b, CODE_CLEARSCREEN); + for (i = 0; i < ictx->s->sy; i++) { + input_store_two(ictx->b, CODE_CURSORMOVE, i + 1, 1); + input_store_zero(ictx->b, CODE_CLEARLINE); + } + input_store_two(ictx->b, CODE_CURSORMOVE, 1, 1); break; } } @@ -920,7 +930,7 @@ input_handle_sequence_decstbm(struct input_ctx *ictx) if (input_get_argument(ictx, 1, &m, 1) != 0) return; - if (n == 0 || n > ictx->s->sy - 1 || m == 0 || m > ictx->s->sx - 1) { + if (n == 0 || n > ictx->s->sy || m == 0 || m > ictx->s->sx) { log_debug3("decstbm: out of range: %hu,%hu", m, n); return; } diff --git a/local.c b/local.c index 0f9fee78..7a06af72 100644 --- a/local.c +++ b/local.c @@ -1,4 +1,4 @@ -/* $Id: local.c,v 1.9 2007-09-29 09:53:25 nicm Exp $ */ +/* $Id: local.c,v 1.10 2007-09-29 10:57:39 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -477,20 +477,6 @@ local_output(struct buffer *b, size_t size) } local_putp(tparm(cursor_address, ua - 1, ub - 1)); break; - case CODE_CLEARENDOFSCREEN: - if (clr_eos == NULL) { - log_warnx("clr_eos not supported"); - break; - } - local_putp(clr_eos); - break; - case CODE_CLEARSCREEN: - if (clear_screen == NULL) { - log_warnx("clear_screen not supported"); - break; - } - local_putp(clear_screen); - break; case CODE_CLEARENDOFLINE: if (clr_eol == NULL) { log_warnx("clr_eol not supported"); diff --git a/screen.c b/screen.c index 63619e61..5a1b00dc 100644 --- a/screen.c +++ b/screen.c @@ -1,4 +1,4 @@ -/* $Id: screen.c,v 1.12 2007-09-28 22:47:21 nicm Exp $ */ +/* $Id: screen.c,v 1.13 2007-09-29 10:57:39 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -28,8 +28,6 @@ * XXX Much of this file sucks. */ -size_t screen_store_attributes(struct buffer *, u_char); -size_t screen_store_colours(struct buffer *, u_char); void screen_free_lines(struct screen *, u_int, u_int); void screen_make_lines(struct screen *, u_int, u_int); void screen_move_lines(struct screen *, u_int, u_int, u_int); @@ -175,6 +173,8 @@ screen_draw(struct screen *s, struct buffer *b, u_int uy, u_int ly) attr = 0; colr = SCREEN_DEFCOLR; + input_store_two(b, CODE_SCROLLREGION, 1, s->sy); + input_store_zero(b, CODE_CURSOROFF); input_store_one(b, CODE_ATTRIBUTES, 0); @@ -192,7 +192,7 @@ screen_draw(struct screen *s, struct buffer *b, u_int uy, u_int ly) attr = s->grid_attr[j][i]; n += screen_store_attributes(b, attr); if (attr == 0) - colr = SCREEN_DEFCOLR; + colr = SCREEN_DEFCOLR; } if (s->grid_colr[j][i] != colr) { colr = s->grid_colr[j][i]; diff --git a/tmux.h b/tmux.h index 27af6bd8..76f3dc33 100644 --- a/tmux.h +++ b/tmux.h @@ -1,4 +1,4 @@ -/* $Id: tmux.h,v 1.23 2007-09-29 09:53:25 nicm Exp $ */ +/* $Id: tmux.h,v 1.24 2007-09-29 10:57:39 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -238,9 +238,9 @@ struct buffer { #define CODE_INSERTLINE 6 #define CODE_DELETELINE 7 #define CODE_CLEARLINE 8 -#define CODE_CLEARSCREEN 9 +/* 9 unused */ #define CODE_CLEARENDOFLINE 10 -#define CODE_CLEARENDOFSCREEN 11 +/* 11 unused */ #define CODE_CLEARSTARTOFLINE 12 #define CODE_CURSORMOVE 13 #define CODE_ATTRIBUTES 14 @@ -568,6 +568,8 @@ void input_translate_key(struct buffer *, int); void screen_create(struct screen *, u_int, u_int); void screen_resize(struct screen *, u_int, u_int); void screen_draw(struct screen *, struct buffer *, u_int, u_int); +size_t screen_store_attributes(struct buffer *, u_char); +size_t screen_store_colours(struct buffer *, u_char); void screen_write_character(struct screen *, u_char); void screen_insert_lines(struct screen *, u_int, u_int); void screen_delete_lines(struct screen *, u_int, u_int);