mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-25 06:09:38 +03:00
in input_tab(), disable completion of usernames, directories, and
filenames if the cursor isn't at the end of the line, as it can lead to odd behavior (e.g. adding a copy of the entire match to the middle of the line instead of just the uncompleted part of the match) git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4176 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
6e6c80b181
commit
4821ac645f
@ -9,6 +9,11 @@
|
||||
* files.c (cwd_tab_completion): Remove unneeded assert.
|
||||
* files.c (username_tab_completion, cwd_tab_completion): Rename
|
||||
variable buflen to buf_len, for consistency.
|
||||
* files.c (input_tab): Disable completion of usernames,
|
||||
directories, and filenames if the cursor isn't at the end of the
|
||||
line, as it can lead to odd behavior (e.g. adding a copy of the
|
||||
entire match to the middle of the line instead of just the
|
||||
uncompleted part of the match).
|
||||
|
||||
2007-10-05 David Lawrence Ramsey <pooka109@gmail.com>
|
||||
|
||||
|
@ -2287,7 +2287,7 @@ char **cwd_tab_completion(const char *buf, bool allow_files, size_t
|
||||
char *input_tab(char *buf, bool allow_files, size_t *place, bool
|
||||
*lastwastab, void (*refresh_func)(void), bool *list)
|
||||
{
|
||||
size_t num_matches = 0;
|
||||
size_t num_matches = 0, buf_len;
|
||||
char **matches = NULL;
|
||||
|
||||
assert(buf != NULL && place != NULL && *place <= strlen(buf) && lastwastab != NULL && refresh_func != NULL && list != NULL);
|
||||
@ -2309,7 +2309,9 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool
|
||||
matches = cwd_tab_completion(buf, allow_files, &num_matches,
|
||||
*place);
|
||||
|
||||
if (num_matches == 0)
|
||||
buf_len = strlen(buf);
|
||||
|
||||
if (num_matches == 0 || *place != buf_len)
|
||||
beep();
|
||||
else {
|
||||
size_t match, common_len = 0;
|
||||
@ -2368,8 +2370,6 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool
|
||||
* twice in succession with no statusbar changes to see a match
|
||||
* list. */
|
||||
if (common_len != *place) {
|
||||
size_t buf_len = strlen(buf);
|
||||
|
||||
*lastwastab = FALSE;
|
||||
buf = charealloc(buf, common_len + buf_len - *place + 1);
|
||||
charmove(buf + common_len, buf + *place, buf_len -
|
||||
|
Loading…
Reference in New Issue
Block a user