[Vim-latex-cvs] vimfiles/plugin imaps.vim,1.38,1.39
Brought to you by:
srinathava,
tmaas
From: <sri...@us...> - 2004-05-30 07:35:51
|
Update of /cvsroot/vim-latex/vimfiles/plugin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1897 Modified Files: imaps.vim Log Message: Bug: Typing >>> \begin{array} >>> \end{} results in >>> \begin{array} >>> \end{<++>} with the cursor at the end (Berta Milan) Why: When the indentation of a line changes while typing the text returned by IMAP_PutTextWithMovement, then IMAP_Mark('go') does not go to the same location as set by IMAP_Mark('set'). This causes the cursor to be located not before the first placeholder causing the first placeholder to be "missed". Fix: Check to see if the indentation of the line remembered by IMAP_Mark('set') has changed and if so, move a little to the left or right to adjust for the indentation changing. Index: imaps.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/plugin/imaps.vim,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** imaps.vim 4 May 2004 20:50:11 -0000 1.38 --- imaps.vim 30 May 2004 07:35:40 -0000 1.39 *************** *** 373,376 **** --- 373,377 ---- let text = text . "i\<C-r>=IMAP_Jumpfunc('', 1)\<CR>" + call IMAP_Debug('IMAP_PutTextWithMovement: text = ['.text.']', 'imap') return text endfunction *************** *** 750,758 **** --- 751,767 ---- " script-local variable; restore this position if a:action == 'go'. let s:Mark = "(0,0)" + let s:initBlanks = '' function! IMAP_Mark(action) if a:action == 'set' let s:Mark = "(" . line(".") . "," . col(".") . ")" + let s:initBlanks = matchstr(getline('.'), '^\s*') elseif a:action == 'go' execute "call cursor" s:Mark + let blanksNow = matchstr(getline('.'), '^\s*') + if strlen(blanksNow) > strlen(s:initBlanks) + execute 'silent! normal! '.(strlen(blanksNow) - strlen(s:initBlanks)).'l' + elseif strlen(blanksNow) < strlen(s:initBlanks) + execute 'silent! normal! '.(strlen(s:initBlanks) - strlen(blanksNow)).'h' + endif endif endfunction "" }}} |