feat: support ctrl + A to select all current section

This commit is contained in:
LiWenhao
2024-04-16 17:23:32 +08:00
parent 472a48ec12
commit 36b01902c7

View File

@@ -221,6 +221,13 @@ public class TimeBox : TemplatedControl
if (_currentActiveSectionIndex is null) return; if (_currentActiveSectionIndex is null) return;
var keymap = TopLevel.GetTopLevel(this)?.PlatformSettings?.HotkeyConfiguration; var keymap = TopLevel.GetTopLevel(this)?.PlatformSettings?.HotkeyConfiguration;
bool Match(List<KeyGesture> gestures) => gestures.Any(g => g.Matches(e)); bool Match(List<KeyGesture> gestures) => gestures.Any(g => g.Matches(e));
if (keymap is not null && Match(keymap.SelectAll))
{
_presenters[_currentActiveSectionIndex.Value].SelectionStart = 0;
_presenters[_currentActiveSectionIndex.Value].SelectionEnd = _presenters[_currentActiveSectionIndex.Value].Text?.Length ?? 0;
return;
}
if (e.Key is Key.Enter or Key.Return) if (e.Key is Key.Enter or Key.Return)
{ {
ParseTimeSpan(ShowLeadingZero); ParseTimeSpan(ShowLeadingZero);