[Vim-latex-cvs] vimfiles/ftplugin/tex texviewer.vim,1.21,1.22
Brought to you by:
srinathava,
tmaas
|
From: <sri...@us...> - 2003-06-15 05:23:33
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/tex
In directory sc8-pr-cvs1:/tmp/cvs-serv12064
Modified Files:
texviewer.vim
Log Message:
Bug: Sometimes Tex_FindBblFiles() would return a bunch of files with
new-lines in them.
Cause: substitue(text, '\n', ' ', 'ge')
doesn't remove newlines (at least in vanilla vim 6.1).
Solution: Use substitute(text, "\n", ' ', 'ge')
instead. NOTE: use double quotes when using special characters in
replacement string in substitute().
Bug: Sometimes the latex file would get the maps from Tex_c_window_setup().
Cause: The maps would be created even when s:UpdateViewerWindow() closed
off the quickfix and preview window because of error E32 and focus
returned to the latex window.
Solution: Check if &ft == 'qf' before setting maps.
Bug: If the tex file used a '\bibliography' command to include a .bib file,
it would not be found. (on windows)
Cause: Used ':' as a path seperator. which crashes on windows, because a
path is of the form c:/path/to/something (i.e ':' is a character in
every path!!)
Solution: Use "\n" as a path seperator on windows.
TODO: Should we be using "\n" for other OSs too?
Index: texviewer.vim
===================================================================
RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/tex/texviewer.vim,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** texviewer.vim 12 Jun 2003 08:16:25 -0000 1.21
--- texviewer.vim 15 Jun 2003 05:23:31 -0000 1.22
***************
*** 82,86 ****
let s:type = substitute(s:curline, pattern, '\1', 'e')
let s:typeoption = substitute(s:curline, pattern, '\2', 'e')
! call Tex_Debug('s:type = '.s:type.', typeoption = '.s:typeoption)
if exists("s:type") && s:type =~ 'ref'
--- 82,86 ----
let s:type = substitute(s:curline, pattern, '\1', 'e')
let s:typeoption = substitute(s:curline, pattern, '\2', 'e')
! call Tex_Debug('s:type = '.s:type.', typeoption = '.s:typeoption, 'view')
if exists("s:type") && s:type =~ 'ref'
***************
*** 94,103 ****
let bblfiles = <SID>Tex_FindBblFiles()
if bibfiles != ''
! exe "silent! grepadd! '@.*{".s:prefix."' ".bibfiles
! let g:bbb = "silent! grepadd! '@.*{".s:prefix."' ".bibfiles
endif
if bblfiles != ''
! exe "silent! grepadd! 'bibitem{".s:prefix."' ".bblfiles
endif
call <SID>Tex_c_window_setup()
--- 94,105 ----
let bblfiles = <SID>Tex_FindBblFiles()
if bibfiles != ''
! call Tex_Debug("silent! grepadd! '@.*{".s:prefix."' ".bibfiles, 'view')
! exec "silent! grepadd! '@.*{".s:prefix."' ".bibfiles
endif
if bblfiles != ''
! call Tex_Debug("silent! grepadd! 'bibitem{".s:prefix."' ".bblfiles, 'view')
! exec "silent! grepadd! 'bibitem{".s:prefix."' ".bblfiles
endif
+ call Tex_Debug('returning', 'view')
call <SID>Tex_c_window_setup()
***************
*** 174,177 ****
--- 176,180 ----
cclose
exe 'copen '. g:Tex_ViewerCwindowHeight
+
setlocal nonumber
setlocal nowrap
***************
*** 179,182 ****
--- 182,193 ----
let s:scrollOffVal = &scrolloff
call <SID>UpdateViewerWindow()
+ " If everything went well, then we should be situated in the quickfix
+ " window. If there were problems, (no matches etc), then we will not be.
+ " Therefore return.
+ if &ft != 'qf'
+ call Tex_Debug('not in quickfix window, quitting', 'view')
+ return
+ endif
+
nnoremap <buffer> <silent> j j:call <SID>UpdateViewerWindow()<CR>
***************
*** 272,275 ****
--- 283,287 ----
endif
let v:errmsg = ''
+ call Tex_Debug('UpdateViewerWindow: got error E32, no matches found, quitting', 'view')
return 0
endif
***************
*** 390,393 ****
--- 402,406 ----
function! s:Tex_FindBibFiles()
+ let position = line('.').' | normal! '.virtcol('.').'|'
if g:projFiles != ''
let bibfiles = ''
***************
*** 403,406 ****
--- 416,420 ----
let g:bibf = bibfiles
+ exec position
return bibfiles
***************
*** 415,424 ****
endif
! let dirs = expand("%:p:h") . ":" . expand("$BIBINPUTS")
! let dirs = substitute(dirs, ':\+', ':', 'g')
let i = 1
! while Tex_Strntok(dirs, ':', i) != ''
! let curdir = Tex_Strntok(dirs, ':', i)
let curdir = substitute(curdir, ' ', "\\", 'ge')
let tmp = ''
--- 429,444 ----
endif
! if has('win32')
! let sep = "\n"
! else
! let sep = ":"
! endif
!
! let dirs = expand("%:p:h") . sep . expand("$BIBINPUTS")
! let dirs = substitute(dirs, sep.'\+', sep, 'g')
let i = 1
! while Tex_Strntok(dirs, sep, i) != ''
! let curdir = Tex_Strntok(dirs, sep, i)
let curdir = substitute(curdir, ' ', "\\", 'ge')
let tmp = ''
***************
*** 442,450 ****
endwhile
! if Tex_GetMainFileName() != ''
! let mainfname = Tex_GetMainFileName()
let mainfdir = fnamemodify(mainfname, ":p:h")
! let curdir = expand("%:p:h")
! let curdir = substitute(curdir, ' ', "\\", 'ge')
exe 'bot 1 split '.mainfname
if search('\\bibliography{', 'w')
--- 462,471 ----
endwhile
! if Tex_GetMainFileName() != '' && expand('%:p') != Tex_GetMainFileName(':p:r')
! let mainfname = Tex_GetMainFileName(':p:r')
let mainfdir = fnamemodify(mainfname, ":p:h")
! let curdir = expand("%:p:h")
! let curdir = substitute(curdir, ' ', "\\", 'ge')
!
exe 'bot 1 split '.mainfname
if search('\\bibliography{', 'w')
***************
*** 454,462 ****
elseif mainfdir != curdir
let bibfiles2 = glob(mainfdir.'/*.bib')
! let bibfiles2 = substitute(bibfiles2, '\n', ' ', 'ge')
endif
wincmd q
endif
return bibfiles.' '.bibfiles2
endif
--- 475,484 ----
elseif mainfdir != curdir
let bibfiles2 = glob(mainfdir.'/*.bib')
! let bibfiles2 = substitute(bibfiles2, "\n", ' ', 'ge')
endif
wincmd q
endif
+ exec position
return bibfiles.' '.bibfiles2
endif
***************
*** 488,492 ****
let bblfiles = glob(curdir.'/*.tex')
! let bblfiles = substitute(bblfiles, '\n', ' ', 'ge')
if Tex_GetMainFileName() != ''
--- 510,515 ----
let bblfiles = glob(curdir.'/*.tex')
! let bblfiles = substitute(bblfiles, "\n", ' ', 'ge')
! call Tex_Debug('getting bblfiles = '.bblfiles)
if Tex_GetMainFileName() != ''
***************
*** 496,500 ****
if mainfdir != curdir
let bblfiles = glob(mainfdir.'/*.tex')
! let bblfiles = substitute(bblfiles, '\n', ' ', 'ge')
endif
--- 519,523 ----
if mainfdir != curdir
let bblfiles = glob(mainfdir.'/*.tex')
! let bblfiles = substitute(bblfiles, "\n", ' ', 'ge')
endif
|