[Vim-latex-cvs] vimfiles/ftplugin/latex-suite templates.vim,1.15,1.16
Brought to you by:
srinathava,
tmaas
From: <sri...@us...> - 2003-12-16 20:29:28
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite In directory sc8-pr-cvs1:/tmp/cvs-serv22479 Modified Files: templates.vim Log Message: Bug: When g:Imap_PlaceHolderStart and/or g:Imap_PlaceHolderEnd settings were not ascii and encoding=utf8, then reading in a template did not work as advertised (placeholders are shown as <ab><bb> etc) Why: templates.vim still used simple pattern substitution to replace the placeholder characters, which does not work in the above setting. Fix: Use IMAP_PutTextWithMovement which handles the above situation. Index: templates.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/templates.vim,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** templates.vim 16 Nov 2003 15:12:31 -0000 1.15 --- templates.vim 16 Dec 2003 20:29:25 -0000 1.16 *************** *** 24,30 **** endif exe "amenu ".g:Tex_TemplatesMenuLocation."&".i.":<Tab>".fname." ". ! \":call <SID>ReadTemplate('".fname."')<CR>". ! \":call <SID>ProcessTemplate()<CR>:0<CR>". ! \"i<C-r>=IMAP_Jumpfunc('', 1)<CR>" let i = i + 1 endwhile --- 24,28 ---- endif exe "amenu ".g:Tex_TemplatesMenuLocation."&".i.":<Tab>".fname." ". ! \":call <SID>ReadTemplate('".fname."')<CR>" let i = i + 1 endwhile *************** *** 51,55 **** --- 49,55 ---- let fname = Tex_FindInRtp(filename.'.tex', 'templates', ':p') call Tex_Debug("0read ".fname, 'templates') + silent! exe "0read ".fname + " The first line of the file contains the specifications of what the " placeholder characters and the other special characters are. *************** *** 61,68 **** let s:comTemp = substitute(getline(1), pattern, '\4', '') ! call Tex_Debug('phs = '.s:phsTemp.', phe = '.s:pheTemp.', exe = '.s:exeTemp.', com = '.s:comTemp, 'templates') ! " delete the first line into ze blackhole. ! 0 d _ call Tex_pack_updateall(1) --- 61,79 ---- let s:comTemp = substitute(getline(1), pattern, '\4', '') ! call s:ProcessTemplate() ! 0 d_ ! " Do not handle the placeholders here. Let IMAP_PutTextWithMovement do it ! " because it handles UTF-8 character substitutions etc. Therefore delete ! " the text into @a and paste it using IMAP_PutTextWithMovement(). ! let _a = @a ! normal! ggVG"ax ! ! call Tex_Debug("normal! i\<C-r>=IMAP_PutTextWithMovement(@a, '".s:phsTemp."', '".s:pheTemp."')\<CR>", 'templates') ! exec "normal! i\<C-r>=IMAP_PutTextWithMovement(@a, '".s:phsTemp."', '".s:pheTemp."')\<CR>" ! ! let @a = _a ! ! call Tex_Debug('phs = '.s:phsTemp.', phe = '.s:pheTemp.', exe = '.s:exeTemp.', com = '.s:comTemp, 'templates') call Tex_pack_updateall(1) *************** *** 81,89 **** exec 'silent! g/'.s:comTemp.s:comTemp.'/d' - let phsUser = IMAP_GetPlaceHolderStart() - let pheUser = IMAP_GetPlaceHolderEnd() - - exec 'silent! %s/'.s:phsTemp.'\(.\{-}\)'.s:pheTemp.'/'.phsUser.'\1'.pheUser.'/ge' - " A function only puts one item into the search history... call Tex_CleanSearchHistory() --- 92,95 ---- *************** *** 109,115 **** if v:version >= 602 com! -complete=custom,Tex_CompleteTemplateName -nargs=? TTemplate :call <SID>ReadTemplate(<f-args>) - \| :call <SID>ProcessTemplate() - \| :0 - \| :exec "normal! i\<C-r>=IMAP_Jumpfunc('', 1)\<CR>" \| :startinsert --- 115,118 ---- *************** *** 129,135 **** else com! -nargs=? TTemplate :call <SID>ReadTemplate(<f-args>) - \| :call <SID>ProcessTemplate() - \| :0 - \| :exec "normal! i\<C-r>=IMAP_Jumpfunc('', 1)\<CR>" \| :startinsert --- 132,135 ---- |