more miscellaneous minor fixes

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2541 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2005-05-26 03:32:41 +00:00
parent 8b3266e83c
commit 16f88134f7
3 changed files with 17 additions and 6 deletions

View File

@ -52,6 +52,9 @@ CVS code -
do_browser()
- Don't treat NANO_CANCEL_KEY as NANO_EXIT_KEY anymore, for
consistency. (DLR)
- When displaying "(dir)" in the available screen space, make
sure that the string it's stored in is always null-terminated.
(DLR)
save_history()
- Properly save history when in view mode. (DLR)
- global.c:
@ -81,6 +84,9 @@ CVS code -
since the first line in the file is 1. (DLR)
- Start the search for a line from fileage instead of current
(again). (DLR)
replace_line()
- Make new_line_size and search_match_count size_t's, for
consistency. (DLR)
- utils.c:
num_of_digits()
- Use a size_t instead of an int, and rename to digits(). (DLR)

View File

@ -2204,6 +2204,7 @@ char *input_tab(char *buf, size_t *place, bool *lastwastab, bool *list)
if (num_matches == 1 && is_dir(mzero)) {
mzero[common_len] = '/';
common_len++;
assert(common_len > *place);
}
@ -2266,8 +2267,9 @@ char *input_tab(char *buf, size_t *place, bool *lastwastab, bool *list)
wmove(edit, editline, (longest_name + 2) *
(match % columns));
if (match % columns == 0 && editline == editwinrows - 1
&& num_matches - match > columns) {
if (match % columns == 0 &&
editline == editwinrows - 1 &&
num_matches - match > columns) {
waddstr(edit, _("(more)"));
break;
}
@ -2321,6 +2323,7 @@ void free_charptrarray(char **array, size_t len)
{
for (; len > 0; len--)
free(array[len - 1]);
free(array);
}
@ -2332,6 +2335,7 @@ void striponedir(char *path)
assert(path != NULL);
tmp = strrchr(path, '/');
if (tmp != NULL)
*tmp = '\0';
}
@ -2718,9 +2722,10 @@ char *do_browser(char *path, DIR *dir)
foo[foo_len] = '\0';
} else
strcpy(foo, "--");
} else if (S_ISDIR(st.st_mode))
} else if (S_ISDIR(st.st_mode)) {
strncpy(foo, _("(dir)"), foo_len);
else if (st.st_size < (1 << 10)) /* less than 1 k. */
foo[foo_len] = '\0';
} else if (st.st_size < (1 << 10)) /* less than 1 k. */
sprintf(foo, "%4u B", (unsigned int)st.st_size);
else if (st.st_size < (1 << 20)) /* less than 1 meg. */
sprintf(foo, "%4u KB",

View File

@ -628,8 +628,7 @@ int replace_regexp(char *string, bool create_flag)
char *replace_line(const char *needle)
{
char *copy;
int new_line_size;
int search_match_count;
size_t new_line_size, search_match_count;
/* Calculate the size of the new line. */
#ifdef HAVE_REGEX_H
@ -661,6 +660,7 @@ char *replace_line(const char *needle)
/* The tail of the original line. */
assert(current_x + search_match_count <= strlen(current->data));
strcat(copy, current->data + current_x + search_match_count);
return copy;