summaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-01-27 16:51:27 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-01-27 16:51:27 -0500
commitf02fa3b6e1f6c3b1c1325b999f101b5ca6e02558 (patch)
tree19372b99cef17f6312454688d5e115c10aff3ac9 /buffer.c
parent710ea4ef8ca812aa4f0334f93c25fd9995a8e364 (diff)
started warn on overwrite
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/buffer.c b/buffer.c
index 5f6faec..3a808c7 100644
--- a/buffer.c
+++ b/buffer.c
@@ -94,6 +94,7 @@ void buffer_create(TextBuffer *buffer, Ted *ted) {
buffer->ted = ted;
}
+
void line_buffer_create(TextBuffer *buffer, Ted *ted) {
buffer_create(buffer, ted);
buffer->is_line_buffer = true;
@@ -120,6 +121,11 @@ static bool buffer_pos_valid(TextBuffer *buffer, BufferPos p) {
return p.line < buffer->nlines && p.index <= buffer->lines[p.line].len;
}
+// are there any unsaved changes?
+bool buffer_unsaved_changes(TextBuffer *buffer) {
+ return buffer->modified;
+}
+
// code point at position.
// returns 0 if the position is invalid. note that it can also return 0 for a valid position, if there's a null character there
char32_t buffer_char_at_pos(TextBuffer *buffer, BufferPos p) {