=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/screen-write.c,v retrieving revision 1.144 retrieving revision 1.145 diff -c -r1.144 -r1.145 *** src/usr.bin/tmux/screen-write.c 2019/03/12 07:39:27 1.144 --- src/usr.bin/tmux/screen-write.c 2019/03/12 13:14:14 1.145 *************** *** 1,4 **** ! /* $OpenBSD: screen-write.c,v 1.144 2019/03/12 07:39:27 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: screen-write.c,v 1.145 2019/03/12 13:14:14 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 75,81 **** return; if (cx != -1) { ! if ((u_int)cx > screen_size_x(s) - 1) cx = screen_size_x(s) - 1; s->cx = cx; } --- 75,81 ---- return; if (cx != -1) { ! if ((u_int)cx > screen_size_x(s)) /* allow last column */ cx = screen_size_x(s) - 1; s->cx = cx; } *************** *** 1044,1049 **** --- 1044,1054 ---- else 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); }