Fix readonly behaviour
Make readonly specified on startup only apply to files provided on the command line, and use the correct scope in `edit -readonly` Fixes #4278
This commit is contained in:
parent
c1e8f57bd6
commit
e454b393cf
|
@ -395,7 +395,7 @@ void edit(const ParametersParser& parser, Context& context, const ShellContext&)
|
|||
if (parser.get_switch("readonly"))
|
||||
{
|
||||
buffer->flags() |= Buffer::Flags::ReadOnly;
|
||||
buffer->options()["readonly"].set(true);
|
||||
buffer->options().get_local_option("readonly").set(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -781,8 +781,6 @@ int run_server(StringView session, StringView server_init,
|
|||
}
|
||||
#endif
|
||||
|
||||
GlobalScope::instance().options().get_local_option("readonly").set<bool>(flags & ServerFlags::ReadOnly);
|
||||
|
||||
bool startup_error = false;
|
||||
if (not (flags & ServerFlags::IgnoreKakrc)) try
|
||||
{
|
||||
|
@ -824,7 +822,10 @@ int run_server(StringView session, StringView server_init,
|
|||
{
|
||||
Buffer *buffer = open_or_create_file_buffer(file);
|
||||
if (flags & ServerFlags::ReadOnly)
|
||||
{
|
||||
buffer->flags() |= Buffer::Flags::ReadOnly;
|
||||
buffer->options().get_local_option("readonly").set(true);
|
||||
}
|
||||
}
|
||||
catch (runtime_error& error)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user