diff --git a/SourceGen/MainController.cs b/SourceGen/MainController.cs
index e917486..311aa31 100644
--- a/SourceGen/MainController.cs
+++ b/SourceGen/MainController.cs
@@ -2191,13 +2191,7 @@ namespace SourceGen {
if (matchPos >= 0) {
//Debug.WriteLine("Match " + index + ": " + searchStr);
mMainWin.CodeListView_EnsureVisible(index);
- mMainWin.CodeListView_DeselectAll();
mMainWin.CodeListView_SelectRange(index, 1);
- // TODO(someday): I think we need to do something with the ListView
- // keyboard nav state here. Otherwise Shift+F3 is regarded as selection
- // movement with shift held down, and it does a range select. Currently
- // working around this by using Ctrl+F3 instead. See also maybe the
- // ItemContainerGenerator stuff in MainWindow.
return;
}
@@ -2460,7 +2454,6 @@ namespace SourceGen {
mMainWin.CodeListView_EnsureVisible(topLineIndex);
// Update the selection.
- mMainWin.CodeListView_DeselectAll();
mMainWin.CodeListView_SelectRange(topLineIndex, lastLineIndex - topLineIndex);
if (doPush) {
@@ -2512,7 +2505,6 @@ namespace SourceGen {
mMainWin.CodeListView_EnsureVisible(lineIndex);
// Update the selection.
- mMainWin.CodeListView_DeselectAll();
mMainWin.CodeListView_SelectRange(lineIndex, 1);
if (doPush) {
diff --git a/SourceGen/WpfGui/MainWindow.xaml b/SourceGen/WpfGui/MainWindow.xaml
index f131d92..8c44cb0 100644
--- a/SourceGen/WpfGui/MainWindow.xaml
+++ b/SourceGen/WpfGui/MainWindow.xaml
@@ -103,8 +103,7 @@ limitations under the License.
-
- Ctrl+F3
+ Shift+F3
diff --git a/SourceGen/WpfGui/MainWindow.xaml.cs b/SourceGen/WpfGui/MainWindow.xaml.cs
index 63518b2..cb176d7 100644
--- a/SourceGen/WpfGui/MainWindow.xaml.cs
+++ b/SourceGen/WpfGui/MainWindow.xaml.cs
@@ -758,7 +758,7 @@ namespace SourceGen.WpfGui {
}
///
- /// Selects a range of values. Does not clear the previous selection.
+ /// Selects a range of values. Clears the previous selection.
///
/// First line to select.
/// Number of lines to select.
@@ -766,8 +766,20 @@ namespace SourceGen.WpfGui {
Debug.Assert(start >= 0 && start < CodeDisplayList.Count);
Debug.Assert(count > 0 && start + count <= CodeDisplayList.Count);
+ CodeListView_DeselectAll();
+
if (count == 1) {
- codeListView.SelectedItems.Add(CodeDisplayList[start]);
+ //codeListView.SelectedItems.Add(CodeDisplayList[start]);
+
+ // Special handling for single-item selection, for the benefit of Shift+F3. If
+ // we're in multi-select mode, and we select an item while the shift key is
+ // down, the control will do a range select instead (as if you shift-clicked).
+ // We work around this by temporarily switching to single-select mode.
+ //
+ // This could cause problems if we wanted to select multiple single lines.
+ codeListView.SelectionMode = SelectionMode.Single;
+ codeListView.SelectedItem = CodeDisplayList[start];
+ codeListView.SelectionMode = SelectionMode.Extended;
return;
}