summaryrefslogtreecommitdiff
path: root/src/buffer.hh
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/buffer.hh
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/buffer.hh')
-rw-r--r--src/buffer.hh9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/buffer.hh b/src/buffer.hh
index 0eb6a4f4..d8f18015 100644
--- a/src/buffer.hh
+++ b/src/buffer.hh
@@ -139,9 +139,9 @@ public:
void set_fs_timestamp(timespec ts);
void commit_undo_group();
- bool undo(size_t count = 1) noexcept;
- bool redo(size_t count = 1) noexcept;
- bool move_to(size_t history_id) noexcept;
+ bool undo(size_t count = 1);
+ bool redo(size_t count = 1);
+ bool move_to(size_t history_id);
size_t current_history_id() const noexcept;
size_t next_history_id() const noexcept { return m_next_history_id; }
@@ -218,6 +218,7 @@ public:
void on_registered();
void on_unregistered();
+ void throw_if_read_only() const;
private:
void on_option_changed(const Option& option) override;
@@ -272,7 +273,7 @@ private:
SafePtr<HistoryNode> m_last_save_history_cursor;
UndoGroup m_current_undo_group;
- void move_to(HistoryNode* history_node) noexcept;
+ void move_to(HistoryNode* history_node);
template<typename Func> HistoryNode* find_history_node(HistoryNode* node, const Func& func);