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.

-- 
Cheers,
Lech

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

diff --git a/src/move.c b/src/move.c
index abf055f..8a7a0a9 100644
--- a/src/move.c
+++ b/src/move.c
@@ -1256,6 +1256,8 @@ scrolldown(line_count, byfold)
     validate_cursor();		/* w_wrow needs to be valid */
     while (line_count-- > 0)
     {
+	if (curwin->w_topline == 1)
+	    break;
 #ifdef FEAT_DIFF
 	if (curwin->w_topfill < diff_check(curwin, curwin->w_topline))
 	{
@@ -1265,8 +1267,6 @@ scrolldown(line_count, byfold)
 	else
 #endif
 	{
-	    if (curwin->w_topline == 1)
-		break;
 	    --curwin->w_topline;
 #ifdef FEAT_DIFF
 	    curwin->w_topfill = 0;

Raspunde prin e-mail lui