On 30-Jun-2013 Lech Lorens <[email protected]> wrote:
> On 30-Jun-2013 Bram Moolenaar <[email protected]> wrote:
> > The fix seems OK. But the test already passes without it.
>
> Yes, this is what I tried to explain above but somehow didn't make it
> clear ;-)
>
> > Also, the test changes the window height, which is nasty.
>
> Yeah, since the test doesn't work anyway, I didn't bother to make it
> "prettier" here.
>
> > Perhaps you can make it work by forcing a redraw?
>
> I did try. I'll try using a debugger to find out why it doesn't work.
> Perhaps then I can find out how to make it work.
I did use a debugger to find out that using normal-mode commands
triggers a different kind of redraw than using command-mode commands
(i.e. :source! causes different behaviour than :source).
I worked the problem around by introducing a helper file which is
sourced by the test. Perhaps this approach is acceptable.
The attached patch includes a fix and a test which fails before applying
the fix and succeeds afterwards.
--
Cheers,
Lech
--
--
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.
diff --git a/src/option.c b/src/option.c
index e91ef5d..2f1ef11 100644
--- a/src/option.c
+++ b/src/option.c
@@ -7801,7 +7801,10 @@ set_bool_option(opt_idx, varp, value, opt_flags)
else if ((int *)varp == &curwin->w_p_scb)
{
if (curwin->w_p_scb)
+ {
do_check_scrollbind(FALSE);
+ curwin->w_scbind_pos = curwin->w_topline;
+ }
}
#endif
diff --git a/src/testdir/Makefile b/src/testdir/Makefile
index bc525d9..0292dd2 100644
--- a/src/testdir/Makefile
+++ b/src/testdir/Makefile
@@ -29,7 +29,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
test79.out test80.out test81.out test82.out test83.out \
test84.out test85.out test86.out test87.out test88.out \
test89.out test90.out test91.out test92.out test93.out \
- test94.out test95.out test96.out test97.out
+ test94.out test95.out test96.out test97.out test98.out
SCRIPTS_GUI = test16.out
diff --git a/src/testdir/test98-extra.vim b/src/testdir/test98-extra.vim
new file mode 100644
index 0000000..4999c28
--- /dev/null
+++ b/src/testdir/test98-extra.vim
@@ -0,0 +1,27 @@
+" We don't want the status line to cause problems:
+set laststatus=0
+redraw!
+let g:totalLines = &lines * 20
+let middle = g:totalLines / 2
+wincmd n
+wincmd o
+for i in range(1, g:totalLines)
+ call setline(i, 'LINE ' . i)
+endfor
+
+exe string(middle)
+normal zt
+normal M
+
+aboveleft vert new
+for i in range(1, g:totalLines)
+ call setline(i, 'line ' . i)
+endfor
+exe string(middle)
+normal zt
+normal M
+setl scb
+
+wincmd p
+
+call feedkeys(":setl scb\n\<C-w>\<C-w>", 't')
diff --git a/src/testdir/test98.in b/src/testdir/test98.in
new file mode 100644
index 0000000..074c178
--- /dev/null
+++ b/src/testdir/test98.in
@@ -0,0 +1,20 @@
+Test for 'scrollbind' causing an unexpected scroll of one of the windows.
+STARTTEST
+:source test98-extra.vim
+:let topLineLeft = line('w0')
+:wincmd p
+:let topLineRight = line('w0')
+:setl noscrollbind
+:wincmd p
+:setl noscrollbind
+:q!
+:%del _
+:call setline(1, 'Difference between the top lines (left - right): ' . string(topLineLeft - topLineRight))
+:w! test.out
+:brewind
+ENDTEST
+
+STARTTEST
+:qa!
+ENDTEST
+
diff --git a/src/testdir/test98.ok b/src/testdir/test98.ok
new file mode 100644
index 0000000..356ddd8
--- /dev/null
+++ b/src/testdir/test98.ok
@@ -0,0 +1 @@
+Difference between the top lines (left - right): 0