On 6/18/06, Yakov Lerner <[EMAIL PROTECTED]> wrote:
On 6/18/06, Bram Moolenaar <[EMAIL PROTECTED]> wrote:
>
> Yakov Lerner wrote:
>
> > > On 5/23/06, Zdenek Sekera <[EMAIL PROTECTED]> wrote:
> > > > create a file ~/.vimtest as follows:
> > > >
> > > > cat > .vimtest
> > > > set nocompatible
> > > > set readonly
> > > > <C-D>
> > > >
> > > > and execute (g)vim:
> > > >
> > > > vim .vimtest -u .vimtest
> > > >
> > > > try :set readonly? and you'll get 'noreadonly'.
> >
> > The buffer does exist when initfile is executed. The ':ls' in initfile 
shows it.
> > Adding more printouts to initfile shows interesting results:
> >
> > vim -u 1 1
> > ----------------- file called 1 ---------------
> > set nocompatible
> > ls
> > call input('before set readonly 111')
> > set readonly
> > set readonly?
> > ls
> > set readonly?
> > set readonly?
> > echo "&readonly=".&readonly
> > call input('after set readonly 222')
> > -----------------------------------------------------
> > In vim, ':verb set readonly?' shows that readonly is misteriously reset.
> > The output differs between vim6 and vim7.
> > --------------- vim7 output ------------------
> >   1 %    "1"                            line 1
> > before set readonly 111
> >   1 % =  "1"                            line 1
> >
> >
> > &readonly=1
> > after set readonly 222
> > ----------------------------------------
> > Note the missing output of ':set readonly?'!!! It prints neither
> > 'readonly' nor 'noreadonly'.
> > ----------------- vim6 output --------------------
> >
> >   1 %    "1"                            line 1
> > before set readonly 111
> >  before set readonly 111
> >   1 % =  "1"                            line 1
> >   readonly
> >   readonly
> > &readonly=1
> > after set readonly 222
> > -----------------------------------------------------
> >
> > Looks like a bug to me.
>
> For me the "readonly" output is there.  I don't know why you don't get it.
>
> The file is loaded after sourcing the file.  Try putting a getline(3) in
> your vim script.  You will see that the file is not loaded yet.  Thus
> the buffer exists but doesn't contain the file text yet.
>
> 'readonly' is set according to the file edited.  If you want to set it,
> you need to use something like:
>
>         vim file +"set readonly"
>
> The "+" arguments are done after loading the file.
>
> It was already like this in Vim 6.0.  I don't know why you say it
> differs between vim 6 and vim 7.

I say 'it differs' because it differs. For vim6, all 'readonly's appear
where they are supposed to be. For vim7 (taken today from svn, 7.0.17),
however, the output still has three 'readonly's missing ...
However at closer inspection, I found them lost-and-found 'readonly's
appearing after I exited vim, as if they were buffered
somewhere, and then flushed at vim's exit, misplaced.
Here is how it looks for me:

[EMAIL PROTECTED] src]$ ./vim -u /tmp/1 /tmp/1
                              <- 1st 'readonly' is missing here
  1 %    "/tmp/1"                       line 1
before set readonly 111
  1 % =  "/tmp/1"                       line 1
                               <- 2nd 'readonly' is missing here
                               <- 3rd 'readonly' is missing here
&readonly=1
Press ENTER or type command to continue
                               <- I pressed ZZ here to quit
  readonly  readonly  [EMAIL PROTECTED] src]$
  ^^^^^^^^^^^^^^^^^^^^^^^^^^
the three missing 'readonly's misteriously surfaced here,
only after vim quit! This is FedoraCore 5
Maybe it has to do with $TERM ? The TERM is xterm,
and terminal is xterm or konsole (same result):

In case you can't reproduce it, Bram, I' attaching the output
with all escape sequences. The output was taken using
    vim -u /tmp/1 /tmp/1 | tee >/tmp/output
It clearly shows how the three delayed 'readonly readonly readonly'
are printed *afer* vim uninitialized the "screen" mode.
I hope this helps to understand what happens.

Yakov
Yakov

Attachment: output_with_escape_sequences
Description: Binary data

Reply via email to