Skip to content

Commit c23d8cd

Browse files
committed
When using "Jump" with more than two splits, expand the transaction
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 to indicate which split was followed to reach this transaction.
1 parent bdf7c36 commit c23d8cd

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

gnucash/gnome/gnc-plugin-page-register.cpp

+25-2
Original file line numberDiff line numberDiff line change
@@ -4985,6 +4985,8 @@ gnc_plugin_page_register_cmd_jump (GSimpleAction *simple,
49854985
Account* account;
49864986
Account* leader;
49874987
Split* split;
4988+
Split* other_split;
4989+
gboolean multiple_splits;
49884990

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

@@ -5013,6 +5015,9 @@ gnc_plugin_page_register_cmd_jump (GSimpleAction *simple,
50135015
return;
50145016
}
50155017

5018+
other_split = xaccSplitGetOtherSplit (split);
5019+
multiple_splits = other_split == NULL;
5020+
50165021
leader = gnc_ledger_display_leader (priv->ledger);
50175022
if (account == leader)
50185023
{
@@ -5040,8 +5045,7 @@ gnc_plugin_page_register_cmd_jump (GSimpleAction *simple,
50405045
return;
50415046
}
50425047

5043-
Split* other_split = xaccSplitGetOtherSplit (split);
5044-
if (other_split == NULL)
5048+
if (multiple_splits)
50455049
{
50465050
other_split = jump_multiple_splits (account, split);
50475051
}
@@ -5105,11 +5109,30 @@ gnc_plugin_page_register_cmd_jump (GSimpleAction *simple,
51055109
gnc_main_window_open_page (GNC_MAIN_WINDOW (window), new_page);
51065110
gsr = gnc_plugin_page_register_get_gsr (new_page);
51075111

5112+
SplitRegister *new_page_reg = gnc_ledger_display_get_split_register (gsr->ledger);
5113+
gboolean jump_twice = FALSE;
5114+
5115+
/* Selecting the split (instead of just the transaction to open the "other"
5116+
* account) requires jumping a second time after expanding the transaction,
5117+
* in the basic and auto ledger modes.
5118+
*/
5119+
if (new_page_reg->style != REG_STYLE_JOURNAL)
5120+
jump_twice = TRUE;
5121+
51085122
/* Test for visibility of split */
51095123
if (gnc_split_reg_clear_filter_for_split (gsr, split))
51105124
gnc_plugin_page_register_clear_current_filter (GNC_PLUGIN_PAGE(new_page));
51115125

51125126
gnc_split_reg_jump_to_split (gsr, split);
5127+
5128+
if (multiple_splits && jump_twice)
5129+
{
5130+
/* Expand the transaction for the basic and auto ledger to identify the
5131+
* split in this register, but only if there are more than two splits.
5132+
*/
5133+
gnc_split_register_expand_current_trans (new_page_reg, TRUE);
5134+
gnc_split_reg_jump_to_split (gsr, split);
5135+
}
51135136
LEAVE (" ");
51145137
}
51155138

0 commit comments

Comments
 (0)