Hi

Well, what do 9 and 10 mean in iTerm2?

If they are some other modifier not included in the xterm 1-8 set, then
we don't want to convert \033[1;9A into Up if it's not actually Up but
actually Weird-Apple-Only-Key+Up.

If it is meant to be Alt-Up, then why is iTerm2 using 9 instead of 3?



On Sat, May 03, 2014 at 10:08:22AM +0100, Balazs Kezes wrote:
> Sorry for the inconveniences caused but my last email was weirdly
> constructed and not properly viewable in the mailing list archive, so
> here's the contents again:
> 
> 
> [+tmux-users]
> 
> On 2014-04-29 17:51 +0000, daemianmack wrote:
> > Yes, reverting that commit [c52548f6fd311e4df3076ba4cc6f6ab8849557ac]
> > fixes the problem for me.
> 
> Although I still can't test it but I think I know what happens. That
> commit contained this change:
> 
> diff --git a/xterm-keys.c b/xterm-keys.c
> index 9b5a0a2..0e20165 100644
> --- a/xterm-keys.c
> +++ b/xterm-keys.c
> @@ -131,7 +131,9 @@ xterm_keys_match(const char *template, const char *buf, 
> size_t len)
>  
>       pos = 0;
>       do {
> -             if (*template != '_' && buf[pos] != *template)
> +             if (*template == '_' && buf[pos] >= '1' && buf[pos] <= '8')
> +                     continue;
> +             if (buf[pos] != *template)
>                       return (-1);
>       } while (*++template != '\0' && ++pos != len);
> 
> 
> You can see that we care only about values between 1 and 8. But it seems
> that in iTerm2 you generate[1] a value with 9 and sometimes even with 10
> if you press more modifiers[2]. You can take a look at "Solution 2" in
> [1] as an interim solution. But before that, could you please verify
> that things start to work if you replace that '8' above with a '9'?
> 
> 
> Nick, I think this is a bug in tmux and is troublesome for iTerm2 users.
> Would something along these lines work? Daemian, could you test this as
> well (even things like M-S-up)? Thanks!
> 
> diff --git a/xterm-keys.c b/xterm-keys.c
> index af3f1e7..489b64a 100644
> --- a/xterm-keys.c
> +++ b/xterm-keys.c
> @@ -18,6 +18,7 @@
>  
>  #include <sys/types.h>
>  
> +#include <ctype.h>
>  #include <string.h>
>  
>  #include "tmux.h"
> @@ -131,10 +132,16 @@ xterm_keys_match(const char *template, const char *buf, 
> size_t len)
>  
>       pos = 0;
>       do {
> -             if (*template == '_' && buf[pos] >= '1' && buf[pos] <= '8')
> -                     continue;
> -             if (buf[pos] != *template)
> +             if (*template == '_') {
> +                     if (!isdigit(buf[pos]))
> +                             return -1;
> +                     // Handle multidigit sequences like '\e[1;10A' for
> +                     // M-S-up in iTerm2.
> +                     while (pos+1 != len && isdigit(buf[pos+1]))
> +                             pos += 1;
> +             } else if (buf[pos] != *template) {
>                       return (-1);
> +             }
>       } while (*++template != '\0' && ++pos != len);
>  
>       if (*template != '\0')  /* partial */
> 
> 
> [1] http://stackoverflow.com/questions/10867199
> [2] 
> http://webframp.com/blog/2013/02/22/fixing-emacs-bindings-on-the-in-iterm2/
> 
> -- 
> Balazs
> 
> ------------------------------------------------------------------------------
> "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
> tmux-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tmux-users

------------------------------------------------------------------------------
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
&#149; 3 signs your SCM is hindering your productivity
&#149; Requirements for releasing software faster
&#149; Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to