diff --git a/Terminal.Gui/Windows/FileDialog.cs b/Terminal.Gui/Windows/FileDialog.cs index ef0151d5b..19a3e7699 100644 --- a/Terminal.Gui/Windows/FileDialog.cs +++ b/Terminal.Gui/Windows/FileDialog.cs @@ -555,6 +555,7 @@ namespace Terminal.Gui { /// /// If selecting only a single file/directory then you should use instead. public IReadOnlyList MultiSelected { get; private set; } + = Enumerable.Empty ().ToList ().AsReadOnly (); /// @@ -803,6 +804,15 @@ namespace Terminal.Gui { return; } + // if user uses Path selection mode (e.g. Enter in text box) + // then also copy to MultiSelected + if(AllowsMultipleSelection && (!MultiSelected.Any())) { + + MultiSelected = string.IsNullOrWhiteSpace (Path) ? + Enumerable.Empty ().ToList ().AsReadOnly (): + new List () { Path }.AsReadOnly (); + } + this.Canceled = false; Application.RequestStop (); }