1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-06-24 08:29:29 +00:00

Add current position to nav stack on initial Find

It's fairly common to want to Find something and then jump back to
where you were.  The Find command now adds the current position to
the nav stack for the initial search.  If you Find Next, the nav
stack is not altered.
This commit is contained in:
Andy McFadden 2020-07-30 14:32:15 -07:00
parent 94d7a30a09
commit 0b765e075f

View File

@ -2466,19 +2466,19 @@ namespace SourceGen {
if (dlg.ShowDialog() == true) {
mFindString = dlg.TextToFind;
mFindStartIndex = -1;
FindText(dlg.IsBackward);
FindText(dlg.IsBackward, true);
}
}
public void FindNext() {
FindText(false);
FindText(false, false);
}
public void FindPrevious() {
FindText(true);
FindText(true, false);
}
private void FindText(bool goBackward) {
private void FindText(bool goBackward, bool pushLocation) {
if (string.IsNullOrEmpty(mFindString)) {
return;
}
@ -2519,6 +2519,10 @@ namespace SourceGen {
StringComparison.InvariantCultureIgnoreCase);
if (matchPos >= 0) {
//Debug.WriteLine("Match " + index + ": " + searchStr);
if (pushLocation) {
mNavStack.Push(GetCurrentlySelectedLocation());
}
mMainWin.CodeListView_EnsureVisible(index);
mMainWin.CodeListView_SelectRange(index, 1);
return;