Fixes #844. Now selects the correct Directory.

This commit is contained in:
BDisp
2020-08-02 11:17:10 +01:00
parent e658f08228
commit d232715e62
2 changed files with 9 additions and 7 deletions

View File

@@ -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)

View File

@@ -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 ();
};