summaryrefslogtreecommitdiff
path: root/ted.h
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-01-30 11:52:25 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-01-30 11:52:25 -0500
commita61d90c32d4d6448148894872ebd91eb8f10fc2e (patch)
tree44d24f9b86064ba6ff706e4700865ebea65521a2 /ted.h
parent55fd631d86769e719f81206901bc1c3fb598fb5e (diff)
warn when closing tab with unsaved changes
Diffstat (limited to 'ted.h')
-rw-r--r--ted.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/ted.h b/ted.h
index 6271a6d..74b5145 100644
--- a/ted.h
+++ b/ted.h
@@ -79,7 +79,8 @@ typedef struct {
ENUM_U16 {
MENU_NONE,
MENU_OPEN,
- MENU_SAVE_AS
+ MENU_SAVE_AS,
+ MENU_WARN_UNSAVED // warn about unsaved changes
} ENUM_U16_END(Menu);
// file entries for file selectors
@@ -139,6 +140,8 @@ typedef struct Ted {
KeyAction key_actions[KEY_COMBO_COUNT];
bool search_cwd; // should the working directory be searched for files? set to true if the executable isn't "installed"
bool quit; // if set to true, the window will close next frame. NOTE: this doesn't check for unsaved changes!!
+ Command warn_unsaved; // if non-zero, the user is trying to execute this command, but there are unsaved changes
+ char warn_unsaved_names[TED_PATH_MAX]; // comma-separated list of files with unsaved changes (only applicable if warn_unsaved != 0)
char warn_overwrite[TED_PATH_MAX]; // file name user is trying to overwrite
char local_data_dir[TED_PATH_MAX];
char global_data_dir[TED_PATH_MAX];
@@ -151,3 +154,6 @@ typedef struct Ted {
char error[512];
char error_shown[512]; // error display in box on screen
} Ted;
+
+// forward declarations
+void command_execute(Ted *ted, Command c, i64 argument);