summaryrefslogtreecommitdiff
path: root/ted.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-01-30 13:55:24 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-01-30 13:55:24 -0500
commited8a56cc65411b8d00e4a8a9366855ea101f2e27 (patch)
tree654f6c2f1a2241598c96d5755aa0c1088cb890cb /ted.c
parent2994bf93de60930af3855db7a230c27be77de4ef (diff)
better startup, informative message when nothing's open
Diffstat (limited to 'ted.c')
-rw-r--r--ted.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/ted.c b/ted.c
index bbb65d0..f5de990 100644
--- a/ted.c
+++ b/ted.c
@@ -173,6 +173,7 @@ static bool ted_open_file(Ted *ted, char const *filename) {
if (buffer_load_file(buffer, filename)) {
return true;
} else {
+ ted_seterr_to_buferr(ted, buffer);
node_tab_close(ted, ted->active_node, tab_idx);
ted_delete_buffer(ted, (u16)buffer_idx);
return false;
@@ -190,6 +191,7 @@ static bool ted_new_file(Ted *ted) {
if (!buffer_haserr(buffer)) {
return true;
} else {
+ ted_seterr_to_buferr(ted, buffer);
node_tab_close(ted, ted->active_node, tab_idx);
ted_delete_buffer(ted, (u16)buffer_idx);
return false;
@@ -219,18 +221,6 @@ static void ted_switch_to_buffer(Ted *ted, u16 buffer_idx) {
assert(0);
}
-// are there any unsaved changes in any buffers?
-static bool ted_any_unsaved_changes(Ted *ted) {
- bool *buffers_used = ted->buffers_used;
- for (u16 i = 0; i < TED_MAX_BUFFERS; ++i) {
- if (buffers_used[i]) {
- if (buffer_unsaved_changes(&ted->buffers[i]))
- return true;
- }
- }
- return false;
-}
-
// save all changes to all buffers with unsaved changes.
// returns true if all buffers were saved successfully
static bool ted_save_all(Ted *ted) {