mirror of
https://github.com/fadden/6502bench.git
synced 2024-11-29 10:50:28 +00:00
Change find-previous hotkey to Shift+F3
The range-select behavior that was giving us problems can be worked around by switching the control to single-select mode when changing the selection.
This commit is contained in:
parent
bd11aea4a4
commit
c8dfa94ce2
@ -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) {
|
||||
|
@ -103,8 +103,7 @@ limitations under the License.
|
||||
</RoutedUICommand>
|
||||
<RoutedUICommand x:Key="FindPreviousCmd" Text="Find Previous">
|
||||
<RoutedUICommand.InputGestures>
|
||||
<!-- should be Shift+F3, but that causes ListView to do range selection -->
|
||||
<KeyGesture>Ctrl+F3</KeyGesture>
|
||||
<KeyGesture>Shift+F3</KeyGesture>
|
||||
</RoutedUICommand.InputGestures>
|
||||
</RoutedUICommand>
|
||||
<RoutedUICommand x:Key="FormatAsWordCmd" Text="Format As Word">
|
||||
|
@ -758,7 +758,7 @@ namespace SourceGen.WpfGui {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selects a range of values. Does not clear the previous selection.
|
||||
/// Selects a range of values. Clears the previous selection.
|
||||
/// </summary>
|
||||
/// <param name="start">First line to select.</param>
|
||||
/// <param name="count">Number of lines to select.</param>
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user