mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Fixes #844. Now selects the correct Directory.
This commit is contained in:
@@ -305,7 +305,7 @@ static class Demo {
|
||||
Application.Run (d);
|
||||
|
||||
if (!d.Canceled)
|
||||
MessageBox.Query (50, 7, "Selected File", string.Join (", ", d.FilePaths), "Ok");
|
||||
MessageBox.Query (50, 7, "Selected File", d.FilePaths.Count > 0 ? string.Join (", ", d.FilePaths) : d.FilePath, "Ok");
|
||||
}
|
||||
|
||||
public static void ShowHex (Toplevel top)
|
||||
|
||||
@@ -347,13 +347,15 @@ namespace Terminal.Gui {
|
||||
}
|
||||
}
|
||||
|
||||
internal bool ExecuteSelection ()
|
||||
internal bool ExecuteSelection (bool isPrompt = false)
|
||||
{
|
||||
var isDir = infos [selected].Item2;
|
||||
|
||||
if (isDir) {
|
||||
Directory = Path.GetFullPath (Path.Combine (Path.GetFullPath (Directory.ToString ()), infos [selected].Item1));
|
||||
DirectoryChanged?.Invoke (Directory);
|
||||
if (!isPrompt) {
|
||||
Directory = Path.GetFullPath (Path.Combine (Path.GetFullPath (Directory.ToString ()), infos [selected].Item1));
|
||||
DirectoryChanged?.Invoke (Directory);
|
||||
}
|
||||
} else {
|
||||
FileChanged?.Invoke (infos [selected].Item1);
|
||||
if (canChooseFiles) {
|
||||
@@ -467,8 +469,8 @@ namespace Terminal.Gui {
|
||||
};
|
||||
Add (dirLabel, dirEntry);
|
||||
|
||||
this.nameFieldLabel = new Label ("Open: ") {
|
||||
X = 6,
|
||||
this.nameFieldLabel = new Label ("File(s): ") {
|
||||
X = 3,
|
||||
Y = 3 + msgLines,
|
||||
};
|
||||
nameEntry = new TextField ("") {
|
||||
@@ -500,7 +502,7 @@ namespace Terminal.Gui {
|
||||
IsDefault = true,
|
||||
};
|
||||
this.prompt.Clicked += () => {
|
||||
dirListView.ExecuteSelection ();
|
||||
dirListView.ExecuteSelection (true);
|
||||
canceled = false;
|
||||
Application.RequestStop ();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user