Pārlūkot izejas kodu

Couple of user requests

Miguel de Icaza 6 gadi atpakaļ
vecāks
revīzija
3329e2b345

+ 13 - 0
Terminal.Gui/Views/RadioGroup.cs

@@ -21,6 +21,19 @@ namespace Terminal.Gui {
 			CanFocus = true;
 		}
 
+		/// <summary>
+		/// The location of the cursor in the radio group
+		/// </summary>
+		public int Cursor {
+			get => cursor;
+			set {
+				if (cursor < 0 || cursor >= radioLabels.Length)
+					return;
+				cursor = value;
+				SetNeedsDisplay ();
+			}
+		}
+
 		/// <summary>
 		/// Initializes a new instance of the <see cref="T:Terminal.Gui.RadioGroup"/> class
 		/// setting up the initial set of radio labels and the item that should be selected.

+ 5 - 0
Terminal.Gui/Views/TextField.cs

@@ -23,6 +23,11 @@ namespace Terminal.Gui {
 		int first, point;
 		bool used;
 
+		/// <summary>
+		/// Tracks whether the text field should be considered "used", that is, that the user has moved in the entry, so new input should be appended at the cursor position, rather than clearing the entry
+		/// </summary>
+		public bool Used { get => used; set { used = value; } }
+
 		/// <summary>
 		///   Changed event, raised when the text has clicked.
 		/// </summary>

+ 12 - 0
Terminal.Gui/Views/TextView.cs

@@ -665,6 +665,18 @@ namespace Terminal.Gui {
 				PositionCursor ();
 		}
 
+		/// <summary>
+		/// Will scroll the view to display the specified row at the top
+		/// </summary>
+		/// <param name="row">Row that should be displayed at the top</param>
+		public void ScrollTo (int row)
+		{
+			if (row < 0)
+				row = 0;
+			topRow = row > model.Count ? model.Count - 1 : row;
+			SetNeedsDisplay ();
+		}
+
 		bool lastWasKill;
 
 		public override bool ProcessKey (KeyEvent kb)