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
pull/9062/head
Vince 4 years ago committed by Don HO
parent a2233b105d
commit 0689a94453
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E

@ -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);

Loading…
Cancel
Save