diff options
author | 2019-03-12 13:14:14 +0000 | |
---|---|---|
committer | 2019-03-12 13:14:14 +0000 | |
commit | 94b5b5e9b163912637da194a29ac1e30cd9f5302 (patch) | |
tree | 71c787d263548a8a2d678bb1202becba88d5def5 | |
parent | When asked for a window index, return it even if the window exists. (diff) | |
download | wireguard-openbsd-94b5b5e9b163912637da194a29ac1e30cd9f5302.tar.xz wireguard-openbsd-94b5b5e9b163912637da194a29ac1e30cd9f5302.zip |
Fix wrapping after origin mode change.
-rw-r--r-- | usr.bin/tmux/screen-write.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.bin/tmux/screen-write.c b/usr.bin/tmux/screen-write.c index abdc2f06c8c..84ea657b82f 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.144 2019/03/12 07:39:27 nicm Exp $ */ +/* $OpenBSD: screen-write.c,v 1.145 2019/03/12 13:14:14 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -75,7 +75,7 @@ screen_write_set_cursor(struct screen_write_ctx *ctx, int cx, int cy) return; if (cx != -1) { - if ((u_int)cx > screen_size_x(s) - 1) + if ((u_int)cx > screen_size_x(s)) /* allow last column */ cx = screen_size_x(s) - 1; s->cx = cx; } @@ -1045,6 +1045,11 @@ screen_write_cursormove(struct screen_write_ctx *ctx, u_int px, u_int py) py += s->rupper; } + if (px > screen_size_x(s) - 1) + px = screen_size_x(s) - 1; + if (py > screen_size_y(s) - 1) + py = screen_size_y(s) - 1; + screen_write_set_cursor(ctx, px, py); } |