On Fri, Jun 10, 2011 at 11:53 PM, Bram Moolenaar <[email protected]> wrote:
>
> Jakson Aquino wrote:
>
>> On Thu, May 19, 2011 at 12:26 PM, Bram Moolenaar <[email protected]> wrote:
>> > Patch 7.3.196
>> > Problem: Can't intercept a character that is going to be inserted.
>> > Solution: Add the InsertCharPre autocommand event. (Jakson A. Aquino)
>> > Files: runtime/doc/autocmd.txt, runtime/doc/eval.txt,
>> > runtime/doc/map.txt, src/edit.c, src/eval.c, src/fileio.c,
>> > src/vim.h
>>
>> [...]
>>
>> When using the Conque Shell plugin with the patch 7.3.196 applied to
>> Vim I have to type very slowly in the Conque Term buffer because I get
>> the following error when I type in normal speed:
>>
>> Error detected while processing function conque_term#key_press:
>> line 1:
>> E523: Not allowed here
>> Press ENTER or type command to continue
>>
>> This error only happens if the text is locked (edit.c, lines 1394 and
>> 1415). I can type normally if I comment out these two lines.
>
> So what is line 1 in conque_term#key_press ?
sil exe s:py . ' ' . b:ConqueTerm_Var . ".write_ord(" . char2nr(v:char) . ")"
And 'write_ord' is:
def write_ord(self, input, set_cursor=True, read=True):
""" Write a single character to the subprocess, using an
unicode ordinal. """
if CONQUE_PYTHON_VERSION == 2:
self.write(unichr(input), set_cursor, read)
else:
self.write(chr(input), set_cursor, read)
And 'write' is:
def write(self, input, set_cursor=True, read=True):
""" Write a unicode string to the subprocess.
set_cursor -- Position the cursor in the current buffer when finished
read -- Check program for new output when finished
"""
# check if window size has changed
if read:
self.update_window_size()
# write and read
self.proc.write(input)
# read output immediately
if read:
self.read(1, set_cursor)
>> I only use the InsertCharPre event through the Conque Shell plugin. It
>> would be nice if other people could comment on the need of locking the
>> text since it doesn't seem to be necessary while using the Conque
>> Shell. I've written to Nico Raffo, the author of the plugin, to know
>> whether this problem could be fixed in the Conque Shell, but I didn't
>> get any answer yet.
>
> How come this function gets invoked from the InsertCharPre event?
autocmd InsertCharPre <buffer> call conque_term#key_press()
which is in ~/.vim/autoload/conque_term.vim
> The text is lockec because it may cause big problems. E.g. undo could
> be messed up. This doesn't depend on actualy use of the event but on
> what could possibly done with the event.
Thanks for the explanation!
Best regards,
Jakson Aquino
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php