mirror of
https://github.com/tmate-io/tmate-ssh-server.git
synced 2020-11-18 19:53:51 -08:00
Support the 47 and 1047 SM and RM sequences (alternate screen without
cursor), requested by I forget who ages ago.
This commit is contained in:
parent
9b8998aeec
commit
24d7d073ff
12
input.c
12
input.c
@ -1255,8 +1255,12 @@ input_csi_dispatch(struct input_ctx *ictx)
|
|||||||
case 1005:
|
case 1005:
|
||||||
screen_write_utf8mousemode(&ictx->ctx, 0);
|
screen_write_utf8mousemode(&ictx->ctx, 0);
|
||||||
break;
|
break;
|
||||||
|
case 47:
|
||||||
|
case 1047:
|
||||||
|
window_pane_alternate_off(wp, &ictx->cell, 0);
|
||||||
|
break;
|
||||||
case 1049:
|
case 1049:
|
||||||
window_pane_alternate_off(wp, &ictx->cell);
|
window_pane_alternate_off(wp, &ictx->cell, 1);
|
||||||
break;
|
break;
|
||||||
case 2004:
|
case 2004:
|
||||||
screen_write_bracketpaste(&ictx->ctx, 0);
|
screen_write_bracketpaste(&ictx->ctx, 0);
|
||||||
@ -1310,8 +1314,12 @@ input_csi_dispatch(struct input_ctx *ictx)
|
|||||||
case 1005:
|
case 1005:
|
||||||
screen_write_utf8mousemode(&ictx->ctx, 1);
|
screen_write_utf8mousemode(&ictx->ctx, 1);
|
||||||
break;
|
break;
|
||||||
|
case 47:
|
||||||
|
case 1047:
|
||||||
|
window_pane_alternate_on(wp, &ictx->cell, 0);
|
||||||
|
break;
|
||||||
case 1049:
|
case 1049:
|
||||||
window_pane_alternate_on(wp, &ictx->cell);
|
window_pane_alternate_on(wp, &ictx->cell, 1);
|
||||||
break;
|
break;
|
||||||
case 2004:
|
case 2004:
|
||||||
screen_write_bracketpaste(&ictx->ctx, 1);
|
screen_write_bracketpaste(&ictx->ctx, 1);
|
||||||
|
8
tmux.h
8
tmux.h
@ -2145,10 +2145,10 @@ int window_pane_spawn(struct window_pane *, const char *,
|
|||||||
const char *, const char *, struct environ *,
|
const char *, const char *, struct environ *,
|
||||||
struct termios *, char **);
|
struct termios *, char **);
|
||||||
void window_pane_resize(struct window_pane *, u_int, u_int);
|
void window_pane_resize(struct window_pane *, u_int, u_int);
|
||||||
void window_pane_alternate_on(
|
void window_pane_alternate_on(struct window_pane *,
|
||||||
struct window_pane *, struct grid_cell *);
|
struct grid_cell *, int);
|
||||||
void window_pane_alternate_off(
|
void window_pane_alternate_off(struct window_pane *,
|
||||||
struct window_pane *, struct grid_cell *);
|
struct grid_cell *, int);
|
||||||
int window_pane_set_mode(
|
int window_pane_set_mode(
|
||||||
struct window_pane *, const struct window_mode *);
|
struct window_pane *, const struct window_mode *);
|
||||||
void window_pane_reset_mode(struct window_pane *);
|
void window_pane_reset_mode(struct window_pane *);
|
||||||
|
10
window.c
10
window.c
@ -867,7 +867,8 @@ window_pane_resize(struct window_pane *wp, u_int sx, u_int sy)
|
|||||||
* history is not updated
|
* history is not updated
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
window_pane_alternate_on(struct window_pane *wp, struct grid_cell *gc)
|
window_pane_alternate_on(struct window_pane *wp, struct grid_cell *gc,
|
||||||
|
int cursor)
|
||||||
{
|
{
|
||||||
struct screen *s = &wp->base;
|
struct screen *s = &wp->base;
|
||||||
u_int sx, sy;
|
u_int sx, sy;
|
||||||
@ -881,8 +882,10 @@ window_pane_alternate_on(struct window_pane *wp, struct grid_cell *gc)
|
|||||||
|
|
||||||
wp->saved_grid = grid_create(sx, sy, 0);
|
wp->saved_grid = grid_create(sx, sy, 0);
|
||||||
grid_duplicate_lines(wp->saved_grid, 0, s->grid, screen_hsize(s), sy);
|
grid_duplicate_lines(wp->saved_grid, 0, s->grid, screen_hsize(s), sy);
|
||||||
|
if (cursor) {
|
||||||
wp->saved_cx = s->cx;
|
wp->saved_cx = s->cx;
|
||||||
wp->saved_cy = s->cy;
|
wp->saved_cy = s->cy;
|
||||||
|
}
|
||||||
memcpy(&wp->saved_cell, gc, sizeof wp->saved_cell);
|
memcpy(&wp->saved_cell, gc, sizeof wp->saved_cell);
|
||||||
|
|
||||||
grid_view_clear(s->grid, 0, 0, sx, sy);
|
grid_view_clear(s->grid, 0, 0, sx, sy);
|
||||||
@ -894,7 +897,8 @@ window_pane_alternate_on(struct window_pane *wp, struct grid_cell *gc)
|
|||||||
|
|
||||||
/* Exit alternate screen mode and restore the copied grid. */
|
/* Exit alternate screen mode and restore the copied grid. */
|
||||||
void
|
void
|
||||||
window_pane_alternate_off(struct window_pane *wp, struct grid_cell *gc)
|
window_pane_alternate_off(struct window_pane *wp, struct grid_cell *gc,
|
||||||
|
int cursor)
|
||||||
{
|
{
|
||||||
struct screen *s = &wp->base;
|
struct screen *s = &wp->base;
|
||||||
u_int sx, sy;
|
u_int sx, sy;
|
||||||
@ -915,9 +919,11 @@ window_pane_alternate_off(struct window_pane *wp, struct grid_cell *gc)
|
|||||||
|
|
||||||
/* Restore the grid, cursor position and cell. */
|
/* Restore the grid, cursor position and cell. */
|
||||||
grid_duplicate_lines(s->grid, screen_hsize(s), wp->saved_grid, 0, sy);
|
grid_duplicate_lines(s->grid, screen_hsize(s), wp->saved_grid, 0, sy);
|
||||||
|
if (cursor)
|
||||||
s->cx = wp->saved_cx;
|
s->cx = wp->saved_cx;
|
||||||
if (s->cx > screen_size_x(s) - 1)
|
if (s->cx > screen_size_x(s) - 1)
|
||||||
s->cx = screen_size_x(s) - 1;
|
s->cx = screen_size_x(s) - 1;
|
||||||
|
if (cursor)
|
||||||
s->cy = wp->saved_cy;
|
s->cy = wp->saved_cy;
|
||||||
if (s->cy > screen_size_y(s) - 1)
|
if (s->cy > screen_size_y(s) - 1)
|
||||||
s->cy = screen_size_y(s) - 1;
|
s->cy = screen_size_y(s) - 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user