Mercurial > vim
comparison src/testdir/test_syntax.vim @ 11529:998d2cf59caa v8.0.0647
patch 8.0.0647: syntax highlighting can make cause a freeze
commit https://github.com/vim/vim/commit/06f1ed2f78c5c03af95054fc3a8665df39dec362
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jun 18 22:41:03 2017 +0200
patch 8.0.0647: syntax highlighting can make cause a freeze
Problem: Syntax highlighting can make cause a freeze.
Solution: Apply 'redrawtime' to syntax highlighting, per window.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 18 Jun 2017 22:45:04 +0200 |
parents | 7cbcba782c4e |
children | cbceef33af7a |
comparison
equal
deleted
inserted
replaced
11528:5d3f98e7f715 | 11529:998d2cf59caa |
---|---|
422 call assert_equal('light', &bg) | 422 call assert_equal('light', &bg) |
423 set bg=dark | 423 set bg=dark |
424 hi Normal ctermbg=12 | 424 hi Normal ctermbg=12 |
425 call assert_equal('dark', &bg) | 425 call assert_equal('dark', &bg) |
426 endfunc | 426 endfunc |
427 | |
428 func Test_syntax_hangs() | |
429 if !has('reltime') || !has('float') || !has('syntax') | |
430 return | |
431 endif | |
432 | |
433 " This pattern takes a long time to match, it should timeout. | |
434 new | |
435 call setline(1, ['aaa', repeat('abc ', 1000), 'ccc']) | |
436 let start = reltime() | |
437 set nolazyredraw redrawtime=101 | |
438 syn match Error /\%#=1a*.*X\@<=b*/ | |
439 redraw | |
440 let elapsed = reltimefloat(reltime(start)) | |
441 call assert_true(elapsed > 0.1) | |
442 call assert_true(elapsed < 1.0) | |
443 | |
444 " second time syntax HL is disabled | |
445 let start = reltime() | |
446 redraw | |
447 let elapsed = reltimefloat(reltime(start)) | |
448 call assert_true(elapsed < 0.1) | |
449 | |
450 " after CTRL-L the timeout flag is reset | |
451 let start = reltime() | |
452 exe "normal \<C-L>" | |
453 redraw | |
454 let elapsed = reltimefloat(reltime(start)) | |
455 call assert_true(elapsed > 0.1) | |
456 call assert_true(elapsed < 1.0) | |
457 | |
458 set redrawtime& | |
459 bwipe! | |
460 endfunc |