diff options
-rw-r--r-- | usr.bin/tmux/input.c | 6 | ||||
-rw-r--r-- | usr.bin/tmux/screen-write.c | 12 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 4 |
3 files changed, 11 insertions, 11 deletions
diff --git a/usr.bin/tmux/input.c b/usr.bin/tmux/input.c index d813edba9ce..6dba187a261 100644 --- a/usr.bin/tmux/input.c +++ b/usr.bin/tmux/input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: input.c,v 1.144 2019/03/12 18:26:57 nicm Exp $ */ +/* $OpenBSD: input.c,v 1.145 2019/03/12 18:30:08 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -1447,7 +1447,7 @@ input_csi_dispatch(struct input_ctx *ictx) case INPUT_CSI_HPA: n = input_get(ictx, 0, 1, 1); if (n != -1) - screen_write_cursormove(sctx, n - 1, s->cy); + screen_write_cursormove(sctx, n - 1, -1); break; case INPUT_CSI_ICH: n = input_get(ictx, 0, 1, 1); @@ -1519,7 +1519,7 @@ input_csi_dispatch(struct input_ctx *ictx) case INPUT_CSI_VPA: n = input_get(ictx, 0, 1, 1); if (n != -1) - screen_write_cursormove(sctx, s->cx, n - 1); + screen_write_cursormove(sctx, -1, n - 1); break; case INPUT_CSI_DECSCUSR: n = input_get(ictx, 0, 0, 0); diff --git a/usr.bin/tmux/screen-write.c b/usr.bin/tmux/screen-write.c index 84ea657b82f..1bebb7a3fbb 100644 --- a/usr.bin/tmux/screen-write.c +++ b/usr.bin/tmux/screen-write.c @@ -1,4 +1,4 @@ -/* $OpenBSD: screen-write.c,v 1.145 2019/03/12 13:14:14 nicm Exp $ */ +/* $OpenBSD: screen-write.c,v 1.146 2019/03/12 18:30:08 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -1034,20 +1034,20 @@ screen_write_clearstartofline(struct screen_write_ctx *ctx, u_int bg) /* Move cursor to px,py. */ void -screen_write_cursormove(struct screen_write_ctx *ctx, u_int px, u_int py) +screen_write_cursormove(struct screen_write_ctx *ctx, int px, int py) { struct screen *s = ctx->s; - if (s->mode & MODE_ORIGIN) { - if (py > s->rlower - s->rupper) + if (py != -1 && (s->mode & MODE_ORIGIN)) { + if ((u_int)py > s->rlower - s->rupper) py = s->rlower; else py += s->rupper; } - if (px > screen_size_x(s) - 1) + if (px != -1 && (u_int)px > screen_size_x(s) - 1) px = screen_size_x(s) - 1; - if (py > screen_size_y(s) - 1) + if (py != -1 && (u_int)py > screen_size_y(s) - 1) py = screen_size_y(s) - 1; screen_write_set_cursor(ctx, px, py); diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 0428bceeec5..dbd67314b37 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.859 2019/03/12 13:56:30 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.860 2019/03/12 18:30:08 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -2100,7 +2100,7 @@ void screen_write_deleteline(struct screen_write_ctx *, u_int, u_int); void screen_write_clearline(struct screen_write_ctx *, u_int); void screen_write_clearendofline(struct screen_write_ctx *, u_int); void screen_write_clearstartofline(struct screen_write_ctx *, u_int); -void screen_write_cursormove(struct screen_write_ctx *, u_int, u_int); +void screen_write_cursormove(struct screen_write_ctx *, int, int); void screen_write_reverseindex(struct screen_write_ctx *, u_int); void screen_write_scrollregion(struct screen_write_ctx *, u_int, u_int); void screen_write_linefeed(struct screen_write_ctx *, int, u_int); |