Browse Source

Removed unnecessary flag.

BDisp 5 years ago
parent
commit
1bf3a5ffa9
1 changed files with 4 additions and 11 deletions
  1. 4 11
      Terminal.Gui/Views/ListView.cs

+ 4 - 11
Terminal.Gui/Views/ListView.cs

@@ -199,8 +199,6 @@ namespace Terminal.Gui {
 			}
 			}
 		}
 		}
 
 
-		bool topPending;
-
 		/// <summary>
 		/// <summary>
 		/// Gets or sets the index of the currently selected item.
 		/// Gets or sets the index of the currently selected item.
 		/// </summary>
 		/// </summary>
@@ -214,10 +212,6 @@ namespace Terminal.Gui {
 					throw new ArgumentException ("value");
 					throw new ArgumentException ("value");
 				selected = value;
 				selected = value;
 				OnSelectedChanged ();
 				OnSelectedChanged ();
-				if (selected < top)
-					top = selected;
-				else
-					topPending = true;
 			}
 			}
 		}
 		}
 
 
@@ -282,11 +276,10 @@ namespace Terminal.Gui {
 			Driver.SetAttribute (current);
 			Driver.SetAttribute (current);
 			Move (0, 0);
 			Move (0, 0);
 			var f = Frame;
 			var f = Frame;
-			if (topPending) {
-				topPending = false;
-				if (selected >= top + f.Height) {
-					top = selected;
-				}
+			if (selected < top) {
+				top = selected;
+			} else if (selected >= top + f.Height) {
+				top = selected;
 			}
 			}
 			var item = top;
 			var item = top;
 			bool focused = HasFocus;
 			bool focused = HasFocus;