Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # HG changeset patch
- # User Jerome LAFORGE <[email protected]>
- # Date 1345884384 -7200
- # Node ID 246e6437b78ebb71f422a5c469770f72289a355f
- # Parent fb6f88071fa2a44c28de6dccd53193be45fb0847
- Limit the search duration to 250ms for highlight.current.word.
- diff -r fb6f88071fa2 -r 246e6437b78e src/SciTEBase.cxx
- --- a/src/SciTEBase.cxx sam. août 25 17:39:08 2012 +1000
- +++ b/src/SciTEBase.cxx sam. août 25 10:46:24 2012 +0200
- @@ -786,10 +786,20 @@
- wCurrent.Call(SCI_SETSEARCHFLAGS, SCFIND_MATCHCASE | SCFIND_WHOLEWORD);
- wCurrent.Call(SCI_SETTARGETSTART, 0);
- wCurrent.Call(SCI_SETTARGETEND, lenDoc);
- +
- + //Monitor the amount of time took by the search.
- + GUI::ElapsedTime searchElapsedTime;
- +
- // Find the first occurrence of word.
- int indexOf = wCurrent.CallString(SCI_SEARCHINTARGET,
- wordToFind.length(), wordToFind.c_str());
- while (indexOf != -1 && indexOf < lenDoc) {
- + // Limit the search duration to 250 ms. Avoid to freeze editor for large files.
- + if (searchElapsedTime.Duration() > 0.25) {
- + // Clear all indicators because timer has expired.
- + wCurrent.Call(SCI_INDICATORCLEARRANGE, 0, lenDoc);
- + break;
- + }
- if (!currentWordHighlight.isOnlyWithSameStyle || selectedStyle ==
- wCurrent.Call(SCI_GETSTYLEAT, indexOf)) {
- wCurrent.Call(SCI_INDICATORFILLRANGE, indexOf, wordToFind.length());
Advertisement
Add Comment
Please, Sign In to add comment