vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 5296f94cd259520647d8a8c341a0c609ca1d0aa9
parent 1aecebb6478ee1929ce00e19e2403c707796f5a3
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Thu,  1 Oct 2020 20:46:27 +0200

text: make text_snapshot return whether it succeeded

Currently this can't fail, but one can imagine implementations which do.

Diffstat:
Mtext.c | 3++-
Mtext.h | 2+-
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/text.c b/text.c @@ -1341,11 +1341,12 @@ bool text_delete_range(Text *txt, const Filerange *r) { /* preserve the current text content such that it can be restored by * means of undo/redo operations */ -void text_snapshot(Text *txt) { +bool text_snapshot(Text *txt) { if (txt->current_revision) txt->last_revision = txt->current_revision; txt->current_revision = NULL; txt->cache = NULL; + return true; } diff --git a/text.h b/text.h @@ -166,7 +166,7 @@ bool text_appendf(Text*, const char *format, ...) __attribute__((format(printf, /** * Create a text snapshot, that is a vertice in the history graph. */ -void text_snapshot(Text*); +bool text_snapshot(Text*); /** * Revert to previous snapshot along the main branch. * @rst