[Vim-latex-cvs] vimfiles/ftplugin/latex-suite compiler.vim,1.14,1.15
Brought to you by:
srinathava,
tmaas
From: <sri...@us...> - 2002-11-27 06:40:41
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite In directory sc8-pr-cvs1:/tmp/cvs-serv10978 Modified Files: compiler.vim Log Message: A number of bug fixes and code cleanup after the last hack job. Some important changes: 1. Sometimes searching in the quickfix window for other lines before current line containing an error on the same line would go into an infinite loop. 2. Sometimes, when the error occurs towards the end of a long line, we get something like this: l.10 ... and then there is a mistake. In this case, do not use the length of the broken line but use a search strategy. TODO: Use a search strategy even when error line is not of the above form. 3. set nowrap in quickfix window otherwise calculation width of the quickfix window is faulty. Index: compiler.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/compiler.vim,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** compiler.vim 21 Nov 2002 09:58:06 -0000 1.14 --- compiler.vim 27 Nov 2002 06:40:38 -0000 1.15 *************** *** 3,7 **** " Author: Srinath Avadhanula " Created: Tue Apr 23 05:00 PM 2002 PST ! " Last Change: Thu Nov 21 12:00 AM 2002 PST " " Description: functions for compiling/viewing/searching latex documents --- 3,7 ---- " Author: Srinath Avadhanula " Created: Tue Apr 23 05:00 PM 2002 PST ! " Last Change: Tue Nov 26 10:00 PM 2002 PST " " Description: functions for compiling/viewing/searching latex documents *************** *** 127,131 **** exe 'nnoremap <buffer> <silent> <up> <up>:call UpdatePreviewWindow("'.mainfname.'")<CR>' exe 'nnoremap <buffer> <silent> <down> <down>:call UpdatePreviewWindow("'.mainfname.'")<CR>' ! exe 'nnoremap <buffer> <silent> <enter> <enter>:wincmd w<cr>:call GotoErrorLocation("'.mainfname.'", '.winnum.')<CR>' " resize the window to just fit in with the number of lines. --- 127,133 ---- exe 'nnoremap <buffer> <silent> <up> <up>:call UpdatePreviewWindow("'.mainfname.'")<CR>' exe 'nnoremap <buffer> <silent> <down> <down>:call UpdatePreviewWindow("'.mainfname.'")<CR>' ! exe 'nnoremap <buffer> <silent> <enter> <enter>:call GotoErrorLocation("'.mainfname.'", '.winnum.')<CR>' ! ! setlocal nowrap " resize the window to just fit in with the number of lines. *************** *** 237,240 **** --- 239,247 ---- " PositionPreviewWindow: positions the preview window correctly. {{{ " Description: + " The purpose of this function is to count the number of times an error + " occurs on the same line. or in other words, if the current line is + " something like |10 error|, then we want to count the number of + " lines in the quickfix window before this line which also contain lines + " like |10 error|. function! PositionPreviewWindow(filename) *************** *** 246,267 **** endif let errpat = matchstr(getline('.'), '\zs|\d\+ \(error\|warning\)|\ze') let linenum = matchstr(getline('.'), '|\zs\d\+\ze \(error\|warning\)|') ! let errline = line('.') ! 0 ! let numrep = 0 ! while 1 ! if getline('.') =~ errpat ! let numrep = numrep + 1 ! normal! 0 ! call search('|\d\+ \(warning\|error\)|') ! endif ! if line('.') == errline ! break ! else ! call search(errpat, 'W') ! endif ! endwhile if getline('.') =~ '|\d\+ warning|' --- 253,290 ---- endif + " extract the error pattern (something like '|10 error|') on the current + " line. let errpat = matchstr(getline('.'), '\zs|\d\+ \(error\|warning\)|\ze') + " extract the line number from the error pattern. let linenum = matchstr(getline('.'), '|\zs\d\+\ze \(error\|warning\)|') ! " if we are on an error, then count the number of lines before this in the ! " quickfix window with an error on the same line. ! if errpat =~ 'error' ! " our location in the quick fix window. ! let errline = line('.') ! ! " goto the beginning of the quickfix window and begin counting the lines ! " which show an error on the same line. ! 0 ! let numrep = 0 ! while 1 ! " if we are on the same kind of error line, then means we have another ! " line containing the same error pattern. ! if getline('.') =~ errpat ! let numrep = numrep + 1 ! normal! 0 ! endif ! " if we have reached the original location in the quick fix window, ! " then break. ! if line('.') == errline ! break ! else ! " otherwise, search for the next line which contains the same ! " error pattern again. ! call search(errpat, 'W') ! endif ! endwhile ! endif if getline('.') =~ '|\d\+ warning|' *************** *** 318,327 **** let brokenline = matchstr(getline('.'), 'l.'.linenum.' \zs.*\ze') ! let column = strlen(brokenline) ! let normcmd = column.'|' ! elseif getline('.') =~ 'LaTeX Warning: Citation `.*' ! let ref = matchstr(getline('.'), "LaTeX Warning: Citation `\\zs[^']\\+\\ze'") let normcmd = '0/'.ref."\<CR>" --- 341,361 ---- let brokenline = matchstr(getline('.'), 'l.'.linenum.' \zs.*\ze') ! " If the line is of the form ! " l.10 ...and then there was some error ! " it means (most probably) that only part of the erroneous line is ! " shown. In this case, finding the length of the broken line is not ! " correct. Instead goto the beginning of the line and search forward ! " for the part which is displayed and then go to its end. ! if brokenline =~ '^\M...' ! let partline = matchstr(brokenline, '^\M...\m\zs.*') ! let normcmd = "0/\\V".escape(partline, "\\")."/e+1\<CR>" ! else ! let column = strlen(brokenline) ! let normcmd = column.'|' ! endif ! elseif getline('.') =~ 'LaTeX Warning: \(Citation\|Reference\) `.*' ! let ref = matchstr(getline('.'), "LaTeX Warning: \\(Citation\\|Reference\\) `\\zs[^']\\+\\ze'") let normcmd = '0/'.ref."\<CR>" |