Skip to content

Commit

Permalink
Ensure found text is always visible
Browse files Browse the repository at this point in the history
Fixes #44
  • Loading branch information
fernandreu committed Jul 14, 2019
1 parent 095a5fe commit a3b9b00
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions OfficeRibbonXEditor/ViewModels/FindReplaceDialogViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,10 @@ private void FindWrapper(bool searchUp)
this.StatusText = $"Search match wrapped to the beginning of the {(this.SearchSelection ? "selection" : "document")}";
}

// This should ensure the entire text is visible before it is selected
this.Scintilla.GotoPosition(foundRange.cpMax);
this.Scintilla.GotoPosition(foundRange.cpMin);

this.Scintilla.SetSel(foundRange.cpMin, foundRange.cpMax);
this.MoveDialogAwayFromSelection();
}
Expand Down Expand Up @@ -464,8 +468,13 @@ private void ReplaceWrapper(bool searchUp)
{
this.StatusText = $"Search match wrapped to the beginning of the {(this.SearchSelection ? "selection" : "document")}";
}

// This should ensure the entire text is visible before it is selected
this.Scintilla.GotoPosition(nextRange.cpMax);
this.Scintilla.GotoPosition(nextRange.cpMin);

this.Scintilla.SetSel(nextRange.cpMin, nextRange.cpMax);

this.MoveDialogAwayFromSelection();
}

Expand Down

0 comments on commit a3b9b00

Please sign in to comment.