diff options
author | nicm <nicm> | 2018-04-23 07:41:30 +0000 |
---|---|---|
committer | nicm <nicm> | 2018-04-23 07:41:30 +0000 |
commit | 1afe71cc0ade7a29241de52b290d1e139cf98f7c (patch) | |
tree | e071cfbad1fb94d743c37305e68159011c3d7fcd /tty.c | |
parent | 3dceddd70ea8491aed082efbb551ca352e97e03d (diff) | |
download | rtmux-1afe71cc0ade7a29241de52b290d1e139cf98f7c.tar.gz rtmux-1afe71cc0ade7a29241de52b290d1e139cf98f7c.tar.bz2 rtmux-1afe71cc0ade7a29241de52b290d1e139cf98f7c.zip |
rxvt-unicode has some funny behaviour when scrolling with the cursor not
at column 1, so move it back there first if possible. GitHub issue 1318.
Diffstat (limited to 'tty.c')
-rw-r--r-- | tty.c | 26 |
1 files changed, 18 insertions, 8 deletions
@@ -1244,13 +1244,18 @@ tty_cmd_linefeed(struct tty *tty, const struct tty_ctx *ctx) tty_margin_pane(tty, ctx); /* - * If we want to wrap a pane, the cursor needs to be exactly on the - * right of the region. But if the pane isn't on the right, it may be - * off the edge - if so, move the cursor back to the right. + * If we want to wrap a pane while using margins, the cursor needs to + * be exactly on the right of the region. If the cursor is entirely off + * the edge - move it back to the right. Some terminals are funny about + * this and insert extra spaces, so only use the right if margins are + * enabled. */ - if (ctx->xoff + ctx->ocx > tty->rright) - tty_cursor(tty, tty->rright, ctx->yoff + ctx->ocy); - else + if (ctx->xoff + ctx->ocx > tty->rright) { + if (!tty_use_margin(tty)) + tty_cursor(tty, 0, ctx->yoff + ctx->ocy); + else + tty_cursor(tty, tty->rright, ctx->yoff + ctx->ocy); + } else tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy); tty_putc(tty, '\n'); @@ -1275,11 +1280,16 @@ tty_cmd_scrollup(struct tty *tty, const struct tty_ctx *ctx) tty_margin_pane(tty, ctx); if (ctx->num == 1 || !tty_term_has(tty->term, TTYC_INDN)) { - tty_cursor(tty, tty->rright, tty->rlower); + if (!tty_use_margin(tty)) + tty_cursor(tty, 0, tty->rlower); + else + tty_cursor(tty, tty->rright, tty->rlower); for (i = 0; i < ctx->num; i++) tty_putc(tty, '\n'); - } else + } else { + tty_cursor(tty, 0, tty->cy); tty_putcode1(tty, TTYC_INDN, ctx->num); + } } void |