summaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/buffer.c b/buffer.c
index 3f94cf1..a33cfad 100644
--- a/buffer.c
+++ b/buffer.c
@@ -229,6 +229,8 @@ u32 buffer_last_line_on_screen(TextBuffer *buffer) {
void buffer_set_undo_enabled(TextBuffer *buffer, bool enabled) {
buffer->store_undo_events = enabled;
+ if (!enabled)
+ buffer_clear_undo_redo(buffer);
}
Rect buffer_rect(TextBuffer *buffer) {
@@ -2234,10 +2236,11 @@ bool buffer_change_number_at_pos(TextBuffer *buffer, BufferPos *ppos, i64 by) {
return ret;
}
-void buffer_change_number_at_cursor(TextBuffer *buffer, i64 by) {
+bool buffer_change_number_at_cursor(TextBuffer *buffer, i64 by) {
buffer_start_edit_chain(buffer);
- buffer_change_number_at_pos(buffer, &buffer->cursor_pos, by);
+ bool ret = buffer_change_number_at_pos(buffer, &buffer->cursor_pos, by);
buffer_end_edit_chain(buffer);
+ return ret;
}
// decrease the number of lines in the buffer.