Hi
I know this was on the TODO list, and I don't want to sound discouraging
but does anything actually use it?
If we made tmux use it I support tmux-in-tmux would be one case...
On Wed, Apr 30, 2014 at 10:55:49PM -0500, J Raynor wrote:
> I've attached a patch which implements xterm's title stack
> functionality for screens inside tmux.
> diff --git a/input.c b/input.c
> index b6c27cb..c7bf0a2 100644
> --- a/input.c
> +++ b/input.c
> @@ -1493,8 +1493,6 @@ input_csi_dispatch_winops(struct input_ctx *ictx)
> /* FALLTHROUGH */
> case 9:
> case 10:
> - case 22:
> - case 23:
> m++;
> if (input_get(ictx, m, 0, -1) == -1)
> return;
> @@ -1502,6 +1500,29 @@ input_csi_dispatch_winops(struct input_ctx *ictx)
> case 18:
> input_reply(ictx, "\033[8;%u;%u", wp->sy, wp->sx);
> break;
> + case 22:
> + m++;
> + switch (input_get(ictx, m, 0, -1)) {
> + case 0:
> + case 2:
> + screen_save_title(ictx->wp->screen);
> + /* FALLTHROUGH */
> + default:
> + break;
> + }
> + break;
> + case 23:
> + m++;
> + switch (input_get(ictx, m, 0, -1)) {
> + case 0:
> + case 2:
> + screen_restore_title(ictx->wp->screen);
> + server_status_window(ictx->wp->window);
> + /* FALLTHROUGH */
> + default:
> + break;
> + }
> + break;
> default:
> log_debug("%s: unknown '%c'", __func__, ictx->ch);
> break;
> diff --git a/screen.c b/screen.c
> index 7bfc015..63f34a0 100644
> --- a/screen.c
> +++ b/screen.c
> @@ -44,6 +44,7 @@ screen_init(struct screen *s, u_int sx, u_int sy, u_int
> hlimit)
> s->cstyle = 0;
> s->ccolour = xstrdup("");
> s->tabs = NULL;
> + ARRAY_INIT(&s->title_stack);
>
> screen_reinit(s);
> }
> @@ -71,6 +72,12 @@ screen_reinit(struct screen *s)
> void
> screen_free(struct screen *s)
> {
> + u_int i;
> +
> + for (i = 0; i < ARRAY_LENGTH(&s->title_stack); i++)
> + free(ARRAY_ITEM(&s->title_stack, i));
> +
> + ARRAY_FREE(&s->title_stack);
> free(s->tabs);
> free(s->title);
> free(s->ccolour);
> @@ -115,6 +122,29 @@ screen_set_title(struct screen *s, const char *title)
> s->title = xstrdup(title);
> }
>
> +/* Save screen title on the title stack */
> +void
> +screen_save_title(struct screen *s)
> +{
> + ARRAY_INSERT(&s->title_stack, 0, xstrdup(s->title));
> +}
> +
> +/* Restore screen title from the title stack */
> +void
> +screen_restore_title(struct screen *s)
> +{
> + char *t;
> +
> + if (ARRAY_LENGTH(&s->title_stack) == 0)
> + return;
> +
> + t = ARRAY_FIRST(&s->title_stack);
> + ARRAY_REMOVE(&s->title_stack, 0);
> +
> + screen_set_title(s, t);
> + free(t);
> +}
> +
> /* Resize screen. */
> void
> screen_resize(struct screen *s, u_int sx, u_int sy, int reflow)
> diff --git a/tmux.h b/tmux.h
> index fde94af..4871cbc 100644
> --- a/tmux.h
> +++ b/tmux.h
> @@ -767,6 +767,7 @@ struct screen_sel {
> /* Virtual screen. */
> struct screen {
> char *title;
> + ARRAY_DECL(, char *) title_stack;
>
> struct grid *grid; /* grid data */
>
> @@ -2091,6 +2092,8 @@ void screen_reset_tabs(struct screen *);
> void screen_set_cursor_style(struct screen *, u_int);
> void screen_set_cursor_colour(struct screen *, const char *);
> void screen_set_title(struct screen *, const char *);
> +void screen_save_title(struct screen *);
> +void screen_restore_title(struct screen *);
> void screen_resize(struct screen *, u_int, u_int, int);
> void screen_set_selection(struct screen *,
> u_int, u_int, u_int, u_int, u_int, struct grid_cell *);
> ------------------------------------------------------------------------------
> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
> Instantly run your Selenium tests across 300+ browser/OS combos. Get
> unparalleled scalability from the best Selenium testing platform available.
> Simple to use. Nothing to install. Get started now for free."
> http://p.sf.net/sfu/SauceLabs
> _______________________________________________
> tmux-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/tmux-users
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos. Get
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
tmux-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-users