aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2015-08-25 18:01:07 +0100
committerThomas Adam <thomas@xteddy.org>2015-08-25 18:01:07 +0100
commitce20572ace265e3c457752b34a83bd3c47cd3b40 (patch)
treeedad207ba9641e6acf8155d46bf1bc9aa444bd7e
parent429f86397b63e8f93d0ee4a47c9bfb2e621a5ecd (diff)
parent2ffbd5b5f05dded1564ba32a6a00b0b417439b2f (diff)
downloadrtmux-ce20572ace265e3c457752b34a83bd3c47cd3b40.tar.gz
rtmux-ce20572ace265e3c457752b34a83bd3c47cd3b40.tar.bz2
rtmux-ce20572ace265e3c457752b34a83bd3c47cd3b40.zip
Merge branch 'obsd-master'
-rw-r--r--input.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/input.c b/input.c
index 095816c3..7a334810 100644
--- a/input.c
+++ b/input.c
@@ -1199,6 +1199,7 @@ input_csi_dispatch(struct input_ctx *ictx)
struct screen *s = sctx->s;
struct input_table_entry *entry;
int n, m;
+ u_int cx;
if (ictx->flags & INPUT_DISCARD)
return (0);
@@ -1217,12 +1218,16 @@ input_csi_dispatch(struct input_ctx *ictx)
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 (s->cx > 0 && n-- > 0) {
+ while (cx > 0 && n-- > 0) {
do
- s->cx--;
- while (s->cx > 0 && !bit_test(s->tabs, s->cx));
+ 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));