From 4740a7ed1f7d5bc541fd1fbe874cfe8869a774ed Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 4 Jan 2014 13:14:14 +0200 Subject: [PATCH] Safer cursor saving / restoring for cgc. --- syntax_checkers/glsl/cgc.vim | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/syntax_checkers/glsl/cgc.vim b/syntax_checkers/glsl/cgc.vim index efbd231f..d27a00d1 100644 --- a/syntax_checkers/glsl/cgc.vim +++ b/syntax_checkers/glsl/cgc.vim @@ -42,11 +42,20 @@ function! SyntaxCheckers_glsl_cgc_GetLocList() dict endfunction function! s:GetProfile() - let save_cursor = getpos('.') + let save_view = winsaveview() + let old_foldenable = &foldenable + let old_lazyredraw = &lazyredraw + + let &lazyredraw = 1 + let &foldenable = 0 call cursor(1, 1) + let magic = '\m\C^// profile:\s*' let line = search(magic, 'c') - call setpos('.', save_cursor) + + call winrestview(save_view) + let &foldenable = old_foldenable + let &lazyredraw = old_lazyredraw if line let profile = matchstr(getline(line), magic . '\zs.*')