Re: Meta keys issues

2011-03-26 Thread Nicholas Marriott
^[[1;;A is wrong, this is a bug, it should be 1;3A, we should only
handle the meta bit as escape on input not on output

try this please:

Index: xterm-keys.c
===
RCS file: /cvsroot/tmux/tmux/xterm-keys.c,v
retrieving revision 1.8
diff -u -p -r1.8 xterm-keys.c
--- xterm-keys.c3 Jan 2011 23:32:04 -   1.8
+++ xterm-keys.c26 Mar 2011 18:57:52 -
@@ -174,8 +174,6 @@ xterm_keys_lookup(int key)
modifiers += 2;
if (key & KEYC_CTRL)
modifiers += 4;
-   if (key & KEYC_ESCAPE)
-   modifiers += 8;

/*
 * If the key has no modifiers, return NULL and let it fall through to



On Thu, Mar 24, 2011 at 05:56:32PM +, Paul Grove wrote:
> Hi, I hope you can help,
> 
> my problem is that outside of tmux cat -vt followed by Alt-Up produces
> ^[[1;3A where as inside tmux the same thing produces ^[[1;;A I beleive
> that this is the cause of misbehavior of some of my key bindings in
> things like Vim and my email client.
> 
> inside tmux:
> echo $TERM
> screen-256color
> 
> outside tmux:
> echo $TERM
> screen-256color
> 
> I am using gnome-terminal, bash, tmux
> 
> I have this problem with Alt and all the arrow keys, ctrl and shift seem
> to work fine.
> 
> Is there anything I can do to fix this problem?
> 
> Regards,
> Paul



> --
> Enable your software for Intel(R) Active Management Technology to meet the
> growing manageability and security demands of your customers. Businesses
> are taking advantage of Intel(R) vPro (TM) technology - will your software 
> be a part of the solution? Download the Intel(R) Manageability Checker 
> today! http://p.sf.net/sfu/intel-dev2devmar

> ___
> tmux-users mailing list
> tmux-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tmux-users


--
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
___
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users


Re: vcs_info_msg in xterm title bar

2011-03-26 Thread Nicholas Marriott
Have zsh set the window title (NOT its name) with the escape sequence in
the man page (look for printf) and then just put #T in
set-titles-string.



On Thu, Mar 24, 2011 at 07:35:21PM -0700, kevin beckford wrote:
> I would like my zsh vcs_info_msg_ to appear in the xterm titlebar.
> Currently it appears in the status line.
> the code in question for the window status:
> 
> # set xterm window status. This is where we need git status!
> set-option -g set-titles on
> #set-option -g set-titles-string '#H  ###I.#P  #W (#S)'
> set-option -g set-titles-string '#{vcs_info_msg_0_}'
> 
> it works when tmux is not active, but I also have this:
> 
> # Run this before displaying the prompt
> case $TERM in
>   xterm*|screen) # or tmux ;)
> #precmd () {}
> precmd () {vcs_info; print -Pn "\e]0;${vcs_info_msg_0_}\a"}
> ;;
> esac
> 
> In my .zshrc.
> 
> I guess what I'm looking for is how to get the variable
> ${vcs_info_mg_0_} into the xterm title bar, using tmux.
> 
> --
> Enable your software for Intel(R) Active Management Technology to meet the
> growing manageability and security demands of your customers. Businesses
> are taking advantage of Intel(R) vPro (TM) technology - will your software 
> be a part of the solution? Download the Intel(R) Manageability Checker 
> today! http://p.sf.net/sfu/intel-dev2devmar
> ___
> tmux-users mailing list
> tmux-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tmux-users

--
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
___
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users


Re: Environment with new windows

2011-03-26 Thread Ben Boeckel
On Sat, Dec 11, 2010 at 03:08:30PM +, Nicholas Marriott wrote:
> On Wed, Nov 17, 2010 at 03:41:03PM -0500, Ben Boeckel wrote:
> > On Wed, Nov 17, 2010 at 07:40:37PM +, Nicholas Marriott wrote:
> > > No?
> > 
> > I tried it and I had other issues (tmux stopped working but it wasn't
> > reliably reproducible) on HEAD. I'll try applying it to Fedora's
> > packages and using those. I'll also see if I can get verbose output with
> > HEAD.
> > 
> > --Ben
> 
> Any joy? I can't seem to make it go wrong in light testing.

Sorry for the delay, but I've been testing it lately on top of git
master and caused a crash when using swap-pane. I went through the
history and matched the pane ID code into features that have been added
since then. Description of attached patches:

0001-Add-support-for-pane-ID.patch

The original patch rebased onto master
(568c723cf33426c1f7fe9419966cf111792f71fb).

0002-Only-store-the-session-back-if-non-NULL.patch

Fixes the crash with swap-panes. The cmd_find_pane function is
called with a NULL session in this case.

0003-Print-the-pane-ID-when-listing-panes.patch

Add the ID to the output when listing panes.

0004-Add-list-session-panes-command.patch
0005-Add-list-server-panes-command.patch

These two add commands to list panes with different scopes. Maybe a
list-server-windows would be in order as well?

0006-Fix-list-panes-documentation-to-match-the-rest.patch

Minor fix to the manpage for list-panes to match the rest of the
documentation.

0007-Remove-pane-id-from-TODO-list.patch

Mark the pane ID feature off the TODO list.

0008-Add-I-flag-to-new-window-and-split-window.patch

Add a -I flag to new-window and split-window commands (similar to
-P) to print the ID of the new window.

--Ben


pgp5J1aOtTjMA.pgp
Description: PGP signature
--
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar___
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users


Re: Environment with new windows

2011-03-26 Thread Ben Boeckel
On Sat, Mar 26, 2011 at 06:39:12PM -0400, Ben Boeckel wrote:
> 0001-Add-support-for-pane-ID.patch
> 
> The original patch rebased onto master
> (568c723cf33426c1f7fe9419966cf111792f71fb).
> 
> 0002-Only-store-the-session-back-if-non-NULL.patch
> 
> Fixes the crash with swap-panes. The cmd_find_pane function is
> called with a NULL session in this case.
> 
> 0003-Print-the-pane-ID-when-listing-panes.patch
> 
> Add the ID to the output when listing panes.
> 
> 0004-Add-list-session-panes-command.patch
> 0005-Add-list-server-panes-command.patch
> 
> These two add commands to list panes with different scopes. Maybe a
> list-server-windows would be in order as well?
> 
> 0006-Fix-list-panes-documentation-to-match-the-rest.patch
> 
> Minor fix to the manpage for list-panes to match the rest of the
> documentation.
> 
> 0007-Remove-pane-id-from-TODO-list.patch
> 
> Mark the pane ID feature off the TODO list.
> 
> 0008-Add-I-flag-to-new-window-and-split-window.patch
> 
> Add a -I flag to new-window and split-window commands (similar to
> -P) to print the ID of the new window.

And I forget to attach them...

--Ben
From 4c731f2854e6854cd72c39d9765a5b5969f555bb Mon Sep 17 00:00:00 2001
From: Ben Boeckel 
Date: Sun, 6 Mar 2011 05:25:09 -0500
Subject: [PATCH 1/8] Add support for pane ID

---
 cmd.c|   97 +++---
 server.c |1 +
 tmux.h   |8 +
 window.c |   31 +++-
 4 files changed, 125 insertions(+), 12 deletions(-)

diff --git a/cmd.c b/cmd.c
index d5f6374..20dd70c 100644
--- a/cmd.c
+++ b/cmd.c
@@ -117,9 +117,12 @@ struct client  *cmd_lookup_client(const char *);
 struct session *cmd_lookup_session(const char *, int *);
 struct winlink *cmd_lookup_window(struct session *, const char *, int *);
 int cmd_lookup_index(struct session *, const char *, int *);
+struct window_pane *cmd_lookup_paneid(const char *);
+struct session *cmd_pane_session(struct cmd_ctx *,
+struct window_pane *, struct winlink **);
 struct winlink *cmd_find_window_offset(const char *, struct session *, int *);
 int cmd_find_index_offset(const char *, struct session *, int *);
-struct window_pane *cmd_find_pane_offset(const char *, struct winlink *);
+struct window_pane *cmd_find_pane_offset(const char *, struct winlink *);
 
 int
 cmd_pack_argv(int argc, char **argv, char *buf, size_t len)
@@ -638,21 +641,78 @@ cmd_lookup_index(struct session *s, const char *name, int 
*ambiguous)
return (-1);
 }
 
+/*
+ * Lookup pane id. An initial % means a pane id. sp must already point to the
+ * current session.
+ */
+struct window_pane *
+cmd_lookup_paneid(const char *arg)
+{
+   const char  *errstr;
+   u_intpaneid;
+
+   if (*arg != '%')
+   return (NULL);
+
+   paneid = strtonum(arg + 1, 0, UINT_MAX, &errstr);
+   if (errstr != NULL)
+   return (NULL);
+   return (window_pane_find_by_id(paneid));
+}
+
+/* Find session and winlink for pane. */
+struct session *
+cmd_pane_session(struct cmd_ctx *ctx, struct window_pane *wp,
+struct winlink **wlp)
+{
+   struct session  *s;
+   struct sessionslist  ss;
+   struct winlink  *wl;
+
+   /* If this pane is in the current session, return that winlink. */
+   s = cmd_current_session(ctx);
+   if (s != NULL) {
+   wl = winlink_find_by_window(&s->windows, wp->window);
+   if (wl != NULL) {
+   if (wlp != NULL)
+   *wlp = wl;
+   return (s);
+   }
+   }
+
+   /* Otherwise choose from all sessions with this pane. */
+   ARRAY_INIT(&ss);
+   RB_FOREACH(s, sessions, &sessions) {
+   if (winlink_find_by_window(&s->windows, wp->window) != NULL)
+   ARRAY_ADD(&ss, s);
+   }
+   s = cmd_choose_session_list(&ss);
+   ARRAY_FREE(&ss);
+   if (wlp != NULL)
+   *wlp = winlink_find_by_window(&s->windows, wp->window);
+   return (s);
+}
+
 /* Find the target session or report an error and return NULL. */
 struct session *
 cmd_find_session(struct cmd_ctx *ctx, const char *arg)
 {
-   struct session  *s;
-   struct client   *c;
-   char*tmparg;
-   size_t   arglen;
-   int  ambiguous;
+   struct session  *s;
+   struct window_pane  *wp;
+   struct client   *c;
+   char*tmparg;
+   size_t   arglen;
+   int  ambiguous;
 
/* A NULL argument means the current session. */
if (arg == NULL)
return (cmd_current_session(ctx));
tmparg = xstrdup(arg);
 
+   /* Lookup as pane id. */
+   if ((wp = cmd_lookup_paneid(arg)) != NULL)
+   return (cmd_pane_sessi