aboutsummaryrefslogtreecommitdiff
path: root/tty.c
diff options
context:
space:
mode:
authornicm <nicm>2020-05-16 14:22:51 +0000
committernicm <nicm>2020-05-16 14:22:51 +0000
commit4e0a718666e3c24e69be107d0a294a9ae9f59388 (patch)
tree50a49690c4fb9b668e850b0638243c12999f03ca /tty.c
parent41dec585df8723a8e268a80930d7f9ce395829dc (diff)
downloadrtmux-4e0a718666e3c24e69be107d0a294a9ae9f59388.tar.gz
rtmux-4e0a718666e3c24e69be107d0a294a9ae9f59388.tar.bz2
rtmux-4e0a718666e3c24e69be107d0a294a9ae9f59388.zip
Add extension terminfo(5) capabilities for margins.
Diffstat (limited to 'tty.c')
-rw-r--r--tty.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/tty.c b/tty.c
index 5d7d2c0d..5d84c9e8 100644
--- a/tty.c
+++ b/tty.c
@@ -426,7 +426,7 @@ tty_stop_tty(struct tty *tty)
}
if (tty_use_margin(tty))
- tty_raw(tty, "\033[?69l"); /* DECLRMM */
+ tty_raw(tty, tty_term_string(tty->term, TTYC_DSMG));
tty_raw(tty, tty_term_string(tty->term, TTYC_RMCUP));
setblocking(tty->fd, 1);
@@ -473,7 +473,7 @@ tty_update_features(struct tty *tty)
tty_term_apply_overrides(tty->term);
if (tty_use_margin(tty))
- tty_puts(tty, "\033[?69h"); /* DECLRMM */
+ tty_putcode(tty, TTYC_ENMG);
}
void
@@ -2028,7 +2028,7 @@ tty_invalidate(struct tty *tty)
if (tty->flags & TTY_STARTED) {
if (tty_use_margin(tty))
- tty_puts(tty, "\033[?69h"); /* DECLRMM */
+ tty_putcode(tty, TTYC_ENMG);
tty_putcode(tty, TTYC_SGR0);
tty->mode = ALL_MODES;
@@ -2105,8 +2105,6 @@ tty_margin_pane(struct tty *tty, const struct tty_ctx *ctx)
static void
tty_margin(struct tty *tty, u_int rleft, u_int rright)
{
- char s[64];
-
if (!tty_use_margin(tty))
return;
if (tty->rleft == rleft && tty->rright == rright)
@@ -2118,10 +2116,9 @@ tty_margin(struct tty *tty, u_int rleft, u_int rright)
tty->rright = rright;
if (rleft == 0 && rright == tty->sx - 1)
- snprintf(s, sizeof s, "\033[s");
+ tty_putcode(tty, TTYC_CLMG);
else
- snprintf(s, sizeof s, "\033[%u;%us", rleft + 1, rright + 1);
- tty_puts(tty, s);
+ tty_putcode2(tty, TTYC_CMG, rleft, rright);
tty->cx = tty->cy = UINT_MAX;
}