From 66fe2d84daa1ec72c2eb1385b1d8da705277403e Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 11 Feb 2018 13:06:19 +1100 Subject: 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. --- src/input_handler.cc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/input_handler.cc') 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()) - context().print_status({ "Warning: This buffer is readonly", - get_face("Error") }); } void on_enabled() override -- cgit v1.2.3