summaryrefslogtreecommitdiff
path: root/ted.h
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-02-09 09:37:41 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-02-09 09:37:41 -0500
commitf9afc00d15f934d8509f3eeb7c62b01ca84ca204 (patch)
tree779ee27d67666fd3d99794bb37a2f086e06bee6b /ted.h
parent91c98a180acab2152f4c60070a4bac3a98d9d486 (diff)
improve buffer_unsaved_changes
so that making an edit then undoing it doesn't count as making a change
Diffstat (limited to 'ted.h')
-rw-r--r--ted.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/ted.h b/ted.h
index 5b8d5c6..7d7f7c7 100644
--- a/ted.h
+++ b/ted.h
@@ -131,11 +131,14 @@ typedef struct {
bool is_line_buffer; // "line buffers" are buffers which can only have one line of text (used for inputs)
bool selection;
bool store_undo_events; // set to false to disable undo events
- bool modified; // has the buffer been modified since it was loaded/saved?
+ // This is set to true whenever a change is made to the buffer, and never set to false by buffer_ functions.
+ // (Distinct from buffer_unsaved_changes)
+ bool modified;
float x1, y1, x2, y2;
u32 nlines;
u32 lines_capacity;
+ u32 undo_history_write_pos; // where in the undo history was the last write? used by buffer_unsaved_changes
u32 longest_line_on_screen; // length of the longest line on screen. used to determine how far right we can scroll.
// to cache syntax highlighting properly, it is important to keep track of the