in input_tab(), if the tab-completed path is a directory, make sure
enough space is allocated before tacking a slash onto the end of it git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3900 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
8c9256a731
commit
98bca94758
|
@ -8,6 +8,9 @@ CVS code -
|
||||||
- Since the field precision operator used in the sprintf() uses
|
- Since the field precision operator used in the sprintf() uses
|
||||||
ints and not size_t's, replace it with two strncpy()s, which
|
ints and not size_t's, replace it with two strncpy()s, which
|
||||||
use size_t's. (DLR)
|
use size_t's. (DLR)
|
||||||
|
- If the tab-completed path is a directory, make sure enough
|
||||||
|
space is allocated before tacking a slash onto the end of it.
|
||||||
|
(DLR)
|
||||||
- help.c:
|
- help.c:
|
||||||
parse_help_input()
|
parse_help_input()
|
||||||
- Add 'E' and 'e' as aliases for Exit, for consistency with the
|
- Add 'E' and 'e' as aliases for Exit, for consistency with the
|
||||||
|
|
|
@ -2240,18 +2240,19 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool
|
||||||
|
|
||||||
mzero = charalloc(lastslash_len + common_len + 1);
|
mzero = charalloc(lastslash_len + common_len + 1);
|
||||||
|
|
||||||
/*sprintf(mzero, "%.*s%.*s", lastslash_len, buf, common_len,
|
|
||||||
matches[0]);*/
|
|
||||||
strncpy(mzero, buf, lastslash_len);
|
strncpy(mzero, buf, lastslash_len);
|
||||||
strncpy(mzero + lastslash_len, matches[0], common_len);
|
strncpy(mzero + lastslash_len, matches[0], common_len);
|
||||||
|
|
||||||
common_len += lastslash_len;
|
common_len += lastslash_len;
|
||||||
|
mzero[common_len] = '\0';
|
||||||
|
|
||||||
assert(common_len >= *place);
|
assert(common_len >= *place);
|
||||||
|
|
||||||
if (num_matches == 1 && is_dir(mzero)) {
|
if (num_matches == 1 && is_dir(mzero)) {
|
||||||
mzero[common_len] = '/';
|
|
||||||
common_len++;
|
common_len++;
|
||||||
|
mzero = charealloc(mzero, common_len + 1);
|
||||||
|
mzero[common_len - 1] = '/';
|
||||||
|
mzero[common_len] = '\0';
|
||||||
|
|
||||||
assert(common_len > *place);
|
assert(common_len > *place);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue