Window info command.

pull/1/head
Nicholas Marriott 2007-09-30 13:02:14 +00:00
parent f4fd8c225e
commit 308bc18947
5 changed files with 43 additions and 5 deletions

View File

@ -1,3 +1,7 @@
30 September 2007
* (nicm) Window info command for debugging, C-b I.
29 September 2007
* (nicm) Deleting/inserting lines should follow scrolling region. Fix.
@ -76,5 +80,5 @@
(including mutt, emacs). No status bar yet and no key remapping or other
customisation.
$Id: CHANGES,v 1.17 2007-09-29 21:10:26 nicm Exp $
$Id: CHANGES,v 1.18 2007-09-30 13:02:14 nicm Exp $

1
TODO
View File

@ -21,7 +21,6 @@
- figure out once and for all what is going on with backspace and del
- deal properly with ambiguous ops... list-sessions & list-windows
- keys to add:
i : show window info (show name, title, size, tty, ...)
meta-meta : pass through meta (will need this...)
- commands to add:
rename sessions

View File

@ -1,4 +1,4 @@
/* $Id: client-cmd.c,v 1.5 2007-09-28 21:41:52 mxey Exp $ */
/* $Id: client-cmd.c,v 1.6 2007-09-30 13:02:14 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -57,6 +57,8 @@ struct cmd client_cmd_table[] = {
{ 'l', client_cmd_fn_msg, MSG_LAST },
{ 'W', client_cmd_fn_msg, MSG_WINDOWLIST },
{ 'w', client_cmd_fn_msg, MSG_WINDOWLIST },
{ 'I', client_cmd_fn_msg, MSG_WINDOWINFO },
{ 'i', client_cmd_fn_msg, MSG_WINDOWINFO },
};
#define NCLIENTCMD (sizeof client_cmd_table / sizeof client_cmd_table[0])

View File

@ -1,4 +1,4 @@
/* $Id: server-msg.c,v 1.11 2007-09-29 19:53:39 nicm Exp $ */
/* $Id: server-msg.c,v 1.12 2007-09-30 13:02:14 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -37,6 +37,7 @@ int server_msg_fn_select(struct hdr *, struct client *);
int server_msg_fn_sessions(struct hdr *, struct client *);
int server_msg_fn_size(struct hdr *, struct client *);
int server_msg_fn_windowlist(struct hdr *, struct client *);
int server_msg_fn_windowinfo(struct hdr *, struct client *);
int server_msg_fn_windows(struct hdr *, struct client *);
struct server_msg {
@ -58,6 +59,7 @@ struct server_msg server_msg_table[] = {
{ MSG_SESSIONS, server_msg_fn_sessions },
{ MSG_SIZE, server_msg_fn_size },
{ MSG_WINDOWLIST, server_msg_fn_windowlist },
{ MSG_WINDOWINFO, server_msg_fn_windowinfo },
{ MSG_WINDOWS, server_msg_fn_windows },
};
#define NSERVERMSG (sizeof server_msg_table / sizeof server_msg_table[0])
@ -472,3 +474,33 @@ server_msg_fn_windowlist(struct hdr *hdr, struct client *c)
return (0);
}
/* Window info message from client */
int
server_msg_fn_windowinfo(struct hdr *hdr, struct client *c)
{
struct window *w;
char *buf;
size_t len;
u_int i;
if (c->session == NULL)
return (0);
if (hdr->size != 0)
fatalx("bad MSG_WINDOWINFO size");
len = c->sx + 1;
buf = xmalloc(len);
w = c->session->window;
window_index(&c->session->windows, w, &i);
xsnprintf(buf, len, "%u:%s \"%s\" (size %u,%u) (cursor %u,%u) "
"(region %u,%u)", i, w->name, w->screen.title, w->screen.sx,
w->screen.sy, w->screen.cx, w->screen.cy, w->screen.ry_upper,
w->screen.ry_lower);
server_write_message(c, "%s", buf);
xfree(buf);
return (0);
}

3
tmux.h
View File

@ -1,4 +1,4 @@
/* $Id: tmux.h,v 1.27 2007-09-29 18:48:54 nicm Exp $ */
/* $Id: tmux.h,v 1.28 2007-09-30 13:02:14 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -276,6 +276,7 @@ enum hdrtype {
MSG_SELECT,
MSG_SESSIONS,
MSG_SIZE,
MSG_WINDOWINFO,
MSG_WINDOWLIST,
MSG_WINDOWS,
};