Bug 314906

Summary: kate hangs when adding closing bracket at EOF of attached Ruby file
Product: [Applications] kate Reporter: Matthias Ansorg <matthias>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: normal CC: christoph
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: file that makes kate hang when typing ] or } at EOF

Description Matthias Ansorg 2013-02-11 15:17:20 UTC
When trying to add a closing bracket (square one "]" or curly one "}") to the end of the attached .rb Ruby file, kate hangs. It will consume 100% CPU load and be unresponsive until I kill it with "killall -9 kate".

Reproducible: Always

Steps to Reproduce:
1. Open the attached file from this bug report with kate.
2. Make sure highlighting mode is "Ruby".
3. Go to the EOF position (Ctrl + End) and enter the "]" or "}" with your keyboard.
Actual Results:  
kate hangs: it will consume 100% CPU load and be unresponsive until I kill it with "killall -9 kate". The "]" resp. "}" character will not be shown on screen either.

Expected Results:  
Showing "]" resp. "}" character, proceeding normally.

Will attach the concerned file in a comment.
Comment 1 Matthias Ansorg 2013-02-11 15:20:40 UTC
Created attachment 77139 [details]
file that makes kate hang when typing ] or } at EOF

Forgot to mention:
kate version 3.8.5
Using KDE Development Platform 4.8.5 (4.8.5)
Comment 2 Dominik Haumann 2013-08-13 16:04:38 UTC
Cannot reproduce. May it be that you have a really slow machine? Because when the cursor is at a ] or } or ), kate searches for the matching {[( upwards. In this case, this maybe span lots of lines (1100 in the document), since there is no matching part.
Comment 3 Matthias Ansorg 2013-08-13 18:14:56 UTC
You were right, it did not hang in an infinite loop but only took a lot of time to show the "}". I tested again with the attached file:

75 s to complete when inserting "}" at EOF
15 s to complete when inserting "}" at roughly 50% position
3 s to complete when inserting "}" at roughly 25% position

So for every doubling of lines, a 5x in computation time. My machine is a Core2 Duo 1.6 GHz, so not exactly really slow. How fast is the test for you? How fast is it when you duplicate the file content? In any case, it seems like some inefficient code is in there, as typing a character should not take a minute even if it means going through 1000 lines ;-)
Comment 4 Christoph Cullmann 2014-09-22 19:11:47 UTC

*** This bug has been marked as a duplicate of bug 269408 ***