summaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-02-01 12:45:37 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-02-01 12:45:37 -0500
commite53329668e403a6b73bc8c9b56ad6b55eecba4e9 (patch)
treeca87e777053112f5de53155374f2272d6aad0ca1 /buffer.c
parent11b50663dc489b7ec8cb1c8774d9bda2c7acac3b (diff)
fix C hex literal highlighting
also open to untitled empty buffer
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/buffer.c b/buffer.c
index 41dc216..9a0627f 100644
--- a/buffer.c
+++ b/buffer.c
@@ -52,6 +52,10 @@ char const *buffer_get_filename(TextBuffer *buffer) {
return buffer->filename;
}
+bool buffer_is_untitled(TextBuffer *buffer) {
+ return streq(buffer->filename, TED_UNTITLED);
+}
+
// clear all undo and redo events
void buffer_clear_undo_redo(TextBuffer *buffer) {
buffer_clear_undo_history(buffer);
@@ -132,7 +136,7 @@ static bool buffer_pos_valid(TextBuffer *buffer, BufferPos p) {
// are there any unsaved changes?
bool buffer_unsaved_changes(TextBuffer *buffer) {
- if (streq(buffer->filename, TED_UNTITLED) && buffer_empty(buffer))
+ if (buffer_is_untitled(buffer) && buffer_empty(buffer))
return false; // don't worry about empty untitled buffers
return buffer->modified;
}