Skip to content

Commit

Permalink
view: add return value to view_cursors_dispose
Browse files Browse the repository at this point in the history
indicating whether cursor could be removed
  • Loading branch information
martanne committed Apr 3, 2016
1 parent 1ea9a99 commit 4ad51b6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions view.c
Original file line number Diff line number Diff line change
Expand Up @@ -1183,15 +1183,16 @@ static void view_cursors_free(Cursor *c) {
free(c);
}

void view_cursors_dispose(Cursor *c) {
bool view_cursors_dispose(Cursor *c) {
if (!c)
return;
return false;
View *view = c->view;
if (view->cursors && view->cursors->next) {
view_selections_free(c->sel);
view_cursors_free(c);
view_draw(view);
}
if (!view->cursors || !view->cursors->next)
return false;
view_selections_free(c->sel);
view_cursors_free(c);
view_cursors_primary_set(view->cursor);
return true;
}

Cursor *view_cursors(View *view) {
Expand Down
2 changes: 1 addition & 1 deletion view.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ int view_cursors_count(View*);
bool view_cursors_multiple(View*);
/* dispose an existing cursor with its associated selection (if any),
* not applicaple for the last existing cursor */
void view_cursors_dispose(Cursor*);
bool view_cursors_dispose(Cursor*);
/* only keep the main cursor, release all others together with their
* selections (if any) */
void view_cursors_clear(View*);
Expand Down

0 comments on commit 4ad51b6

Please sign in to comment.