mirror of
https://github.com/tmux/tmux.git
synced 2025-01-05 23:38:48 +00:00
Add support for the SD (scroll down) escape sequence, GitHub issue 1861.
This commit is contained in:
parent
c4744620af
commit
45f4ff5485
7
input.c
7
input.c
@ -244,6 +244,7 @@ enum input_csi_type {
|
||||
INPUT_CSI_RM,
|
||||
INPUT_CSI_RM_PRIVATE,
|
||||
INPUT_CSI_SCP,
|
||||
INPUT_CSI_SD,
|
||||
INPUT_CSI_SGR,
|
||||
INPUT_CSI_SM,
|
||||
INPUT_CSI_SM_PRIVATE,
|
||||
@ -270,6 +271,7 @@ static const struct input_table_entry input_csi_table[] = {
|
||||
{ 'M', "", INPUT_CSI_DL },
|
||||
{ 'P', "", INPUT_CSI_DCH },
|
||||
{ 'S', "", INPUT_CSI_SU },
|
||||
{ 'T', "", INPUT_CSI_SD },
|
||||
{ 'X', "", INPUT_CSI_ECH },
|
||||
{ 'Z', "", INPUT_CSI_CBT },
|
||||
{ '`', "", INPUT_CSI_HPA },
|
||||
@ -1525,6 +1527,11 @@ input_csi_dispatch(struct input_ctx *ictx)
|
||||
if (n != -1)
|
||||
screen_write_scrollup(sctx, n, bg);
|
||||
break;
|
||||
case INPUT_CSI_SD:
|
||||
n = input_get(ictx, 0, 1, 1);
|
||||
if (n != -1)
|
||||
screen_write_scrolldown(sctx, n, bg);
|
||||
break;
|
||||
case INPUT_CSI_TBC:
|
||||
switch (input_get(ictx, 0, 0, 0)) {
|
||||
case -1:
|
||||
|
@ -1088,6 +1088,31 @@ screen_write_scrollup(struct screen_write_ctx *ctx, u_int lines, u_int bg)
|
||||
ctx->scrolled += lines;
|
||||
}
|
||||
|
||||
/* Scroll down. */
|
||||
void
|
||||
screen_write_scrolldown(struct screen_write_ctx *ctx, u_int lines, u_int bg)
|
||||
{
|
||||
struct screen *s = ctx->s;
|
||||
struct grid *gd = s->grid;
|
||||
struct tty_ctx ttyctx;
|
||||
u_int i;
|
||||
|
||||
screen_write_initctx(ctx, &ttyctx);
|
||||
ttyctx.bg = bg;
|
||||
|
||||
if (lines == 0)
|
||||
lines = 1;
|
||||
else if (lines > s->rlower - s->rupper + 1)
|
||||
lines = s->rlower - s->rupper + 1;
|
||||
|
||||
for (i = 0; i < lines; i++)
|
||||
grid_view_scroll_region_down(gd, s->rupper, s->rlower, bg);
|
||||
|
||||
screen_write_collect_flush(ctx, 0);
|
||||
ttyctx.num = lines;
|
||||
tty_write(tty_cmd_scrolldown, &ttyctx);
|
||||
}
|
||||
|
||||
/* Carriage return (cursor to start of line). */
|
||||
void
|
||||
screen_write_carriagereturn(struct screen_write_ctx *ctx)
|
||||
|
3
tmux.h
3
tmux.h
@ -420,6 +420,7 @@ enum tty_code_code {
|
||||
TTYC_REV,
|
||||
TTYC_RGB,
|
||||
TTYC_RI,
|
||||
TTYC_RIN,
|
||||
TTYC_RMACS,
|
||||
TTYC_RMCUP,
|
||||
TTYC_RMKX,
|
||||
@ -1925,6 +1926,7 @@ void tty_cmd_insertcharacter(struct tty *, const struct tty_ctx *);
|
||||
void tty_cmd_insertline(struct tty *, const struct tty_ctx *);
|
||||
void tty_cmd_linefeed(struct tty *, const struct tty_ctx *);
|
||||
void tty_cmd_scrollup(struct tty *, const struct tty_ctx *);
|
||||
void tty_cmd_scrolldown(struct tty *, const struct tty_ctx *);
|
||||
void tty_cmd_reverseindex(struct tty *, const struct tty_ctx *);
|
||||
void tty_cmd_setselection(struct tty *, const struct tty_ctx *);
|
||||
void tty_cmd_rawstring(struct tty *, const struct tty_ctx *);
|
||||
@ -2301,6 +2303,7 @@ void screen_write_reverseindex(struct screen_write_ctx *, u_int);
|
||||
void screen_write_scrollregion(struct screen_write_ctx *, u_int, u_int);
|
||||
void screen_write_linefeed(struct screen_write_ctx *, int, u_int);
|
||||
void screen_write_scrollup(struct screen_write_ctx *, u_int, u_int);
|
||||
void screen_write_scrolldown(struct screen_write_ctx *, u_int, u_int);
|
||||
void screen_write_carriagereturn(struct screen_write_ctx *);
|
||||
void screen_write_clearendofscreen(struct screen_write_ctx *, u_int);
|
||||
void screen_write_clearstartofscreen(struct screen_write_ctx *, u_int);
|
||||
|
@ -239,6 +239,7 @@ static const struct tty_term_code_entry tty_term_codes[] = {
|
||||
[TTYC_REV] = { TTYCODE_STRING, "rev" },
|
||||
[TTYC_RGB] = { TTYCODE_FLAG, "RGB" },
|
||||
[TTYC_RI] = { TTYCODE_STRING, "ri" },
|
||||
[TTYC_RIN] = { TTYCODE_STRING, "rin" },
|
||||
[TTYC_RMACS] = { TTYCODE_STRING, "rmacs" },
|
||||
[TTYC_RMCUP] = { TTYCODE_STRING, "rmcup" },
|
||||
[TTYC_RMKX] = { TTYCODE_STRING, "rmkx" },
|
||||
|
44
tty.c
44
tty.c
@ -1558,10 +1558,11 @@ tty_cmd_reverseindex(struct tty *tty, const struct tty_ctx *ctx)
|
||||
return;
|
||||
|
||||
if (ctx->bigger ||
|
||||
!tty_pane_full_width(tty, ctx) ||
|
||||
(!tty_pane_full_width(tty, ctx) && !tty_use_margin(tty)) ||
|
||||
tty_fake_bce(tty, wp, 8) ||
|
||||
!tty_term_has(tty->term, TTYC_CSR) ||
|
||||
!tty_term_has(tty->term, TTYC_RI) ||
|
||||
(!tty_term_has(tty->term, TTYC_RI) &&
|
||||
!tty_term_has(tty->term, TTYC_RIN)) ||
|
||||
ctx->wp->sx == 1 ||
|
||||
ctx->wp->sy == 1) {
|
||||
tty_redraw_region(tty, ctx);
|
||||
@ -1571,10 +1572,13 @@ tty_cmd_reverseindex(struct tty *tty, const struct tty_ctx *ctx)
|
||||
tty_default_attributes(tty, wp, ctx->bg);
|
||||
|
||||
tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
|
||||
tty_margin_off(tty);
|
||||
tty_margin_pane(tty, ctx);
|
||||
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->orupper);
|
||||
|
||||
tty_putcode(tty, TTYC_RI);
|
||||
if (tty_term_has(tty->term, TTYC_RI))
|
||||
tty_putcode(tty, TTYC_RI);
|
||||
else
|
||||
tty_putcode1(tty, TTYC_RIN, 1);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1652,6 +1656,38 @@ tty_cmd_scrollup(struct tty *tty, const struct tty_ctx *ctx)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tty_cmd_scrolldown(struct tty *tty, const struct tty_ctx *ctx)
|
||||
{
|
||||
struct window_pane *wp = ctx->wp;
|
||||
u_int i;
|
||||
|
||||
if (ctx->bigger ||
|
||||
(!tty_pane_full_width(tty, ctx) && !tty_use_margin(tty)) ||
|
||||
tty_fake_bce(tty, wp, 8) ||
|
||||
!tty_term_has(tty->term, TTYC_CSR) ||
|
||||
(!tty_term_has(tty->term, TTYC_RI) &&
|
||||
!tty_term_has(tty->term, TTYC_RIN)) ||
|
||||
wp->sx == 1 ||
|
||||
wp->sy == 1) {
|
||||
tty_redraw_region(tty, ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
tty_default_attributes(tty, wp, ctx->bg);
|
||||
|
||||
tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
|
||||
tty_margin_pane(tty, ctx);
|
||||
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->orupper);
|
||||
|
||||
if (tty_term_has(tty->term, TTYC_RIN))
|
||||
tty_putcode1(tty, TTYC_RIN, ctx->num);
|
||||
else {
|
||||
for (i = 0; i < ctx->num; i++)
|
||||
tty_putcode(tty, TTYC_RI);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tty_cmd_clearendofscreen(struct tty *tty, const struct tty_ctx *ctx)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user