From 45b29e1eea96c71bd2d38a055ca2951d5fe03eb9 Mon Sep 17 00:00:00 2001 From: IndrekV Date: Wed, 6 Jun 2018 21:34:31 +1000 Subject: [PATCH] Improved autocomplete closing after pressing enter (win) --- .../TogglDesktop/AutoCompletion/AutoCompleteController.cs | 4 ++-- .../TogglDesktop/ui/controls/AutoCompletionPopup.xaml.cs | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ui/windows/TogglDesktop/TogglDesktop/AutoCompletion/AutoCompleteController.cs b/src/ui/windows/TogglDesktop/TogglDesktop/AutoCompletion/AutoCompleteController.cs index 73d55fe687..f6fbab4ef9 100644 --- a/src/ui/windows/TogglDesktop/TogglDesktop/AutoCompletion/AutoCompleteController.cs +++ b/src/ui/windows/TogglDesktop/TogglDesktop/AutoCompletion/AutoCompleteController.cs @@ -319,7 +319,7 @@ private void selectIndex(int index) public void SelectNext() { - if (this.visibleItems.Count == 0) + if (this.visibleItems == null || this.visibleItems.Count == 0) return; var i = this.selectedIndex + 1; @@ -341,7 +341,7 @@ public void SelectNext() public void SelectPrevious() { - if (this.visibleItems.Count == 0) + if (this.visibleItems == null || this.visibleItems.Count == 0) return; var i = this.selectedIndex - 1; diff --git a/src/ui/windows/TogglDesktop/TogglDesktop/ui/controls/AutoCompletionPopup.xaml.cs b/src/ui/windows/TogglDesktop/TogglDesktop/ui/controls/AutoCompletionPopup.xaml.cs index 138806a46f..5d6ec8a622 100644 --- a/src/ui/windows/TogglDesktop/TogglDesktop/ui/controls/AutoCompletionPopup.xaml.cs +++ b/src/ui/windows/TogglDesktop/TogglDesktop/ui/controls/AutoCompletionPopup.xaml.cs @@ -274,7 +274,11 @@ private void textboxOnPreviewKeyDown(object sender, KeyEventArgs e) if (this.IsOpen) { if (this.confirmCompletion()) + { e.Handled = true; + } + + this.close(); } return; }