Original
 1 void physDown(int amount, int screenAmount)
 2 {
 3   skew = 0;
 4 
 5   if(!isLineVisible(physicalLine))
 6   {
 7     int lastVisibleLine = getLastVisibleLine();
 8     if(physicalLine > lastVisibleLine)
 9       physicalLine = lastVisibleLine;
10     else
11     {
12       int nextPhysicalLine = getNextVisibleLine(physicalLine);
13       amount -= (nextPhysicalLine - physicalLine);
14       scrollLine += getScreenLineCount(physicalLine);
15       physicalLine = nextPhysicalLine;
16     }
17   }
18 
19   for(;;)
20   {
21     int nextPhysicalLine = getNextVisibleLine(
22       physicalLine);
23     if(nextPhysicalLine == -1)
24       break;
25     else if(nextPhysicalLine > physicalLine + amount)
26       break;
27     else
28     {
29       scrollLine += getScreenLineCount(physicalLine);
30       amount -= (nextPhysicalLine - physicalLine);
31       physicalLine = nextPhysicalLine;
32     }
33   }
34 
35   if(screenAmount != 0)
36   {
37     if(screenAmount < 0)
38       scrollUp(-screenAmount);
39     else 
40       scrollDown(screenAmount);
41   }
42 }
43 
Modified
 1 void physDown(int amount, int screenAmount)
 2 {
 3   skew = 0;
 4 
 5   if(!isLineVisible(physicalLine))
 6   {
 7     int lastVisibleLine = getLastVisibleLine();
 8     if(physicalLine > lastVisibleLine)
 9       physicalLine = lastVisibleLine;
10     else
11     {
12       int nextPhysicalLine = getNextVisibleLine(physicalLine);
13       amount -= (nextPhysicalLine - physicalLine);
14       scrollLine += getScreenLineCount(physicalLine);
15       physicalLine = nextPhysicalLine;
16     }
17   }
18 
19   for(;;)
20   {
21     int nextPhysicalLine = getNextVisibleLine(
22       physicalLine);
23     if(nextPhysicalLine == -1)
24       break;
25     else if(nextPhysicalLine > physicalLine + amount)
26       break;
27     else
28     {
29       scrollLine += getScreenLineCount(physicalLine);
30       amount -= (nextPhysicalLine - physicalLine);
31       physicalLine = nextPhysicalLine;
32     }
33   }
34 
   
   
35   if(screenAmount < 0)
36     scrollUp(-screenAmount);
37   else if(screenAmount > 0)
38     scrollDown(screenAmount);
   
39 }
40