summaryrefslogtreecommitdiff
path: root/src/main.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2021-08-22 22:59:16 +1000
committerMaxime Coste <mawww@kakoune.org>2021-08-22 22:59:16 +1000
commite454b393cfaa69d270dda842b40d9c8fc3d672e6 (patch)
tree4a0c58c24a57bd9d78331e24503d70e9f51abe74 /src/main.cc
parentc1e8f57bd6db26361e9e0522ff464d5720096946 (diff)
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
Diffstat (limited to 'src/main.cc')
-rw-r--r--src/main.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main.cc b/src/main.cc
index fb0b165b..f3a4aef9 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -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)
{