From 0689a9445343a6c99f11959d8b4a91d598bc8495 Mon Sep 17 00:00:00 2001 From: Vince Date: Tue, 6 Oct 2020 12:10:28 -0400 Subject: [PATCH] Fix user set SCI_SETYCARETPOLICY erase by find result Use SCI_SETVISIBLEPOLICY and SCI_ENSUREVISIBLEENFORCEPOLICY to replace SCI_SETYCARETPOLICY. X and Y caret policy should be user-configurable for document navigation and the VISIBLE / ENSUREVISIBLE could be used for application / auto navigation (like re-centering a search result). Fix #8961, close #8962 --- PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp index bc3e2a38..b676cfef 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp @@ -219,10 +219,12 @@ void Searching::displaySectionCentered(int posStart, int posEnd, ScintillaEditVi pEditView->execute(SCI_ENSUREVISIBLE, pEditView->execute(SCI_LINEFROMPOSITION, posEnd)); // Jump-scroll to center, if current position is out of view - pEditView->execute(SCI_SETYCARETPOLICY, CARET_JUMPS | CARET_EVEN); + pEditView->execute(SCI_SETVISIBLEPOLICY, CARET_JUMPS | CARET_EVEN); + pEditView->execute(SCI_ENSUREVISIBLEENFORCEPOLICY, pEditView->execute(SCI_LINEFROMPOSITION, isDownwards ? posEnd : posStart)); // When searching up, the beginning of the (possible multiline) result is important, when scrolling down the end pEditView->execute(SCI_GOTOPOS, isDownwards ? posEnd : posStart); - pEditView->execute(SCI_SETYCARETPOLICY, CARET_EVEN); + pEditView->execute(SCI_SETVISIBLEPOLICY, CARET_EVEN); + pEditView->execute(SCI_ENSUREVISIBLEENFORCEPOLICY, pEditView->execute(SCI_LINEFROMPOSITION, isDownwards ? posEnd : posStart)); // Adjust so that we see the entire match; primarily horizontally pEditView->execute(SCI_SCROLLRANGE, posStart, posEnd);