aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ring.c6
-rw-r--r--src/ring.h3
2 files changed, 5 insertions, 4 deletions
diff --git a/src/ring.c b/src/ring.c
index a608a43..1fd39e9 100644
--- a/src/ring.c
+++ b/src/ring.c
@@ -118,7 +118,7 @@ teco_buffer_save(teco_buffer_t *ctx, const gchar *filename, GError **error)
*/
if (ctx == teco_ring_current && !teco_qreg_current)
undo__teco_interface_info_update_buffer(ctx);
- if (ctx->state == TECO_BUFFER_DIRTY_DUMPED) {
+ if (ctx->state >= TECO_BUFFER_DIRTY) {
g_autofree gchar *filename_recovery = teco_buffer_get_recovery(ctx);
g_unlink(filename_recovery);
/* on rubout, we do not restore the recovery file */
@@ -143,7 +143,7 @@ teco_buffer_save(teco_buffer_t *ctx, const gchar *filename, GError **error)
static inline void
teco_buffer_free(teco_buffer_t *ctx)
{
- if (ctx->state == TECO_BUFFER_DIRTY_DUMPED) {
+ if (ctx->state >= TECO_BUFFER_DIRTY) {
g_autofree gchar *filename_recovery = teco_buffer_get_recovery(ctx);
g_unlink(filename_recovery);
}
@@ -244,7 +244,7 @@ teco_ring_find_by_id(teco_int_t id)
static void
teco_ring_undirtify(void)
{
- if (teco_ring_current->state == TECO_BUFFER_DIRTY_DUMPED) {
+ if (teco_ring_current->state >= TECO_BUFFER_DIRTY) {
g_autofree gchar *filename_recovery = teco_buffer_get_recovery(teco_ring_current);
g_unlink(filename_recovery);
}
diff --git a/src/ring.h b/src/ring.h
index 8b8beaa..4624983 100644
--- a/src/ring.h
+++ b/src/ring.h
@@ -26,8 +26,9 @@
#include "list.h"
typedef enum {
+ /** buffer is freshly opened or saved */
TECO_BUFFER_CLEAN = 0,
- /** buffer modified */
+ /** buffer modified - if a recovery file already exists, it is outdated */
TECO_BUFFER_DIRTY,
/** buffer modified and recovery file already written */
TECO_BUFFER_DIRTY_DUMPED