cwd_tab_completion()
- Remove unneeded assert. (DLR)
- Rename variable buflen to buf_len, for consistency. (DLR)
+ 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). (DLR)
- nano.c:
version()
- Display copyright notices. (DLR)
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);
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;
* 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 -