Guest User

scite_rev3912.patch

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