Re: Add ttymouse=xterm support when TERM=tmux

2016-09-30 Fir de Conversatie Michael Henry
On 09/29/2016 07:34 AM, James McCoy wrote:
>
> On Sep 29, 2016 7:12 AM, "Christian Brabandt"  wrote:
> > I thought, tmux proposed to use the screen terminal entry?
>
> Staying in 2.1 tmux can be used to differentiate functionality.
>
>
https://github.com/tmux/tmux/blob/20598dff258da1e96a060adba95e8e05bfdd8b3b/FAQ#L355-L378

Yes, the difference between the ``screen`` and ``tmux`` termcap
entries is how they deal with italics and reverse-mode video.
That's the motivation for setting ``TERM=tmux``, as GNU screen
doesn't support italics and the terminfo for ``TERM=screen`` is
incorrect for use with tmux:

  $ infocmp screen tmux
  comparing screen to tmux.
  comparing booleans.
  comparing numbers.
  ncv: NULL, NULL.
  comparing strings.
  ritm: NULL, '\E[23m'.
  rmso: '\E[23m', '\E[27m'.
  sitm: NULL, '\E[3m'.
  smso: '\E[3m', '\E[7m'.

Most Vim functionality works correctly with ``TERM=tmux``, but
the mouse is detected incorrectly.  It works for ``TERM=screen``
because of the special-case checks for ``screen`` (among others)
in Vim's ``use_xterm_like_mouse()`` function.

At present it appears that hard-coding knowledge of certain
terminals into Vim's source is the solution for determining the
correct mouse protocol, which is why I proposed adding support
for tmux in the above function.  Is there a different way Vim
should be detecting the mouse protocol?

Michael Henry

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Add ttymouse=xterm support when TERM=tmux

2016-09-29 Fir de Conversatie James McCoy
On Sep 29, 2016 7:12 AM, "Christian Brabandt"  wrote:
> I thought, tmux proposed to use the screen terminal entry?

Staying in 2.1 tmux can be used to differentiate functionality.

https://github.com/tmux/tmux/blob/20598dff258da1e96a060adba95e8e05bfdd8b3b/FAQ#L355-L378

Cheers,
James

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Add ttymouse=xterm support when TERM=tmux

2016-09-29 Fir de Conversatie Christian Brabandt
On Do, 29 Sep 2016, Michael Henry wrote:

> All,
> 
> Vim has compiled-in knowledge of a few terminals whose mouse
> support is like that of xterm.  One such terminal is GNU screen.
> Missing from this list is tmux, a terminal multiplexer similar
> to GNU screen:
> https://tmux.github.io/
> 
> When ``$TERM`` is ``screen``, Vim automatically performs the
> equivalent of ``:set ttymouse=xterm``; when ``$TERM`` is
> ``tmux``, ``ttymouse`` is left unset which causes the following
> incorrect mouse-related settings to be set:
> 
> ^[[
> ^[}
>^[MG
> 
>  in particular interferes with the processing of
> key codes that start with ``^[[``.
> 
> I'd like to propose the below patch which adds supports for tmux
> in the same way that Vim currently supports screen.
> 
> diff --git a/src/os_unix.c b/src/os_unix.c
> index 5f1c487..f12e944 100644
> --- a/src/os_unix.c
> +++ b/src/os_unix.c
> @@ -2261,6 +2261,7 @@ use_xterm_like_mouse(char_u *name)
>  return (name != NULL
>  && (term_is_xterm
>  || STRNICMP(name, "screen", 6) == 0
> +|| STRNICMP(name, "tmux", 4) == 0
>  || STRICMP(name, "st") == 0
>  || STRNICMP(name, "st-", 3) == 0
>  || STRNICMP(name, "stterm", 6) == 0));

I thought, tmux proposed to use the screen terminal entry?

Best,
Christian
-- 
Letzte Worte eines Sportschützen:
  "Da klemmt doch was am Abzug."

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Add ttymouse=xterm support when TERM=tmux

2016-09-29 Fir de Conversatie Michael Henry
All,

Vim has compiled-in knowledge of a few terminals whose mouse
support is like that of xterm.  One such terminal is GNU screen.
Missing from this list is tmux, a terminal multiplexer similar
to GNU screen:
https://tmux.github.io/

When ``$TERM`` is ``screen``, Vim automatically performs the
equivalent of ``:set ttymouse=xterm``; when ``$TERM`` is
``tmux``, ``ttymouse`` is left unset which causes the following
incorrect mouse-related settings to be set:

^[[
^[}
   ^[MG

 in particular interferes with the processing of
key codes that start with ``^[[``.

I'd like to propose the below patch which adds supports for tmux
in the same way that Vim currently supports screen.

diff --git a/src/os_unix.c b/src/os_unix.c
index 5f1c487..f12e944 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -2261,6 +2261,7 @@ use_xterm_like_mouse(char_u *name)
 return (name != NULL
 && (term_is_xterm
 || STRNICMP(name, "screen", 6) == 0
+|| STRNICMP(name, "tmux", 4) == 0
 || STRICMP(name, "st") == 0
 || STRNICMP(name, "st-", 3) == 0
 || STRNICMP(name, "stterm", 6) == 0));

Thanks,
Michael Henry

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.