diff --git a/OfficeRibbonXEditor/ViewModels/FindReplaceDialogViewModel.cs b/OfficeRibbonXEditor/ViewModels/FindReplaceDialogViewModel.cs index 6ebaf111..3f44e291 100644 --- a/OfficeRibbonXEditor/ViewModels/FindReplaceDialogViewModel.cs +++ b/OfficeRibbonXEditor/ViewModels/FindReplaceDialogViewModel.cs @@ -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(); } @@ -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(); }