[PATCH] send-keys: Add optional `-l' flag
If you want to send a string "C-a" to a pane, you have to do send-keys C - a ...or something similar; but certainly not "C-a", because that would be looked up as a key name. While scripting, you probably don't want to bother whether or not a string also names a key or not. This adds a flag, that forces a given string to be send to a pane literally (hence `-l'): send-keys -l C-a Signed-off-by: Frank Terbeck --- cmd-send-keys.c |7 --- tmux.1 |6 -- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/cmd-send-keys.c b/cmd-send-keys.c index 3403741..9e6dfe5 100644 --- a/cmd-send-keys.c +++ b/cmd-send-keys.c @@ -31,8 +31,8 @@ int cmd_send_keys_exec(struct cmd *, struct cmd_ctx *); const struct cmd_entry cmd_send_keys_entry = { "send-keys", "send", - "Rt:", 0, -1, - "[-R] [-t target-pane] key ...", + "Rlt:", 0, -1, + "[-Rl] [-t target-pane] key ...", 0, NULL, NULL, @@ -71,7 +71,8 @@ cmd_send_keys_exec(struct cmd *self, struct cmd_ctx *ctx) for (i = 0; i < args->argc; i++) { str = args->argv[i]; - if ((key = key_string_lookup_string(str)) != KEYC_NONE) { + if (!args_has(args, 'l') && + (key = key_string_lookup_string(str)) != KEYC_NONE) { window_pane_key(wp, s, key); } else { for (; *str != '\0'; str++) diff --git a/tmux.1 b/tmux.1 index 295f021..0092196 100644 --- a/tmux.1 +++ b/tmux.1 @@ -1639,7 +1639,7 @@ are listed; this may be one of: or .Em emacs-copy . .It Xo Ic send-keys -.Fl R +.Op Fl Rl .Op Fl t Ar target-pane .Ar key Ar ... .Xc @@ -1652,7 +1652,9 @@ is the name of the key (such as or .Ql npage ) to send; if the string is not recognised as a key, it is sent as a series of -characters. +characters. The +.Fl l +flag disables any key name lookups and forces a string to be send literally. All arguments are sent sequentially from first to last. The .Fl R -- 1.7.8.rc3.17.gf56ef1 -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users
Re: status at top
Nicholas Marriott writes: > Testing from people who use the mouse but are going to keep status line > at the bottom would be useful too (apply this and set -g status-position > bottom). This (or at least the version in svn) reintroduces a bug I fixed a few weeks ago: clicking on the status line to change windows also changes the active pane. -- Romain Francoise http://people.debian.org/~rfrancoise/ -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users
Re: status at top
Whoops, think this should fix: Index: server-client.c === RCS file: /cvs/src/usr.bin/tmux/server-client.c,v retrieving revision 1.66 diff -u -p -r1.66 server-client.c --- server-client.c 29 Jan 2012 09:37:02 - 1.66 +++ server-client.c 1 Feb 2012 00:09:03 - @@ -293,6 +293,8 @@ server_client_check_mouse( } return; } + memcpy(&c->last_mouse, mouse, sizeof c->last_mouse); + return; } /* On Tue, Jan 31, 2012 at 09:20:11PM +0100, Romain Francoise wrote: > Nicholas Marriott writes: > > > Testing from people who use the mouse but are going to keep status line > > at the bottom would be useful too (apply this and set -g status-position > > bottom). > > This (or at least the version in svn) reintroduces a bug I fixed a few > weeks ago: clicking on the status line to change windows also changes the > active pane. > > -- > Romain Francoise > http://people.debian.org/~rfrancoise/ -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users
patch - refactor setting window name into window_set_name
This patch replaces the repeated pattern of freeing a window name and setting it to a strdup'ed value with a function. It lays the trail for a future patch which adds a control client notification when windows are renamed. Do you want me to send a patch for the list-windows target or are you handling that? I'm not exactly sure how you wanted that to work. Index: tmux.h === --- tmux.h (revision 2691) +++ tmux.h (working copy) @@ -1964,6 +1964,7 @@ struct window_pane *window_pane_find_down(struct window_pane *); struct window_pane *window_pane_find_left(struct window_pane *); struct window_pane *window_pane_find_right(struct window_pane *); +voidwindow_set_name(struct window *, const char *); /* layout.c */ u_int layout_count_cells(struct layout_cell *); Index: cmd-new-session.c === --- cmd-new-session.c (revision 2691) +++ cmd-new-session.c (working copy) @@ -217,8 +217,7 @@ if (cmd != NULL && args_has(args, 'n')) { w = s->curw->window; - xfree(w->name); - w->name = xstrdup(args_get(args, 'n')); + window_set_name(w, args_get(args, 'n')); options_set_number(&w->options, "automatic-rename", 0); } Index: cmd-break-pane.c === --- cmd-break-pane.c(revision 2691) +++ cmd-break-pane.c(working copy) @@ -46,8 +46,10 @@ struct session *s; struct window_pane *wp; struct window *w; + char*name; char*cause; int base_idx; + struct client *c; if ((wl = cmd_find_pane(ctx, args_get(args, 't'), &s, &wp)) == NULL) return (-1); @@ -74,7 +76,9 @@ w = wp->window = window_create1(s->sx, s->sy); TAILQ_INSERT_HEAD(&w->panes, wp, entry); w->active = wp; - w->name = default_window_name(w); + name = default_window_name(w); + window_set_name(w, name); + xfree(name); layout_init(w); base_idx = options_get_number(&s->options, "base-index"); Index: cmd-rename-window.c === --- cmd-rename-window.c (revision 2691) +++ cmd-rename-window.c (working copy) @@ -48,8 +48,7 @@ if ((wl = cmd_find_window(ctx, args_get(args, 't'), &s)) == NULL) return (-1); - xfree(wl->window->name); - wl->window->name = xstrdup(args->argv[0]); + window_set_name(wl->window, args->argv[0]); options_set_number(&wl->window->options, "automatic-rename", 0); server_status_window(wl->window); Index: input.c === --- input.c (revision 2691) +++ input.c (working copy) @@ -1036,7 +1036,7 @@ struct window_pane *wp = ictx->wp; struct screen *s = sctx->s; struct input_table_entry *entry; - int n, m; + int n, m; if (ictx->flags & INPUT_DISCARD) return (0); @@ -1552,8 +1552,7 @@ return; log_debug("%s: \"%s\"", __func__, ictx->input_buf); - xfree(ictx->wp->window->name); - ictx->wp->window->name = xstrdup(ictx->input_buf); + window_set_name(ictx->wp->window, ictx->input_buf); options_set_number(&ictx->wp->window->options, "automatic-rename", 0); server_status_window(ictx->wp->window); Index: window.c === --- window.c(revision 2691) +++ window.c(working copy) @@ -359,6 +359,14 @@ } void +window_set_name(struct window *w, const char *new_name) +{ + if (w->name) + xfree(w->name); + w->name = xstrdup(new_name); +} + +void window_resize(struct window *w, u_int sx, u_int sy) { w->sx = sx; @@ -760,7 +768,7 @@ window_pane_read_callback(unused struct bufferevent *bufev, void *data) { struct window_pane *wp = data; - char *new_data; + char *new_data; size_t new_size; new_size = EVBUFFER_LENGTH(wp->event->input) - wp->pipe_off; @@ -992,7 +1000,7 @@ { struct screen *s = &wp->base; char*newsearchstr, *line, *msg; - u_inti; + u_inti; msg = NULL; xasprintf(&newsearchstr, "*%s*", searchstr); -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5,