Hi,
In my macro I observe strange behavior if try to paste manually
created block of lines, if it contains unicode chars. Pasting
rectangular region leads to some lines strangely "elongated" in
the result. If we paste pure ASCII content of same shape no
problem happens. Following vimscript demonstrates this problem
[1].
Another case which looks as well strange is "gv" command confused
with the range, if it contains some unicode chars. Firstly we
block select such a region, replace it content with blanks, and
finally try to visually select it again with "gv" - right border
of the new selection differs from original one. If now we do
replacement of the content again, we observe replacement is made
within different, slightly larger area. If the region in question
had in the beginning pure ASCII content no such problem happens.
Following vimscript demonstrates this problem [2].
Tested with "vim --clean" on cygwin 8.2.486, and one quite
outdated linux version 8.1.1741.
Are those things known already or do they have some good explanation
perhaps?
Many thanks for making vim, and vim makes my day since many years
already :), with best regards, Anton
[1] vimscript vim_unicode_align_test.vim BEGIN
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ene
call append(line('.')-1,'+------+')
call append(line('.')-1,'A|')
call append(line('.')-1,'B|')
call append(line('.')-1,'C|')
call append(line('.')-1,'+------+')
let buf1= '' .
\ ' üuü ' . "\n" .
\ ' uu u ' . "\n" .
\ ' üuü '
let buf2= '' .
\ ' uuu ' . "\n" .
\ ' uu u ' . "\n" .
\ ' uuu '
"let @a = buf1 " bad
let @a = buf2 " good
" convert content of @a to "visual block" selection yank result
call setreg("a", @a, "b")
call cursor(2,1)
execute('normal "ap') | " paste from @a
" result when "bad"
" +------+
" A üuü |
" B uu u |
" C üuü |
" +------+
" result when "good"
" +------+
" A uuu |
" B uu u |
" C uuu |
" +------+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[1] vimscript vim_unicode_align_test.vim END
[2] vimscript vim_unicode_gv_test.vim BEGIN
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ene
let good = 1
if good
call append(line('.')-1,'+------+')
call append(line('.')-1,'A uuu |')
call append(line('.')-1,'B uu u |')
call append(line('.')-1,'C uuu |')
call append(line('.')-1,'+------+')
else
call append(line('.')-1,'+------+')
call append(line('.')-1,'A üuü |')
call append(line('.')-1,'B uu u |')
call append(line('.')-1,'C üuü |')
call append(line('.')-1,'+------+')
endif
" visually select inner region in block mode
call cursor(2,2)
execute "normal! \<c-v>/+.*+/s-2\<cr>\<esc>"
" replace content of selection with spaces
execute('normal gvr\ ')
" select again same (?!) content and replace content with dots: '.'
execute('normal gvr.')
" result when "bad"
" +------+
" A.......
" B.......
" C.......
" +------+
" result when "good"
" +------+
" A......|
" B......|
" C......|
" +------+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[2] vimscript vim_unicode_gv_test.vim END
--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAMoRF4n7%3DdeGd0X_VtFAh43ZC%2BMFxnX0Mspgoskv3HGnPHBU4A%40mail.gmail.com.
No comments:
Post a Comment