On 05/04/09 17:54 +0200, Bram Moolenaar wrote:
>
> In your Test() function there is no redraw. So even though you use "zb"
> it doesn't take effect. If you then later change something that
> triggers a redraw, the relative cursor position hasn't been set yet.
>
> Try the same operation by hand, I didn't see this problem then.
>
Hi Bram,
I may not fully understand your point, sorry.
To demonstrate it step by step, I added a breakpoint and two ":redraw!"s
around the trigger point. This time it can be triggered to display the
difference before and after the 'wincmd J' by hand for you.
$ vim -u NONE -S test.vim
$ cat test.vim
fun! BuildLines(prefix)
let a = []
for i in range(1, 100)
call add(a, a:prefix . ": This is line " . i)
endfor
return a
endfun
breakadd func 24 Test
fun! Test()
set equalalways
set scrolloff=0
" Create a Log window
new Log
set bt=nofile
only!
" Create Main Window, then write some lines into it and
" display the 50th line in the bottom of the window
top new Main
set bt=nofile
let a=BuildLines("Main")
call append(0, a)
normal 50G
normal zb
" Add some lines to another window (that is, the Log window)
let win_no = bufwinnr("Log")
if win_no != -1
" Found the Log window
exe win_no . "wincmd w"
redraw! " We can see 'zb' has effects (50th lines at bottom)
wincmd J " Trigger the problem, use 'redraw' to see it
redraw! " After this, we'll see the 50th line got moved.
call append('$', "Log: Where is the 50th line? ")
exe "normal G"
endif
endfun
call Test()
--
Dasn
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---