mirror of
https://github.com/tmux/tmux.git
synced 2025-01-07 16:28:48 +00:00
Window list with C-b W.
This commit is contained in:
parent
5ea2ac36e4
commit
3fef2d998f
6
CHANGES
6
CHANGES
@ -1,3 +1,7 @@
|
|||||||
|
22 September 2007
|
||||||
|
|
||||||
|
* Window list command (C-b W). Started by Maximilian Gass, finished by me.
|
||||||
|
|
||||||
20 September 2007
|
20 September 2007
|
||||||
|
|
||||||
* Specify meta via environment variable (META).
|
* Specify meta via environment variable (META).
|
||||||
@ -27,5 +31,5 @@
|
|||||||
(including mutt, emacs). No status bar yet and no key remapping or other
|
(including mutt, emacs). No status bar yet and no key remapping or other
|
||||||
customisation.
|
customisation.
|
||||||
|
|
||||||
$Id: CHANGES,v 1.9 2007-09-20 18:48:04 nicm Exp $
|
$Id: CHANGES,v 1.10 2007-09-22 11:50:33 nicm Exp $
|
||||||
|
|
||||||
|
8
NOTES
8
NOTES
@ -7,11 +7,13 @@ Command prefix is C-b. This can be changed by building with, for example:
|
|||||||
META=\\001 make
|
META=\\001 make
|
||||||
|
|
||||||
Commands: d detach
|
Commands: d detach
|
||||||
c create new terminal
|
c create new window
|
||||||
n next terminal
|
n next window
|
||||||
p previous terminal
|
p previous window
|
||||||
|
l last (next to last selected) window
|
||||||
r refresh screen
|
r refresh screen
|
||||||
t set window name
|
t set window name
|
||||||
|
w list current windows
|
||||||
0-9 select window
|
0-9 select window
|
||||||
|
|
||||||
There is one default server process per user which puts its socket in
|
There is one default server process per user which puts its socket in
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: command.c,v 1.6 2007-09-20 18:51:34 nicm Exp $ */
|
/* $Id: command.c,v 1.7 2007-09-22 11:50:33 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -56,7 +56,9 @@ struct cmd cmd_table[] = {
|
|||||||
{ 'T', cmd_fn_msg, MSG_RENAME },
|
{ 'T', cmd_fn_msg, MSG_RENAME },
|
||||||
{ 't', cmd_fn_msg, MSG_RENAME },
|
{ 't', cmd_fn_msg, MSG_RENAME },
|
||||||
{ 'L', cmd_fn_msg, MSG_LAST },
|
{ 'L', cmd_fn_msg, MSG_LAST },
|
||||||
{ 'l', cmd_fn_msg, MSG_LAST }
|
{ 'l', cmd_fn_msg, MSG_LAST },
|
||||||
|
{ 'W', cmd_fn_msg, MSG_WINDOWLIST },
|
||||||
|
{ 'w', cmd_fn_msg, MSG_WINDOWLIST }
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Dispatch to a command. */
|
/* Dispatch to a command. */
|
||||||
|
43
server.c
43
server.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: server.c,v 1.10 2007-09-21 19:24:37 nicm Exp $ */
|
/* $Id: server.c,v 1.11 2007-09-22 11:50:33 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -76,6 +76,7 @@ void process_sessions_msg(struct client *, struct hdr *);
|
|||||||
void process_windows_msg(struct client *, struct hdr *);
|
void process_windows_msg(struct client *, struct hdr *);
|
||||||
void process_rename_msg(struct client *, struct hdr *);
|
void process_rename_msg(struct client *, struct hdr *);
|
||||||
void process_last_msg(struct client *, struct hdr *);
|
void process_last_msg(struct client *, struct hdr *);
|
||||||
|
void process_windowlist_msg(struct client *, struct hdr *);
|
||||||
void rename_callback(struct client *, const char *);
|
void rename_callback(struct client *, const char *);
|
||||||
|
|
||||||
/* Fork and start server process. */
|
/* Fork and start server process. */
|
||||||
@ -383,11 +384,11 @@ write_message(struct client *c, const char *fmt, ...)
|
|||||||
input_store16(c->out, 7);
|
input_store16(c->out, 7);
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
xvasprintf(&msg, fmt, ap);
|
xvasprintf(&msg, fmt, ap);
|
||||||
buffer_write(c->out, msg, strlen(msg));
|
|
||||||
xfree(msg);
|
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
buffer_write(c->out, msg, strlen(msg));
|
||||||
for (i = strlen(msg); i < c->sx; i++)
|
for (i = strlen(msg); i < c->sx; i++)
|
||||||
input_store8(c->out, ' ');
|
input_store8(c->out, ' ');
|
||||||
|
xfree(msg);
|
||||||
|
|
||||||
size = BUFFER_USED(c->out) - size;
|
size = BUFFER_USED(c->out) - size;
|
||||||
hdr.type = MSG_OUTPUT;
|
hdr.type = MSG_OUTPUT;
|
||||||
@ -778,6 +779,9 @@ process_client(struct client *c)
|
|||||||
case MSG_LAST:
|
case MSG_LAST:
|
||||||
process_last_msg(c, &hdr);
|
process_last_msg(c, &hdr);
|
||||||
break;
|
break;
|
||||||
|
case MSG_WINDOWLIST:
|
||||||
|
process_windowlist_msg(c, &hdr);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
fatalx("unexpected message");
|
fatalx("unexpected message");
|
||||||
}
|
}
|
||||||
@ -1086,6 +1090,39 @@ process_last_msg(struct client *c, struct hdr *hdr)
|
|||||||
write_message(c, "No last window");
|
write_message(c, "No last window");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Window list message from client */
|
||||||
|
void
|
||||||
|
process_windowlist_msg(struct client *c, struct hdr *hdr)
|
||||||
|
{
|
||||||
|
struct window *w;
|
||||||
|
char *buf;
|
||||||
|
size_t len, off;
|
||||||
|
u_int i;
|
||||||
|
|
||||||
|
if (c->session == NULL)
|
||||||
|
return;
|
||||||
|
if (hdr->size != 0)
|
||||||
|
fatalx("bad MSG_WINDOWLIST size");
|
||||||
|
|
||||||
|
len = c->sx + 1;
|
||||||
|
buf = xmalloc(len);
|
||||||
|
off = 0;
|
||||||
|
|
||||||
|
*buf = '\0';
|
||||||
|
for (i = 0; i < ARRAY_LENGTH(&c->session->windows); i++) {
|
||||||
|
w = ARRAY_ITEM(&c->session->windows, i);
|
||||||
|
if (w == NULL)
|
||||||
|
continue;
|
||||||
|
off += xsnprintf(buf + off, len - off, "%u:%s%s ", i, w->name,
|
||||||
|
w == c->session->window ? "*" : "");
|
||||||
|
if (off >= len)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
write_message(c, "%s", buf);
|
||||||
|
xfree(buf);
|
||||||
|
}
|
||||||
|
|
||||||
/* Callback for rename. */
|
/* Callback for rename. */
|
||||||
void
|
void
|
||||||
rename_callback(struct client *c, const char *string)
|
rename_callback(struct client *c, const char *string)
|
||||||
|
5
tmux.h
5
tmux.h
@ -1,4 +1,4 @@
|
|||||||
/* $Id: tmux.h,v 1.9 2007-09-20 18:03:23 nicm Exp $ */
|
/* $Id: tmux.h,v 1.10 2007-09-22 11:50:33 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -282,7 +282,8 @@ enum hdrtype {
|
|||||||
MSG_WINDOWS,
|
MSG_WINDOWS,
|
||||||
MSG_PAUSE,
|
MSG_PAUSE,
|
||||||
MSG_RENAME,
|
MSG_RENAME,
|
||||||
MSG_LAST
|
MSG_LAST,
|
||||||
|
MSG_WINDOWLIST
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Message header structure. */
|
/* Message header structure. */
|
||||||
|
Loading…
Reference in New Issue
Block a user