[getline] Fix the logic for advancing the top item
authorMiguel de Icaza <miguel@gnome.org>
Fri, 15 Jan 2016 15:21:38 +0000 (10:21 -0500)
committerMiguel de Icaza <miguel@gnome.org>
Fri, 15 Jan 2016 15:21:44 +0000 (10:21 -0500)
mcs/tools/csharp/getline.cs

index 068fe5d3178fb09cd40d919051aee03e07d6411e..349d67f31047c0db117167e2fd25f82de0ec93bc 100644 (file)
@@ -462,7 +462,7 @@ namespace Mono.Terminal {
                                        
                                        Console.ForegroundColor = selected ? ConsoleColor.Black : ConsoleColor.Gray;
                                        Console.BackgroundColor = selected ? ConsoleColor.Cyan : ConsoleColor.Blue;
-                                       
+
                                        var item = Prefix + Completions [item_idx];
                                        if (item.Length > Width)
                                                item = item.Substring (0, Width);
@@ -490,7 +490,7 @@ namespace Mono.Terminal {
                        {
                                if (selected_item+1 < Completions.Length){
                                        selected_item++;
-                                       if (selected_item + top_item >= Height)
+                                       if (selected_item - top_item >= Height)
                                                top_item++;
                                        SaveExcursion (DrawSelection);
                                }