From a04557762d64ff08909f519a37abb909aaa0a1ec Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Mon, 25 Oct 2021 15:45:42 -0700 Subject: [PATCH] Fix keyboard nav after selection jump If you change the selection by double-clicking in one of the side windows (References, Notes, Symbols, Messages) and then attempt to navigate with the arrow keys, the program will appear to hang briefly, then jump to the start or end of the project and shift the window focus to something else (like the Help menu in the menu bar). For reasons I don't fully understand, the behavior is fixed by removing unnecessary calls to codeListView.Focus(). The calls were intended to shift input focus to the main ListView, but they're no longer necessary, and appear to upset WPF. (issue #113) --- SourceGen/WpfGui/MainWindow.xaml.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/SourceGen/WpfGui/MainWindow.xaml.cs b/SourceGen/WpfGui/MainWindow.xaml.cs index d492991..fba729c 100644 --- a/SourceGen/WpfGui/MainWindow.xaml.cs +++ b/SourceGen/WpfGui/MainWindow.xaml.cs @@ -1030,9 +1030,9 @@ namespace SourceGen.WpfGui { /// Generally don't call this: it puts the focus on the control, not the items in the /// control, so if you use up/down arrows you move to the next control. /// - public void CodeListView_Focus() { - codeListView.Focus(); - } + //public void CodeListView_Focus() { + // codeListView.Focus(); + //} #endregion Selection management @@ -1686,7 +1686,7 @@ namespace SourceGen.WpfGui { // Jump to the offset, then shift the focus back to the code list. mMainCtrl.GoToLocation(new NavStack.Location(rli.OffsetValue, 0, NavStack.GoToMode.JumpToCodeData), true); - codeListView.Focus(); + //codeListView.Focus(); } #endregion References panel @@ -1730,7 +1730,7 @@ namespace SourceGen.WpfGui { // Jump to the offset, then shift the focus back to the code list. mMainCtrl.GoToLocation(new NavStack.Location(nli.OffsetValue, 0, NavStack.GoToMode.JumpToNote), true); - codeListView.Focus(); + //codeListView.Focus(); } #endregion Notes panel @@ -1858,7 +1858,7 @@ namespace SourceGen.WpfGui { // TODO: this should also work for project/platform symbols that have EQU directives mMainCtrl.GoToLabel(sli.Sym); - codeListView.Focus(); + //codeListView.Focus(); } private void SymbolsList_Filter(object sender, FilterEventArgs e) { @@ -2112,7 +2112,7 @@ namespace SourceGen.WpfGui { // Jump to the offset, then shift the focus back to the code list. mMainCtrl.GoToLocation(new NavStack.Location(mli.OffsetValue, 0, NavStack.GoToMode.JumpToCodeData), true); - codeListView.Focus(); + //codeListView.Focus(); } ///