On 2009-04-21 19:07, Till Maas wrote
> On Di April 21 2009, Stefanie Fauconnier wrote:
>
>> I have the same problem. When I hit <F5> in insert mode and choose an
>> environment (doesn't matter which one) there is a redundant " before the
>> cursor. I'm using vim-latexsuite 20060325-4.1 on Ubuntu Hardy (installed
>> from the Ubuntu repos).
I also had this problem with vim-latexsuite 20060325-4.1. Moving to the
current vim-latex-1.5-20090804-r1058 tarball release downloaded from
sourceforge fixed it for me.
>> I don't know if I'd better upgrade or not, I made
>> quite a few customizations so I don't know if it would matter that much
>> anyway (I replaced most math functionalities with shortcuts and combo's for
>> linguists).
Beware, I did have problems upgrading from 20060325-4.1 to
vim-latex-1.5-20090804-r1058. Like you, I had loads of customizations in
the code, but recent clean-ups apparently also introduced a number of
small bugs. See my other mails for patches.
Back to the <F5> bug:
Before trying vim-latex-1.5-20090804-r1058, I digged into this problem
as well. What I found is a bit worrying, as it might indicate a bug in
vim that needs to be reported upstream.
When calling vim's input() function with a string that contains
newlines, $BAD_THINGS can happen much later. In this example, the
following occurred:
Tex_DoEnvironment()
|
\-calls PromptForEnvironment()
| |
| \-calls Tex_InputChooseFromPrompt()
| |
| \-calls input("a \n long \n string \n with \n newlines")
|
\-calls Tex_PutEnvironment()
|
\-calls IMAP_PutTextWithMovement()
|
\-uses expression register (c_CTRL-R_=) to enter movement string
The string entered into the document by IMAP_PutTextWithMovement with
the expression register is quite complicated, containing some function
calls to set position and the likes.
When entering the string into the expression register by hand, it works
okay. It also works okay in IMAP_PutTextWithMovement() with _most_
strings. Apparently, only some special characters like \[ (escape?)
cause problems.
The problems go away if you change the prompt-string used in input() to
not contain newlines. Also, the problems go away if you use
inputdisplay() in a gui.
To me it looks a bit like vim's implementation of input() has some
buffer overflow that causes problems *much* later. Bad, _bad_ thing.
> There seems to be a fix in svn for your problem according to the log message:
> http://vim-latex.svn.sourceforge.net/viewvc/vim-latex?view=rev&revision=1013
This log message says:
> Bug: In vim7, 'exe pos' doesn't seem to always work. Sometimes it leads to
> a spurious double-quote being inserted into the text. I have no idea
> why this happens. However, using vim's native setpos() when available
> seems to not have this problem.
While using setpos() instead of exe pos obviously doesn't trigger the
problem any more, this might turn up any time again, as vim-latex uses
input() with \n constantly. Therefore I wouldn't consider this bug fixed
yet, even if it's working at the moment.
This should probably be investigated by a more experienced vim-latex
developer, and if it's indeed a bug in input(), it needs to be fixed
upstream. I'll leave the upstream reporting in the capable hands of the
aforementioned experienced vim-latex developer ;)
Cheers,
Alex
|