Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13982/ftplugin/latex-suite
Modified Files:
envmacros.vim main.vim
Log Message:
Bug: Pressing <F7> in insert mode does not work as advertised except in
rare cases. (Jorge Scandaliaris)
Why: Implementation bugs in Tex_DoCommand.
Fix: An important lesson learnt is that its important to avoid moving the
cursor in functions called by insert mode mappings except at the very
end. This prevents us from having to account for too many corner
cases.
Index: envmacros.vim
===================================================================
RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/envmacros.vim,v
retrieving revision 1.48
retrieving revision 1.49
diff -C2 -d -r1.48 -r1.49
*** envmacros.vim 25 May 2004 18:51:10 -0000 1.48
--- envmacros.vim 19 Nov 2005 22:35:47 -0000 1.49
***************
*** 959,970 ****
" ==============================================================================
" Define certain commonly used command definitions {{{
! "
TexLet g:Tex_Com_{'newtheorem'} = '\newtheorem{<+name+>}{<+caption+>}[<+within+>]'
TexLet g:Tex_Com_{'frac'} = '\frac{<+n+>}{<+d+>}<++>'
" }}}
" PromptForCommand: prompts for a command {{{
" Description:
function! PromptForCommand(ask)
-
let common_com_prompt =
\ Tex_CreatePrompt(g:Tex_PromptedCommands, 2, ',') . "\n" .
--- 959,970 ----
" ==============================================================================
" Define certain commonly used command definitions {{{
!
TexLet g:Tex_Com_{'newtheorem'} = '\newtheorem{<+name+>}{<+caption+>}[<+within+>]'
TexLet g:Tex_Com_{'frac'} = '\frac{<+n+>}{<+d+>}<++>'
+
" }}}
" PromptForCommand: prompts for a command {{{
" Description:
function! PromptForCommand(ask)
let common_com_prompt =
\ Tex_CreatePrompt(g:Tex_PromptedCommands, 2, ',') . "\n" .
***************
*** 983,1006 ****
" Description:
"
! function! Tex_DoCommand(...)
! if a:0 < 1
! " If the current line is empty or if a visual selection has been made,
! " prompt for a new environment.
! if getline('.') == '' || (exists('s:isvisual') && s:isvisual == 'yes')
! let com = PromptForCommand('Choose a command to insert: ')
! if com != ''
! return Tex_PutCommand(com)
else
return ''
endif
- else
- let lastword = matchstr(getline('.'), '\w\+$')
- call Tex_Debug("Tex_DoCommand: getting lastword = ".lastword, "env")
- if lastword != ''
- return substitute(lastword, '.', "\<bs>", 'g').Tex_PutCommand(lastword)
- endif
endif
- else
- return Tex_PutCommand(a:1)
endif
endfunction " }}}
--- 983,1022 ----
" Description:
"
! function! Tex_DoCommand(isvisual)
! " If the current line is empty or if a visual selection has been made,
! " prompt for a new environment.
! if getline('.') == '' || a:isvisual == 'yes'
! let com = PromptForCommand('Choose a command to insert: ')
! if com != ''
! return Tex_PutCommand(com)
! else
! return ''
! endif
! else
! " We want to find out the word under the cursor without issuing
! " any movement commands.
! let presline = getline('.')
! let c = col('.')
!
! let wordbef = matchstr(strpart(presline, 0, c-1), '\k\+$')
! let wordaft = matchstr(strpart(presline, c-1), '^\k\+')
!
! let word = wordbef . wordaft
! call Tex_Debug("Tex_DoCommand: wordbef = [".wordbef."], wordaft = [".wordaft."], word = [".word."]", 'env')
!
! " We use \<Del> instead of \<Bs> because \<Bs> does not work
! " unless bs=2
! if word != ''
! return substitute(wordbef, '.', "\<Left>", 'g')
! \ . substitute(word, '.', "\<Del>", 'g')
! \ . Tex_PutCommand(word)
! else
! let cmd = PromptForCommand('Choose a command to insert: ')
! if cmd != ''
! return Tex_PutCommand(cmd)
else
return ''
endif
endif
endif
endfunction " }}}
***************
*** 1042,1066 ****
let b:DoubleDollars = 0
! inoremap <silent> <Plug>Tex_FastCommandInsert <C-r>=Tex_FastCommandInsert('no')<cr>
! nnoremap <silent> <Plug>Tex_FastCommandInsert ea<C-r>=Tex_FastCommandInsert('no')<cr>
inoremap <silent> <Plug>Tex_FastCommandChange <C-O>:call Tex_ChangeCommand('no')<CR>
nnoremap <silent> <Plug>Tex_FastCommandChange :call Tex_ChangeCommand('no')<CR>
- vnoremap <silent> <Plug>Tex_FastCommandInsert <C-\><C-N>:call Tex_FastCommandInsert('yes')<CR>
-
- " Tex_FastCommandInsert: maps <F7> to prompt for command and insert it " {{{
- " Description:
- " Here we are not solving if we are in preamble, behaviour is always the
- " same.
- function! Tex_FastCommandInsert(isvisual)
- let start_line = line('.')
- let pos = line('.').' | normal! '.virtcol('.').'|'
- let s:isvisual = a:isvisual
-
- return Tex_DoCommand()
-
- endfunction
-
- " }}}
" Tex_ChangeCommand: calls ChangeCommand() to change the environment {{{
" Description:
--- 1058,1068 ----
let b:DoubleDollars = 0
! inoremap <silent> <Plug>Tex_FastCommandInsert <C-r>=Tex_DoCommand('no')<cr>
! nnoremap <silent> <Plug>Tex_FastCommandInsert i<C-r>=Tex_DoCommand('no')<cr>
! vnoremap <silent> <Plug>Tex_FastCommandInsert <C-\><C-N>:call Tex_DoCommand('yes')<CR>
!
inoremap <silent> <Plug>Tex_FastCommandChange <C-O>:call Tex_ChangeCommand('no')<CR>
nnoremap <silent> <Plug>Tex_FastCommandChange :call Tex_ChangeCommand('no')<CR>
" Tex_ChangeCommand: calls ChangeCommand() to change the environment {{{
" Description:
Index: main.vim
===================================================================
RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/main.vim,v
retrieving revision 1.80
retrieving revision 1.81
diff -C2 -d -r1.80 -r1.81
*** main.vim 19 Nov 2005 18:00:01 -0000 1.80
--- main.vim 19 Nov 2005 22:35:47 -0000 1.81
***************
*** 636,640 ****
" keep that as a stable point.
function! Tex_Version()
! return "Latex-Suite: version 1.6.15"
endfunction
--- 636,640 ----
" keep that as a stable point.
function! Tex_Version()
! return "Latex-Suite: version 1.6.16"
endfunction
|