summaryrefslogtreecommitdiff
path: root/src/input_handler.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2018-02-11 13:06:19 +1100
committerMaxime Coste <mawww@kakoune.org>2018-02-11 13:06:19 +1100
commit66fe2d84daa1ec72c2eb1385b1d8da705277403e (patch)
tree5326fb976627721b564e3ee7e8126cd8dab9db19 /src/input_handler.cc
parent3584e00d19f542aa15a74fe411a3a7ddebd89037 (diff)
Refuse modification of ReadOnly buffers and make Debug buffer readonly
The debug buffer is a bit special as lots of events might mutate it, permitting it to be modified leads to some buggy behaviour: For example, `pipe` uses a ForwardChangeTracker to track buffer changes, but when applied on a debug buffer with the profile flag on, each shell execution will trigger an additional modification of the buffer while applying the changes, leading to an assertion failing as changes might not be happening in a forward way anymore. Trying to modify a debug buffer will now raise an error immediatly.
Diffstat (limited to 'src/input_handler.cc')
-rw-r--r--src/input_handler.cc7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/input_handler.cc b/src/input_handler.cc
index f8211a2e..3662e12f 100644
--- a/src/input_handler.cc
+++ b/src/input_handler.cc
@@ -1061,6 +1061,8 @@ public:
context().hooks().run_hook("InsertIdle", "", context());
}}
{
+ context().buffer().throw_if_read_only();
+
last_insert().recording.set();
last_insert().mode = mode;
last_insert().keys.clear();
@@ -1068,11 +1070,6 @@ public:
last_insert().count = count;
context().hooks().run_hook("InsertBegin", "", context());
prepare(mode, count);
-
- if (context().has_client() and
- context().options()["readonly"].get<bool>())
- context().print_status({ "Warning: This buffer is readonly",
- get_face("Error") });
}
void on_enabled() override