| File src/cmd_completion.c changed (mode: 100644) (index f0df55363..a1cf3540a) |
| ... |
... |
path_completion(completion_data_t *data) |
| 417 |
417 |
} |
} |
| 418 |
418 |
else if(id == COM_SPLIT || id == COM_VSPLIT) |
else if(id == COM_SPLIT || id == COM_VSPLIT) |
| 419 |
419 |
{ |
{ |
| 420 |
|
data->start += filename_completion_in_dir(flist_get_dir(curr_view), arg, |
|
| 421 |
|
CT_DIRONLY); |
|
|
420 |
|
if(is_option(data->cmd_info) && arg[0] == '-') |
|
421 |
|
{ |
|
422 |
|
complete_option(id, arg); |
|
423 |
|
} |
|
424 |
|
else |
|
425 |
|
{ |
|
426 |
|
data->start += filename_completion_in_dir(flist_get_dir(curr_view), arg, |
|
427 |
|
CT_DIRONLY); |
|
428 |
|
} |
| 422 |
429 |
} |
} |
| 423 |
430 |
else if(id == COM_GREP) |
else if(id == COM_GREP) |
| 424 |
431 |
{ |
{ |
| |
| ... |
... |
complete_option(int cmd_id, const char str[]) |
| 1138 |
1145 |
{ "-skip", "skip files with conflicting names" }, |
{ "-skip", "skip files with conflicting names" }, |
| 1139 |
1146 |
}; |
}; |
| 1140 |
1147 |
|
|
|
1148 |
|
static const char *split_lines[][2] = { |
|
1149 |
|
{ "-focus", "change pane after splitting" }, |
|
1150 |
|
}; |
|
1151 |
|
|
| 1141 |
1152 |
const char *(*opts)[2]; |
const char *(*opts)[2]; |
| 1142 |
1153 |
int opt_count; |
int opt_count; |
| 1143 |
1154 |
switch(cmd_id) |
switch(cmd_id) |
| 1144 |
1155 |
{ |
{ |
|
1156 |
|
case COM_SPLIT: |
|
1157 |
|
case COM_VSPLIT: |
|
1158 |
|
opts = split_lines; |
|
1159 |
|
opt_count = ARRAY_LEN(split_lines); |
|
1160 |
|
break; |
|
1161 |
|
|
| 1145 |
1162 |
case COM_COPY: |
case COM_COPY: |
| 1146 |
1163 |
opts = lines; |
opts = lines; |
| 1147 |
1164 |
opt_count = 2; |
opt_count = 2; |
| File tests/commands/completion.c changed (mode: 100644) (index 4ad348a3f..24f369e2c) |
| ... |
... |
TEST(wingo_is_completed) |
| 675 |
675 |
cfg.shorten_title_paths = 0; |
cfg.shorten_title_paths = 0; |
| 676 |
676 |
} |
} |
| 677 |
677 |
|
|
|
678 |
|
TEST(split_vsplit_are_completed) |
|
679 |
|
{ |
|
680 |
|
/* Path. */ |
|
681 |
|
|
|
682 |
|
ASSERT_COMPLETION(L"split ", L"split a/"); |
|
683 |
|
ASSERT_NEXT_MATCH("b/"); |
|
684 |
|
|
|
685 |
|
ASSERT_COMPLETION(L"vsplit ", L"vsplit a/"); |
|
686 |
|
ASSERT_NEXT_MATCH("b/"); |
|
687 |
|
|
|
688 |
|
/* Option. */ |
|
689 |
|
|
|
690 |
|
ASSERT_COMPLETION(L"split -", L"split -focus"); |
|
691 |
|
ASSERT_NEXT_MATCH("-focus"); |
|
692 |
|
|
|
693 |
|
ASSERT_COMPLETION(L"vsplit -", L"vsplit -focus"); |
|
694 |
|
ASSERT_NEXT_MATCH("-focus"); |
|
695 |
|
|
|
696 |
|
/* Option, twice. */ |
|
697 |
|
|
|
698 |
|
ASSERT_COMPLETION(L"split -focus -", L"split -focus -focus"); |
|
699 |
|
ASSERT_NEXT_MATCH("-focus"); |
|
700 |
|
|
|
701 |
|
ASSERT_COMPLETION(L"vsplit -focus -", L"vsplit -focus -focus"); |
|
702 |
|
ASSERT_NEXT_MATCH("-focus"); |
|
703 |
|
|
|
704 |
|
/* Path after an option. */ |
|
705 |
|
|
|
706 |
|
ASSERT_COMPLETION(L"split -focus ", L"split -focus a/"); |
|
707 |
|
ASSERT_NEXT_MATCH("b/"); |
|
708 |
|
|
|
709 |
|
ASSERT_COMPLETION(L"vsplit -focus ", L"vsplit -focus a/"); |
|
710 |
|
ASSERT_NEXT_MATCH("b/"); |
|
711 |
|
|
|
712 |
|
/* Path after the option separator. */ |
|
713 |
|
|
|
714 |
|
ASSERT_COMPLETION(L"split -- ", L"split -- a/"); |
|
715 |
|
ASSERT_NEXT_MATCH("b/"); |
|
716 |
|
|
|
717 |
|
ASSERT_COMPLETION(L"vsplit -- ", L"vsplit -- a/"); |
|
718 |
|
ASSERT_NEXT_MATCH("b/"); |
|
719 |
|
} |
|
720 |
|
|
| 678 |
721 |
static void |
static void |
| 679 |
722 |
dummy_handler(OPT_OP op, optval_t val) |
dummy_handler(OPT_OP op, optval_t val) |
| 680 |
723 |
{ |
{ |