Menu

#473 BugFix: Freezes when double-click on long string

Next_release
closed
nobody
None
7
2013-07-03
2013-04-27
SharpC
No

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.

Discussion

  • Don HO

    Don HO - 2013-05-13
    • status: open --> accepted
    • Priority: 5 --> 7
     
  • Don HO

    Don HO - 2013-05-13

    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

     
  • Don HO

    Don HO - 2013-07-03
    • status: accepted --> closed