summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/tty.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-10-21 13:42:45 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-10-21 13:42:45 +0000
commitf2cb4c4d56578f8e1a05b663d039c023539cc760 (patch)
tree4d6361a8f170f752f6dfe2fb5bf888fab7f5f4cd /usr.bin/tmux/tty.c
parent7862967e1ca8356a5be56376492ca8c6e6a00452 (diff)
Don't redraw the scroll region on linefeed/reverse index unless it is necessary
(the cursor is at the bottom/top). Should fix slow cursor movement when using vi in a pane spotted by pirofti@.
Diffstat (limited to 'usr.bin/tmux/tty.c')
-rw-r--r--usr.bin/tmux/tty.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c
index a0bc4e2882b..0bf002583d3 100644
--- a/usr.bin/tmux/tty.c
+++ b/usr.bin/tmux/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.55 2009/10/21 09:36:53 nicm Exp $ */
+/* $OpenBSD: tty.c,v 1.56 2009/10/21 13:42:44 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -684,20 +684,21 @@ tty_cmd_reverseindex(struct tty *tty, const struct tty_ctx *ctx)
struct window_pane *wp = ctx->wp;
struct screen *s = wp->screen;
+ if (ctx->ocy != ctx->orupper)
+ return;
+
if (wp->xoff != 0 || screen_size_x(s) < tty->sx ||
!tty_term_has(tty->term, TTYC_CSR)) {
tty_redraw_region(tty, ctx);
return;
}
- if (ctx->ocy == ctx->orupper) {
- tty_reset(tty);
-
- tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
- tty_cursor_pane(tty, ctx, ctx->ocx, ctx->orupper);
-
- tty_putcode(tty, TTYC_RI);
- }
+ tty_reset(tty);
+
+ tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
+ tty_cursor_pane(tty, ctx, ctx->ocx, ctx->orupper);
+
+ tty_putcode(tty, TTYC_RI);
}
void
@@ -706,6 +707,9 @@ tty_cmd_linefeed(struct tty *tty, const struct tty_ctx *ctx)
struct window_pane *wp = ctx->wp;
struct screen *s = wp->screen;
+ if (ctx->ocy != ctx->orlower)
+ return;
+
if (wp->xoff != 0 || screen_size_x(s) < tty->sx ||
!tty_term_has(tty->term, TTYC_CSR)) {
tty_redraw_region(tty, ctx);
@@ -720,14 +724,12 @@ tty_cmd_linefeed(struct tty *tty, const struct tty_ctx *ctx)
if (ctx->num && !(tty->term->flags & TERM_EARLYWRAP))
return;
- if (ctx->ocy == ctx->orlower) {
- tty_reset(tty);
-
- tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
- tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
-
- tty_putc(tty, '\n');
- }
+ tty_reset(tty);
+
+ tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
+ tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
+
+ tty_putc(tty, '\n');
}
void