diff options
Diffstat (limited to 'src/ring.h')
| -rw-r--r-- | src/ring.h | 33 |
1 files changed, 27 insertions, 6 deletions
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2012-2025 Robin Haberkorn + * Copyright (C) 2012-2026 Robin Haberkorn * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,13 +25,29 @@ #include "parser.h" #include "list.h" +typedef enum { + /** buffer is freshly opened or saved */ + TECO_BUFFER_CLEAN = 0, + /** buffer modified, but a recovery file does not yet exist */ + TECO_BUFFER_DIRTY_NO_DUMP, + /** buffer modified, recovery file outdated */ + TECO_BUFFER_DIRTY_OUTDATED_DUMP, + /** buffer modified and recovery file is up to date */ + TECO_BUFFER_DIRTY_RECENT_DUMP +} teco_buffer_state_t; + typedef struct teco_buffer_t { teco_tailq_entry_t entry; teco_view_t *view; gchar *filename; - gboolean dirty; + + /** + * A teco_buffer_state_t. + * This is still a guint, so you can call teco_undo_guint(). + */ + guint state; } teco_buffer_t; /** @memberof teco_buffer_t */ @@ -67,9 +83,13 @@ teco_buffer_t *teco_ring_find_by_id(teco_int_t id); teco_int_t : teco_ring_find_by_id)(X)) void teco_ring_dirtify(void); -gboolean teco_ring_is_any_dirty(void); +guint teco_ring_get_first_dirty(void); gboolean teco_ring_save_all_dirty_buffers(GError **error); +extern guint teco_ring_recovery_interval; + +void teco_ring_dump_recovery(void); + gboolean teco_ring_edit_by_name(const gchar *filename, GError **error); gboolean teco_ring_edit_by_id(teco_int_t id, GError **error); @@ -86,7 +106,7 @@ teco_ring_undo_edit(void) teco_buffer_undo_edit(teco_ring_current); } -gboolean teco_ring_close(GError **error); +gboolean teco_ring_close(teco_buffer_t *buffer, GError **error); void teco_ring_undo_close(void); void teco_ring_set_scintilla_undo(gboolean state); @@ -97,8 +117,9 @@ void teco_ring_cleanup(void); * Command states */ -TECO_DECLARE_STATE(teco_state_edit_file); -TECO_DECLARE_STATE(teco_state_save_file); +extern teco_state_t teco_state_edit_file; +extern teco_state_t teco_state_save_file; +extern teco_state_t teco_state_read_file; void teco_state_ecommand_close(teco_machine_main_t *ctx, GError **error); |
