=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/input.c,v retrieving revision 1.80 retrieving revision 1.81 diff -c -r1.80 -r1.81 *** src/usr.bin/tmux/input.c 2015/07/13 18:45:18 1.80 --- src/usr.bin/tmux/input.c 2015/08/25 15:00:05 1.81 *************** *** 1,4 **** ! /* $OpenBSD: input.c,v 1.80 2015/07/13 18:45:18 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: input.c,v 1.81 2015/08/25 15:00:05 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 1199,1204 **** --- 1199,1205 ---- struct screen *s = sctx->s; struct input_table_entry *entry; int n, m; + u_int cx; if (ictx->flags & INPUT_DISCARD) return (0); *************** *** 1217,1228 **** switch (entry->type) { case INPUT_CSI_CBT: /* Find the previous tab point, n times. */ n = input_get(ictx, 0, 1, 1); ! while (s->cx > 0 && n-- > 0) { do ! s->cx--; ! while (s->cx > 0 && !bit_test(s->tabs, s->cx)); } break; case INPUT_CSI_CUB: screen_write_cursorleft(sctx, input_get(ictx, 0, 1, 1)); --- 1218,1233 ---- switch (entry->type) { case INPUT_CSI_CBT: /* Find the previous tab point, n times. */ + cx = s->cx; + if (cx > screen_size_x(s) - 1) + cx = screen_size_x(s) - 1; n = input_get(ictx, 0, 1, 1); ! while (cx > 0 && n-- > 0) { do ! cx--; ! while (cx > 0 && !bit_test(s->tabs, cx)); } + s->cx = cx; break; case INPUT_CSI_CUB: screen_write_cursorleft(sctx, input_get(ictx, 0, 1, 1));