aboutsummaryrefslogtreecommitdiff
path: root/view.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2017-07-08 12:27:51 +0200
committerMarc André Tanner <mat@brain-dump.org>2017-07-08 13:01:34 +0200
commit4bbaf4f6aeace4be25089e8b370ecb6944c99523 (patch)
treebdba881f239df1d9fecf7af3a213db557104e7a9 /view.c
parentad10da5cc094204eb6f319841ab73246b689abb4 (diff)
downloadvis-4bbaf4f6aeace4be25089e8b370ecb6944c99523.tar.gz
vis-4bbaf4f6aeace4be25089e8b370ecb6944c99523.tar.xz
view: keep but clear primary selection if instructed to replace all
Previously the last selection was kept implicitly to statisfy the invariant that at least one selection needs to exist.
Diffstat (limited to 'view.c')
-rw-r--r--view.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/view.c b/view.c
index e1a6c5e..557a758 100644
--- a/view.c
+++ b/view.c
@@ -1260,7 +1260,10 @@ void view_selections_set_all(View *view, Array *arr, bool anchored) {
if (!(r = array_get(arr, i++)) || !view_selections_set(s, r)) {
for (Selection *next; s; s = next) {
next = view_selections_next(s);
- view_selections_dispose(s);
+ if (i == 1 && s == view->selection)
+ view_selection_clear(s);
+ else
+ view_selections_dispose(s);
}
break;
}