Bram,

> This patch should fix it:

It works!
It seems to be a nice solution.

Thanks.
---
Hayaki Saito
[email protected]

On 2012/12/04, at 4:37, Bram Moolenaar wrote:

> 
> Hayaki Saito wrote:
> 
>>> It works correctly for me, setting 'ttymouse' to "sgr" automatically.
>> 
>> Hmm, I checked this problem in Debian squeeze and OSX 10.7 environment.
>> 
>> My $HOME/.vimrc is here:
>> --
>> set nocompatible
>> set mouse=a
>> --
>> 
>> There are no statements any more.
>> The environment variable $TERM is "xterm".
>> 
>> I compared changeset 3884 (Patch 698) with 3885 (Patch 699), with 
>> configuring --with-features=huge.
>> The details of features are here:
>> +arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset +cindent 
>> +clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info 
>> +comments 
>> +conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con_gui +diff 
>> +digraphs +dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi 
>> +file_in_path +find_in_path +float +folding -footer +fork() +gettext 
>> -hangul_input +iconv +insert_expand +jumplist +keymap +langmap +libcall 
>> +linebreak +lispindent +listcmds +localmap -lua +menu +mksession 
>> +modify_fname 
>> +mouse +mouseshape +mouse_dec -mouse_gpm -mouse_jsbterm +mouse_netterm 
>> +mouse_sgr -mouse_sysmouse +mouse_urxvt +mouse_xterm +multi_byte +multi_lang 
>> -mzscheme +netbeans_intg +path_extra -perl +persistent_undo +postscript 
>> +printer +profile -python -python3 +quickfix +reltime +rightleft -ruby 
>> +scrollbind +signs +smartindent -sniff +startuptime +statusline 
>> -sun_workshop 
>> +syntax +tag_binary +tag_old_static -tag_any_white -tcl +terminfo 
>> +termresponse
>> +textobjects +title +toolbar +user_commands +vertsplit +virtualedit +visual 
>> +visualextra +viminfo +vreplace +wildignore +wildmenu +windows +writebackup 
>> +X11 -xfontset +xim +xsmp_interact +xterm_clipboard -xterm_save 
>> 
>> Yukihiro Nakadaira tested it in Ubuntu 12.10 xterm and gnome-terminal
>> He also checked Patch 698 and Patch 699.
>> He says, when He launch vim with "-u NONE -N" option, patch 698 sets 
>> ttymouse=sgr automatically, but patch 699 sets ttymouse=xterm.
>> 
>> Hirohito Higash tested in Fedora 16 and PuTTY.  $TERM is "xterm".
>> He checked Patch 698 and Patch 744.
>> He says, when He launch vim with "-N" option, patch 698 sets ttymouse=xterm2 
>> automatically, but patch 744 sets ttymouse=xterm.
>> 
>>> For a quick check you can comment out these lines in term.c:
>>> 
>>>     if (p != NULL)
>>>         set_option_value((char_u *)"ttym", 0L, p, 0);
>>> 
>>> If that works, then try:
>>> 
>>>     if (p != NULL && *p != NUL)
>>>         set_option_value((char_u *)"ttym", 0L, p, 0);
>> 
>> With commenting out these lines, automatic detection works well.
>> 
>> /*   if (p != NULL)
>>          set_option_value((char_u *)"ttym", 0L, p, 0); */
>> 
>> but It does not works.
>> 
>>      if (p != NULL && *p != NUL)
>>          set_option_value((char_u *)"ttym", 0L, p, 0);
>> 
>> I make sure "use_xterm_like_mouse" returns TRUE and "use_xterm_mouse" 
>> returns 0.
>> I think it is a matter of course because I do not set anything to ttymouse.
>> So the string value "xterm" is set to ttym_flags around there automatically, 
>> and this condition around term.c:4084 returns FALSE.
>> 
>>                         if (!option_was_set((char_u *)"ttym"))
> 
> Thanks.  I could reproduce it now.  This patch should fix it:
> 
> *** ../vim-7.3.744/src/option.c       2012-10-21 03:45:57.000000000 +0200
> --- src/option.c      2012-12-03 20:07:32.000000000 +0100
> ***************
> *** 11179,11184 ****
> --- 11179,11197 ----
>  }
> 
>  /*
> +  * Reset the flag indicating option "name" was set.
> +  */
> +     void
> + reset_option_was_set(name)
> +     char_u  *name;
> + {
> +     int idx = findoption(name);
> + 
> +     if (idx >= 0)
> +     options[idx].flags &= ~P_WAS_SET;
> + }
> + 
> + /*
>   * compatible_set() - Called when 'compatible' has been set or unset.
>   *
>   * When 'compatible' set: Set all relevant options (those that have the 
> P_VIM)
> *** ../vim-7.3.744/src/proto/option.pro       2012-10-21 00:10:29.000000000 
> +0200
> --- src/proto/option.pro      2012-12-03 20:08:36.000000000 +0100
> ***************
> *** 52,57 ****
> --- 52,58 ----
>  void vimrc_found __ARGS((char_u *fname, char_u *envname));
>  void change_compatible __ARGS((int on));
>  int option_was_set __ARGS((char_u *name));
> + void reset_option_was_set __ARGS((char_u *name));
>  int can_bs __ARGS((int what));
>  void save_file_ff __ARGS((buf_T *buf));
>  int file_ff_differs __ARGS((buf_T *buf, int ignore_empty));
> *** ../vim-7.3.744/src/term.c 2012-10-21 02:10:20.000000000 +0200
> --- src/term.c        2012-12-03 20:09:28.000000000 +0100
> ***************
> *** 1864,1870 ****
> --- 1864,1875 ----
>       }
>  #  endif
>       if (p != NULL)
> +     {
>           set_option_value((char_u *)"ttym", 0L, p, 0);
> +         /* Reset the WAS_SET flag, 'ttymouse' can be set to "sgr" or
> +          * "xterm2" in check_termcode(). */
> +         reset_option_was_set((char_u *)"ttym");
> +     }
>       if (p == NULL
>  #   ifdef FEAT_GUI
>               || gui.in_use
> 
> 
> -- 
> I AM THANKFUL...
> ...for all the complaining I hear about the government
> because it means we have freedom of speech.
> 
> /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
> ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
> \\\  an exciting new programming language -- http://www.Zimbu.org        ///
> \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
> 
> -- 
> 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 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

Raspunde prin e-mail lui