diff options
author | Ron Yorston <rmy@pobox.com> | 2019-03-01 09:54:25 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2019-03-01 09:54:25 +0000 |
commit | 9e341902d55184668682ece2c774db62eadb5502 (patch) | |
tree | 484a094d256fd896304deaba1cec81edea1e274d /libbb | |
parent | 065ac35f8a9fb1470df67b67128559fd7e748a5e (diff) | |
download | busybox-w32-9e341902d55184668682ece2c774db62eadb5502.tar.gz busybox-w32-9e341902d55184668682ece2c774db62eadb5502.tar.bz2 busybox-w32-9e341902d55184668682ece2c774db62eadb5502.zip |
libbb: copy entire match during tab-completion
Because tab-completion is case-insensitive the matching text might
differ from what the user typed. Insert the whole of the matching
text, not just the tail. Thus:
$ cd doc<TAB>
now expands to:
$ cd Documents/
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/lineedit.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 0ec9baa5f..95f92aa75 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c | |||
@@ -1317,7 +1317,11 @@ static NOINLINE void input_tab(smallint *lastWasTab) | |||
1317 | /* save tail */ | 1317 | /* save tail */ |
1318 | strcpy(match_buf, &command_ps[cursor]); | 1318 | strcpy(match_buf, &command_ps[cursor]); |
1319 | /* add match and tail */ | 1319 | /* add match and tail */ |
1320 | #if ENABLE_PLATFORM_MINGW32 | ||
1321 | sprintf(&command_ps[cursor-match_pfx_len], "%s%s", chosen_match, match_buf); | ||
1322 | #else | ||
1320 | sprintf(&command_ps[cursor], "%s%s", chosen_match + match_pfx_len, match_buf); | 1323 | sprintf(&command_ps[cursor], "%s%s", chosen_match + match_pfx_len, match_buf); |
1324 | #endif | ||
1321 | command_len = strlen(command_ps); | 1325 | command_len = strlen(command_ps); |
1322 | /* new pos */ | 1326 | /* new pos */ |
1323 | pos = cursor + len_found - match_pfx_len; | 1327 | pos = cursor + len_found - match_pfx_len; |