Bram Moolenaar <[email protected]> wrote:

> Lech Lorens wrote:
>
>> > > It is possible to scroll down (i.e. CTRL-Y in normal mode) an empty
>> > > buffer if it is being compared with another buffer consisting of at
>> > > least two lines. This means it is possible for the cursor to appear
>> > > "outside of the file" - on nonexistent lines.
>> > >
>> > > To reproduce the problem edit any file and e.g.:
>> > >  :diffsplit /dev/null
>> > > Then try to scroll /dev/null with CTRL-Y.
>> > >
>> > > This patch disallows such behaviour.
>> >
>> > The scrolling is OK so long as the filler lines fit in the window.
>> > This is useful to be able to see the added lines in the other window.
>> >
>> > But currently it tries to add too many, the cursor is displayed outside
>> > of the window if you scroll far enough.
>> >
>> > Please check this patch:
>>
>> Your patch does not seem to address the problem I've been trying to
>> describe.
>>
>> I am not sure whether I have managed to explain the problem I am
>> observing well enough.
>>
>> I will draw what I am observing:
>> ~ - are the nonexistent line, i.e. after the end of the file,
>> _ - is the cursor
>> I have 2 windows in diff mode, the cursor is on the only displayed line
>> in window 1.
>>
>>    window 1     window 2
>>   /dev/null     file.txt
>> +------------+------------+
>> |_           |last line   |
>> |~           |~           |
>> |~           |~           |
>> |~           |~           |
>> |~           |~           |
>> |~           |~           |
>> +------------+------------+
>>
>> If I press CTRL-Y twice, the situation is as follows:
>> +------------+------------+
>> |            |last line   |
>> |~           |~           |
>> |_           |~           |
>> |~           |~           |
>> |~           |~           |
>> |~           |~           |
>> +------------+------------+
>> which means the cursor is displayed out of bounds - on the second
>> nonexistent line.
>>
>> Also, from your reply I infer that my patch breaks some functionality.
>> I haven't observed any such side effects. Could you elaborate on it
>> a little bit?
>
> When I try this I get:
>
>    window 1     window 2
>   /dev/null     file.txt
>  +------------+------------+
>  |filler      |last - 2    |
>  |filler      |last - 1    |
>  |_           |last line   |
>  |~           |~           |
>  |~           |~           |
>  |~           |~           |
>  +------------+------------+
>
> Thus two filler lines are inserted, the file.txt window scrolls down.
>
> If I remove "filler" from 'diffopt' then I don't get any scrolling.
>
> Perhaps it depends on your option values, can you find out?


The cursor needs to be in window1 to reproduce the bug.

This is how I can reproduce the bug with Vim-7.2.267:

$ rm -f file1
$ echo foobar > file2
$ vim -u NONE -d file1 file2 -c 'call feedkeys("\<c-y>\<c-y>\<c-y>\<c-y>")'

And I see this...

http://dominique.pelle.free.fr/pic/bug-cursor.png

(red cursor is beyond the end of file1)

-- Dominique

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui