=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/screen-write.c,v retrieving revision 1.60 retrieving revision 1.61 diff -u -r1.60 -r1.61 --- src/usr.bin/tmux/screen-write.c 2013/01/18 02:16:21 1.60 +++ src/usr.bin/tmux/screen-write.c 2013/03/21 18:47:56 1.61 @@ -1,4 +1,4 @@ -/* $OpenBSD: screen-write.c,v 1.60 2013/01/18 02:16:21 nicm Exp $ */ +/* $OpenBSD: screen-write.c,v 1.61 2013/03/21 18:47:56 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -52,15 +52,12 @@ void screen_write_reset(struct screen_write_ctx *ctx) { - screen_reset_tabs(ctx->s); + struct screen *s = ctx->s; - screen_write_scrollregion(ctx, 0, screen_size_y(ctx->s) - 1); + screen_reset_tabs(s); + screen_write_scrollregion(ctx, 0, screen_size_y(s) - 1); + s->mode &= ~(MODE_INSERT|MODE_KCURSOR|MODE_KKEYPAD|ALL_MOUSE_MODES); - screen_write_insertmode(ctx, 0); - screen_write_kcursormode(ctx, 0); - screen_write_kkeypadmode(ctx, 0); - screen_write_mousemode_off(ctx); - screen_write_clearscreen(ctx); screen_write_cursormove(ctx, 0, 0); } @@ -454,6 +451,24 @@ memcpy(&ttyctx->last_cell, gc, sizeof ttyctx->last_cell); } +/* Set a mode. */ +void +screen_write_mode_set(struct screen_write_ctx *ctx, int mode) +{ + struct screen *s = ctx->s; + + s->mode |= mode; +} + +/* Clear a mode. */ +void +screen_write_mode_clear(struct screen_write_ctx *ctx, int mode) +{ + struct screen *s = ctx->s; + + s->mode &= ~mode; +} + /* Cursor up by ny. */ void screen_write_cursorup(struct screen_write_ctx *ctx, u_int ny) @@ -805,18 +820,6 @@ s->cy = py; } -/* Set cursor mode. */ -void -screen_write_cursormode(struct screen_write_ctx *ctx, int state) -{ - struct screen *s = ctx->s; - - if (state) - s->mode |= MODE_CURSOR; - else - s->mode &= ~MODE_CURSOR; -} - /* Reverse index (up with scroll). */ void screen_write_reverseindex(struct screen_write_ctx *ctx) @@ -856,61 +859,6 @@ s->rlower = rlower; } -/* Set insert mode. */ -void -screen_write_insertmode(struct screen_write_ctx *ctx, int state) -{ - struct screen *s = ctx->s; - - if (state) - s->mode |= MODE_INSERT; - else - s->mode &= ~MODE_INSERT; -} - -/* Set UTF-8 mouse mode. */ -void -screen_write_utf8mousemode(struct screen_write_ctx *ctx, int state) -{ - struct screen *s = ctx->s; - - if (state) - s->mode |= MODE_MOUSE_UTF8; - else - s->mode &= ~MODE_MOUSE_UTF8; -} - -/* Set mouse mode off. */ -void -screen_write_mousemode_off(struct screen_write_ctx *ctx) -{ - struct screen *s = ctx->s; - - s->mode &= ~ALL_MOUSE_MODES; -} - -/* Set mouse mode on. */ -void -screen_write_mousemode_on(struct screen_write_ctx *ctx, int mode) -{ - struct screen *s = ctx->s; - - s->mode &= ~ALL_MOUSE_MODES; - s->mode |= mode; -} - -/* Set bracketed paste mode. */ -void -screen_write_bracketpaste(struct screen_write_ctx *ctx, int state) -{ - struct screen *s = ctx->s; - - if (state) - s->mode |= MODE_BRACKETPASTE; - else - s->mode &= ~MODE_BRACKETPASTE; -} - /* Line feed. */ void screen_write_linefeed(struct screen_write_ctx *ctx, int wrapped) @@ -943,30 +891,6 @@ struct screen *s = ctx->s; s->cx = 0; -} - -/* Set keypad cursor keys mode. */ -void -screen_write_kcursormode(struct screen_write_ctx *ctx, int state) -{ - struct screen *s = ctx->s; - - if (state) - s->mode |= MODE_KCURSOR; - else - s->mode &= ~MODE_KCURSOR; -} - -/* Set keypad number keys mode. */ -void -screen_write_kkeypadmode(struct screen_write_ctx *ctx, int state) -{ - struct screen *s = ctx->s; - - if (state) - s->mode |= MODE_KKEYPAD; - else - s->mode &= ~MODE_KKEYPAD; } /* Clear to end of screen from cursor. */