mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-30 01:38:01 +01:00
Ensure MultiSelected is never null and always contains Path if relevant
This commit is contained in:
@@ -555,6 +555,7 @@ namespace Terminal.Gui {
|
||||
/// </summary>
|
||||
/// <remarks>If selecting only a single file/directory then you should use <see cref="Path"/> instead.</remarks>
|
||||
public IReadOnlyList<string> MultiSelected { get; private set; }
|
||||
= Enumerable.Empty<string> ().ToList ().AsReadOnly ();
|
||||
|
||||
|
||||
/// <inheritdoc/>
|
||||
@@ -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<string> ().ToList ().AsReadOnly ():
|
||||
new List<string> () { Path }.AsReadOnly ();
|
||||
}
|
||||
|
||||
this.Canceled = false;
|
||||
Application.RequestStop ();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user