File src/cmd_handlers.c changed (mode: 100644) (index 60bb01ff6..b1395d1a9) |
... |
... |
make_bmark_path(const char path[]) |
2077 |
2077 |
static int |
static int |
2078 |
2078 |
compare_cmd(const cmd_info_t *cmd_info) |
compare_cmd(const cmd_info_t *cmd_info) |
2079 |
2079 |
{ |
{ |
2080 |
|
int in_compare = cv_compare(curr_view->custom.type); |
|
2081 |
|
|
|
2082 |
|
if(cmd_info->emark && !in_compare) |
|
|
2080 |
|
int is_toggling = cmd_info->emark; |
|
2081 |
|
if(is_toggling && !cv_compare(curr_view->custom.type)) |
2083 |
2082 |
{ |
{ |
2084 |
2083 |
ui_sb_err("Toggling requires active compare view"); |
ui_sb_err("Toggling requires active compare view"); |
2085 |
2084 |
return CMDS_ERR_CUSTOM; |
return CMDS_ERR_CUSTOM; |
|
... |
... |
compare_cmd(const cmd_info_t *cmd_info) |
2087 |
2086 |
|
|
2088 |
2087 |
CompareType ct = CT_CONTENTS; |
CompareType ct = CT_CONTENTS; |
2089 |
2088 |
ListType lt = LT_ALL; |
ListType lt = LT_ALL; |
2090 |
|
int flags = (in_compare ? CF_NONE : CF_GROUP_PATHS); |
|
|
2089 |
|
int flags = (is_toggling ? CF_NONE : CF_GROUP_PATHS); |
2091 |
2090 |
if(parse_compare_properties(cmd_info, &ct, <, &flags) != 0) |
if(parse_compare_properties(cmd_info, &ct, <, &flags) != 0) |
2092 |
2091 |
{ |
{ |
2093 |
2092 |
return CMDS_ERR_CUSTOM; |
return CMDS_ERR_CUSTOM; |
2094 |
2093 |
} |
} |
2095 |
2094 |
|
|
2096 |
|
if(in_compare) |
|
|
2095 |
|
if(is_toggling) |
2097 |
2096 |
{ |
{ |
2098 |
2097 |
struct cv_data_t *cv = &curr_view->custom; |
struct cv_data_t *cv = &curr_view->custom; |
2099 |
2098 |
return (compare_two_panes(cv->diff_cmp_type, cv->diff_list_type, |
return (compare_two_panes(cv->diff_cmp_type, cv->diff_list_type, |
File tests/commands/misc.c changed (mode: 100644) (index ddeca6ccb..e0a369255) |
... |
... |
TEST(compare) |
350 |
350 |
assert_int_equal(CV_REGULAR, lwin.custom.type); |
assert_int_equal(CV_REGULAR, lwin.custom.type); |
351 |
351 |
rn_leave(&lwin, /*levels=*/1); |
rn_leave(&lwin, /*levels=*/1); |
352 |
352 |
|
|
|
353 |
|
/* Can't toggle without !. */ |
|
354 |
|
(void)cmds_dispatch("compare byname", &lwin, CIT_COMMAND); |
|
355 |
|
assert_int_equal(CF_GROUP_PATHS | CF_SHOW, lwin.custom.diff_cmp_flags); |
|
356 |
|
(void)cmds_dispatch("compare showdifferent", &lwin, CIT_COMMAND); |
|
357 |
|
assert_int_equal(CF_GROUP_PATHS | CF_SHOW, lwin.custom.diff_cmp_flags); |
|
358 |
|
rn_leave(&lwin, /*levels=*/1); |
|
359 |
|
|
353 |
360 |
/* No toggling. */ |
/* No toggling. */ |
354 |
361 |
(void)cmds_dispatch("compare! showdifferent", &lwin, CIT_COMMAND); |
(void)cmds_dispatch("compare! showdifferent", &lwin, CIT_COMMAND); |
355 |
362 |
assert_string_equal("Toggling requires active compare view", ui_sb_last()); |
assert_string_equal("Toggling requires active compare view", ui_sb_last()); |