Sorry, I found out this patch have some defects.
In some terminals (such as xterm), Shift-F3 key input sequense "ESC [ 1 ;  2 R" 
may be confused with the cursor position report.
Attached patch is fixed it.

Regards.

---
Hayaki Saito
[email protected]



On 2013/02/10, at 23:16, Hayaki Saito wrote:

> Hi
> 
> This patch detects East Asian ambiguous width (UAX #11) state of terminals at 
> the start-up time.
> It makes Vim automatically set "ambiwidth" option to "double" when it is 
> running inside some CJK terminals,
> This feature works only when Vim is compiled with +multi_byte and 
> +termresponse feature, and termcap option t_u7 should be set to "\e[6n".
> 
> I tested it on the following terminals.
> 
> - xterm with "-cjk" option
> - gnome-terminal(VTE) with environment "VTE_CJK_WIDTH=1"
> - mlterm with "--ac=2" option
> - MinTTY with CJK font environment
> - GNU Screen version 4.01.00devel with "cjkwidth" command and let 
> &t_u7="\e[6n"'
> - TeraTerm
> - RLogin
> - Poderosa
> - iTerm2 with "Treat ambiguous-width characters as double width" option
> - Terminal.app(OSX 10.8) with CJK width option
> 
> if $TERM is 'screen', termcap option t_u7 is empty by default.
> So we need to add the following code in vimrc for testing it.
> 
> if !has('gui_running') && has('vim_starting') && exists('+t_u7') && $TERM =~ 
> 'screen'
>  let &t_u7 = "\e[6n"
> endif
> 
> ---
> Hayaki Saito
> [email protected]
> 
> <detect-ambiguous.diff>

-- 
-- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.



On 2013/02/10, at 23:16, Hayaki Saito wrote:

Hi

This patch detects East Asian ambiguous width (UAX #11) state of terminals at the start-up time.
It makes Vim automatically set "ambiwidth" option to "double" when it is running inside some CJK terminals,
This feature works only when Vim is compiled with +multi_byte and +termresponse feature, and termcap option t_u7 should be set to "\e[6n".

I tested it on the following terminals.

- xterm with "-cjk" option
- gnome-terminal(VTE) with environment "VTE_CJK_WIDTH=1"
- mlterm with "--ac=2" option
- MinTTY with CJK font environment
- GNU Screen version 4.01.00devel with "cjkwidth" command and let &t_u7="\e[6n"'
- TeraTerm
- RLogin
- Poderosa
- iTerm2 with "Treat ambiguous-width characters as double width" option
- Terminal.app(OSX 10.8) with CJK width option

if $TERM is 'screen', termcap option t_u7 is empty by default.
So we need to add the following code in vimrc for testing it.

if !has('gui_running') && has('vim_starting') && exists('+t_u7') && $TERM =~ 'screen'
 let &t_u7 = "\e[6n"
endif

---
Hayaki Saito
[email protected]

<detect-ambiguous.diff>

Attachment: detect-ambiguous-improved.diff
Description: Binary data

Raspunde prin e-mail lui