Skip to content

Commit

Permalink
text: make text_snapshot return whether it succeeded
Browse files Browse the repository at this point in the history
Currently this can't fail, but one can imagine implementations which do.
  • Loading branch information
martanne committed Oct 10, 2020
1 parent 5461493 commit 5f1ade1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion text.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}


Expand Down
2 changes: 1 addition & 1 deletion text.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5f1ade1

Please sign in to comment.