:view does not always set 'readonly'

18 views
Skip to first unread message

Andy Wokula

unread,
Jan 12, 2013, 9:13:32 AM1/12/13
to vim...@googlegroups.com
:view does not always set 'readonly':
:e somefile.txt
:split
:view

or
:e somefile.txt
:sview

Looks like a bug.

--
Andy

Christian Brabandt

unread,
Jan 12, 2013, 9:27:52 AM1/12/13
to vim...@googlegroups.com
Hi Andy!
That is on purpose. I don't know why

,----[ vim ex_docmd.c ]-
| else if (readonlymode && curbuf->b_nwindows == 1)
| {
| /* When editing an already visited buffer, 'readonly' won't be set
| * but the previous value is kept. With ":view" and ":sview" we
| * want the file to be readonly, except when another window is
| * editing the same buffer. */
| curbuf->b_p_ro = TRUE;
| }
`----


regards,
Christian
--
Machen Sie sich erst einmal unbeliebt, dann werden Sie auch ernst
genommen.
-- Konrad Adenauer

Tony Mechelynck

unread,
Jan 14, 2013, 12:11:06 AM1/14/13
to vim...@googlegroups.com
On 12/01/13 15:27, Christian Brabandt wrote:
> Hi Andy!
>
> On Sa, 12 Jan 2013, Andy Wokula wrote:
>
>> :view does not always set 'readonly':
>> :e somefile.txt
>> :split
>> :view
>>
>> or
>> :e somefile.txt
>> :sview
>>
>> Looks like a bug.
>
> That is on purpose. I don't know why
>
> ,----[ vim ex_docmd.c ]-
> | else if (readonlymode && curbuf->b_nwindows == 1)
> | {
> | /* When editing an already visited buffer, 'readonly' won't be set
> | * but the previous value is kept. With ":view" and ":sview" we
> | * want the file to be readonly, except when another window is
> | * editing the same buffer. */
> | curbuf->b_p_ro = TRUE;
> | }
> `----
>
>
> regards,
> Christian
>

'readonly' is a buffer-local option. Therefore it is not possible, when
editing a single file in more than one window, to have one of them
readonly and the other not.


Best regards,
Tony.
--
When more and more people are thrown out of work, unemployment
results.
-- Calvin Coolidge

Reply all
Reply to author
Forward
0 new messages