mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 06:15:26 +00:00
Fix selection and trip expansion logic after merging dives
This just makes sure that the merged dive is properly selected, and that we've saved the trip tree state so that the dive list repaints nicely and with the newly merged dive selected after the merge. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
c0ebef92bf
commit
ba5079a489
2 changed files with 4 additions and 0 deletions
1
dive.c
1
dive.c
|
@ -1051,6 +1051,7 @@ struct dive *merge_dives(struct dive *a, struct dive *b, int offset)
|
|||
struct dive *res = alloc_dive();
|
||||
|
||||
res->when = a->when;
|
||||
res->selected = a->selected || b->selected;
|
||||
merge_trip(res, a, b);
|
||||
MERGE_NONZERO(res, a, b, latitude);
|
||||
MERGE_NONZERO(res, a, b, longitude);
|
||||
|
|
|
@ -1938,6 +1938,8 @@ void add_single_dive(int idx, struct dive *dive)
|
|||
{
|
||||
int i;
|
||||
dive_table.nr++;
|
||||
if (dive->selected)
|
||||
amount_selected++;
|
||||
for (i = idx; i < dive_table.nr ; i++) {
|
||||
struct dive *tmp = dive_table.dives[i];
|
||||
dive_table.dives[i] = dive;
|
||||
|
@ -2090,6 +2092,7 @@ static void merge_dive_index(int i, struct dive *a)
|
|||
if (!res)
|
||||
return;
|
||||
|
||||
remember_tree_state();
|
||||
add_single_dive(i, res);
|
||||
delete_single_dive(i+1);
|
||||
delete_single_dive(i+1);
|
||||
|
|
Loading…
Add table
Reference in a new issue