mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Allow hotkey specifier to be at any position in label (#4067)
Allow hotkey specifier to be at any position in label "D_irectory" doesn't work because hotPos is hardcoded 0
This commit is contained in:
@@ -168,7 +168,15 @@ public class FileDialogExamples : Scenario
|
|||||||
var fd = new FileDialog
|
var fd = new FileDialog
|
||||||
{
|
{
|
||||||
OpenMode = Enum.Parse<OpenMode> (
|
OpenMode = Enum.Parse<OpenMode> (
|
||||||
_rgOpenMode.RadioLabels.Select (l => TextFormatter.RemoveHotKeySpecifier(l, 0, _rgOpenMode.HotKeySpecifier)).ToArray() [_rgOpenMode.SelectedItem]
|
_rgOpenMode.RadioLabels
|
||||||
|
.Select (l => TextFormatter.FindHotKey (l, _rgOpenMode.HotKeySpecifier, out int hotPos, out Key _)
|
||||||
|
|
||||||
|
// Remove the hotkey specifier at the found position
|
||||||
|
? TextFormatter.RemoveHotKeySpecifier (l, hotPos, _rgOpenMode.HotKeySpecifier)
|
||||||
|
|
||||||
|
// No hotkey found, return the label as is
|
||||||
|
: l)
|
||||||
|
.ToArray () [_rgOpenMode.SelectedItem]
|
||||||
),
|
),
|
||||||
MustExist = _cbMustExist.CheckedState == CheckState.Checked,
|
MustExist = _cbMustExist.CheckedState == CheckState.Checked,
|
||||||
AllowsMultipleSelection = _cbAllowMultipleSelection.CheckedState == CheckState.Checked
|
AllowsMultipleSelection = _cbAllowMultipleSelection.CheckedState == CheckState.Checked
|
||||||
|
|||||||
Reference in New Issue
Block a user