Skip to content

Commit

Permalink
When using "Jump" with more than two splits, expand the transaction
Browse files Browse the repository at this point in the history
If there are more than two splits it may not be obvious why a transaction
has been selected in the basic register mode, so expand the transaction to
show the split that's in this register and also indicate which split was
followed to reach this transaction.
  • Loading branch information
nomis committed Jan 31, 2025
1 parent bdf7c36 commit ff9fbd8
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions gnucash/gnome/gnc-plugin-page-register.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4985,6 +4985,7 @@ gnc_plugin_page_register_cmd_jump (GSimpleAction *simple,
Account* account;
Account* leader;
Split* split;
gboolean multiple_splits = FALSE;

ENTER ("(action %p, page %p)", simple, page);

Expand Down Expand Up @@ -5043,6 +5044,7 @@ gnc_plugin_page_register_cmd_jump (GSimpleAction *simple,
Split* other_split = xaccSplitGetOtherSplit (split);
if (other_split == NULL)
{
multiple_splits = TRUE;
other_split = jump_multiple_splits (account, split);
}
if (other_split == NULL)
Expand Down Expand Up @@ -5105,11 +5107,30 @@ gnc_plugin_page_register_cmd_jump (GSimpleAction *simple,
gnc_main_window_open_page (GNC_MAIN_WINDOW (window), new_page);
gsr = gnc_plugin_page_register_get_gsr (new_page);

SplitRegister *new_page_reg = gnc_ledger_display_get_split_register (gsr->ledger);
gboolean jump_twice = FALSE;

/* Selecting the split (instead of just the transaction to open the "other"
* account) requires jumping a second time after expanding the transaction,
* in the basic and auto ledger modes.
*/
if (new_page_reg->style != REG_STYLE_JOURNAL)
jump_twice = TRUE;

/* Test for visibility of split */
if (gnc_split_reg_clear_filter_for_split (gsr, split))
gnc_plugin_page_register_clear_current_filter (GNC_PLUGIN_PAGE(new_page));

gnc_split_reg_jump_to_split (gsr, split);

if (multiple_splits && jump_twice)
{
/* Expand the transaction for the basic and auto ledger to identify the
* split in this register, but only if there are more than two splits.
*/
gnc_split_register_expand_current_trans (new_page_reg, TRUE);
gnc_split_reg_jump_to_split (gsr, split);
}
LEAVE (" ");
}

Expand Down

0 comments on commit ff9fbd8

Please sign in to comment.