BugFix: Freezes when double-click on long string
Notepad++ project is moving to GitHub:
Brought to you by:
donho
Steps to reproduce:
1. Create text document and place about 200KB of "a" chars
2. Double-click on this string
Notepad++ will freeze for a few seconds and then highlight string
Cause of bug and fix:
Common mistake: using of strlen function call in cycle condition in PowerEditor\src\ScitillaComponent\SmartHighlighter.cpp:139
bool SmartHighlighter::isQualifiedWord(const char *str) const { for (size_t i = 0 ; i < strlen(str) ; i++)
Instead there should be:
for (size_t i = 0, ilen = strlen(str) ; i < ilen ; i++)
I've checked: it solves freezing.
Tested, it improves indeed the performance.
I thought it is opmized by the compiler, or there's some missing compiling option.
Anyway I have made the optimization for all strlen() and vectot::size() in for loop as your suggestion. It should make Notepad++ more performant.
Thank you for the patch.
Don