On Sun, 07 Jun 2009 09:25:42 +0800, Tony Mechelynck  
<[email protected]> wrote:

>
> On 04/06/09 11:15, Wu, Yue wrote:
>>
>> On Thu, 04 Jun 2009 15:34:05 +0800, Matt Wozniski wrote:
>>
>>>
>>> On Wed, Jun 3, 2009 at 6:54 PM, Wu, Yue wrote:
>>>>
>>>> On Thu, 04 Jun 2009 06:42:57 +0800, Gary Johnson wrote:
>>>>
>>>>> normal \<Esc>
>>>>
>>>> But it has limitation, hmm? when I use it in my script, vim warns:
>>>>
>>>>         E523: Not allowed here.
>>>>
>>>> Maybe it can't be used when vim in sandbox.
>>>
>>> That needs to be
>>>
>>> exe "normal! \<Esc>"
>>>
>>> afaics.  But, it ought to work in the sandbox....
>>>
>>
>> Still the same warning, what's wrong it could be?
>>
>
> Maybe the exception is raised by something which happens just before or
> just after that line?
>
>  From the help:
>> These items are not allowed in the sandbox:
>>      - changing the buffer text
>>      - defining or changing mapping, autocommands, functions, user commands
>>      - setting certain options (see |option-summary|)
>>      - setting certain v: variables (see |v:var|)  *E794*
>>      - executing a shell command
>>      - reading or writing a file
>>      - jumping to another buffer or editing a file
>>      - executing Python, Perl, etc. commands
>> This is not guaranteed 100% secure, but it should block most attacks.
>
> FWIW,
>
>       :sandbox normal! ^[
>
> (where ^[ is obtained by hittig Ctrl-V followed by Esc) gives me a beep,
> not an error message.
>
>
> Best regards,
> Tony.

Hmm,  my function is a little complicated(The script can be fetched from  
[1]),
so I can't give a minimum example(I have tried to create a small alike  
one, but
it works very well[2]...), sorry, but I can describe it, it works like  
this way,
it's a while loop, from the value got from getchar(), and when it's  
<space>,
then return "".  I have tried to add it just before the return line(L545  
in my
script), seems no work, always produce a E523 error, without it,  
everything is
ok, so error is from it. :(

[1] http://www.vim.org/scripts/script.php?script_id=2662

http://www.vim.org/scripts/download_script.php?src_id=10770

[2]
func! Ywbing()
     let a = ''
     while 1
         redraw!
         if a == 32
             normal! \<ESC>
             return ''
         endif
         let a = getchar()
     endwhile
endfunc

-- 
Hi,
Wu, Yue

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to