diff options
Diffstat (limited to 'core/selection.cpp')
-rw-r--r-- | core/selection.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/core/selection.cpp b/core/selection.cpp index 92bb631fc..6b5dfe726 100644 --- a/core/selection.cpp +++ b/core/selection.cpp @@ -210,3 +210,16 @@ std::vector<dive *> getDiveSelection() } return res; } + +// Select the first dive that is visible +extern "C" void select_newest_visible_dive() +{ + for (int i = dive_table.nr - 1; i >= 0; --i) { + dive *d = dive_table.dives[i]; + if (!d->hidden_by_filter) + return setSelection({ d }, d); + } + + // No visible dive -> deselect all + setSelection({}, nullptr); +} |