Browse Source

Standardize how Path text box values are set (always use property)

This ensures the right side of text is always visible
tznind 1 year ago
parent
commit
2928508daa
1 changed files with 7 additions and 9 deletions
  1. 7 9
      Terminal.Gui/Views/FileDialog.cs

+ 7 - 9
Terminal.Gui/Views/FileDialog.cs

@@ -714,7 +714,7 @@ namespace Terminal.Gui {
 
 
 			// if no path has been provided
 			// if no path has been provided
 			if (this.tbPath.Text.Length <= 0) {
 			if (this.tbPath.Text.Length <= 0) {
-				this.tbPath.Text = Environment.CurrentDirectory;
+				this.Path = Environment.CurrentDirectory;
 			}
 			}
 
 
 			// to streamline user experience and allow direct typing of paths
 			// to streamline user experience and allow direct typing of paths
@@ -805,7 +805,7 @@ namespace Terminal.Gui {
 				.Select (s => s.FileSystemInfo.FullName)
 				.Select (s => s.FileSystemInfo.FullName)
 				.ToList ().AsReadOnly ();
 				.ToList ().AsReadOnly ();
 
 
-			this.tbPath.Text = this.MultiSelected.Count == 1 ? this.MultiSelected [0] : string.Empty;
+			this.Path = this.MultiSelected.Count == 1 ? this.MultiSelected [0] : string.Empty;
 
 
 			FinishAccept ();
 			FinishAccept ();
 		}
 		}
@@ -818,7 +818,7 @@ namespace Terminal.Gui {
 				return;
 				return;
 			}
 			}
 
 
-			this.tbPath.Text = f.FullName;
+			this.Path = f.FullName;
 
 
 			if (AllowsMultipleSelection) {
 			if (AllowsMultipleSelection) {
 				this.MultiSelected = new List<string> { f.FullName }.AsReadOnly ();
 				this.MultiSelected = new List<string> { f.FullName }.AsReadOnly ();
@@ -897,7 +897,7 @@ namespace Terminal.Gui {
 				return;
 				return;
 			}
 			}
 
 
-			this.tbPath.Text = e.NewValue.FullName;
+			this.Path = e.NewValue.FullName;
 		}
 		}
 
 
 		private void UpdateNavigationVisibility ()
 		private void UpdateNavigationVisibility ()
@@ -933,7 +933,7 @@ namespace Terminal.Gui {
 			try {
 			try {
 				this.pushingState = true;
 				this.pushingState = true;
 
 
-				this.tbPath.Text = dest.FullName;
+				this.Path = dest.FullName;
 				this.State.Selected = stats;
 				this.State.Selected = stats;
 				this.tbPath.Autocomplete.ClearSuggestions ();
 				this.tbPath.Autocomplete.ClearSuggestions ();
 
 
@@ -1136,12 +1136,10 @@ namespace Terminal.Gui {
 				this.tbPath.Autocomplete.ClearSuggestions ();
 				this.tbPath.Autocomplete.ClearSuggestions ();
 
 
 				if (pathText != null) {
 				if (pathText != null) {
-					this.tbPath.Text = pathText;
-					this.tbPath.MoveEnd ();
+					this.Path = pathText;
 				} else
 				} else
 				if (setPathText) {
 				if (setPathText) {
-					this.tbPath.Text = newState.Directory.FullName;
-					this.tbPath.MoveEnd ();
+					this.Path = newState.Directory.FullName;
 				}
 				}
 
 
 				this.State = newState;
 				this.State = newState;