mirror of
https://github.com/mawww/kakoune.git
synced 2024-11-24 07:53:41 +03:00
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"))
|
if (parser.get_switch("readonly"))
|
||||||
{
|
{
|
||||||
buffer->flags() |= Buffer::Flags::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
|
#endif
|
||||||
|
|
||||||
GlobalScope::instance().options().get_local_option("readonly").set<bool>(flags & ServerFlags::ReadOnly);
|
|
||||||
|
|
||||||
bool startup_error = false;
|
bool startup_error = false;
|
||||||
if (not (flags & ServerFlags::IgnoreKakrc)) try
|
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);
|
Buffer *buffer = open_or_create_file_buffer(file);
|
||||||
if (flags & ServerFlags::ReadOnly)
|
if (flags & ServerFlags::ReadOnly)
|
||||||
|
{
|
||||||
buffer->flags() |= Buffer::Flags::ReadOnly;
|
buffer->flags() |= Buffer::Flags::ReadOnly;
|
||||||
|
buffer->options().get_local_option("readonly").set(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (runtime_error& error)
|
catch (runtime_error& error)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user