From 9c06f34ef964f470c16b5451e886843e4e775a1b Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Wed, 15 Jun 2005 07:18:30 +0000 Subject: [PATCH] more miscellaneous minor fixes git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2671 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 2 ++ src/chars.c | 3 +-- src/files.c | 12 +++++------- src/nano.c | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8e330305..9235ed9b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -126,6 +126,8 @@ CVS code - - When displaying "(dir)" in the available screen space, make sure that the string it's stored in is always null-terminated. (DLR) + - Rename variable selectedbackup to old_selected, for + consistency. (DLR) save_history() - Properly save history when in view mode. (DLR) - global.c: diff --git a/src/chars.c b/src/chars.c index e35a06f4..23373ded 100644 --- a/src/chars.c +++ b/src/chars.c @@ -118,8 +118,7 @@ bool is_cntrl_char(int c) * set. */ bool is_cntrl_wchar(wint_t wc) { - return (-128 <= wc && wc < -96) || (0 <= wc && wc < 32) || - (127 <= wc && wc < 160); + return (0 <= wc && wc < 32) || (127 <= wc && wc < 160); } #endif diff --git a/src/files.c b/src/files.c index 183bbe26..6e28b88c 100644 --- a/src/files.c +++ b/src/files.c @@ -2397,25 +2397,23 @@ char **browser_init(const char *path, int *longest, size_t *numents, DIR { const struct dirent *nextdir; char **filelist; - size_t i, path_len; + size_t i = 0, path_len; assert(dir != NULL); *longest = 0; - i = 0; - while ((nextdir = readdir(dir)) != NULL) { size_t dlen; - /* Don't show the . entry. */ + /* Don't show the "." entry. */ if (strcmp(nextdir->d_name, ".") == 0) continue; i++; dlen = strlenpt(nextdir->d_name); if (dlen > *longest) - *longest = dlen; + *longest = (dlen > COLS - 1) ? COLS - 1 : dlen; } *numents = i; @@ -2527,7 +2525,7 @@ char *do_browser(char *path, DIR *dir) /* If we clicked in the edit window, we probably clicked * on a file. */ if (wenclose(edit, mevent.y, mevent.x)) { - int selectedbackup = selected; + int old_selected = selected; mevent.y -= 2; @@ -2547,7 +2545,7 @@ char *do_browser(char *path, DIR *dir) * this name! */ if (selected > numents - 1) selected = numents - 1; - else if (selectedbackup == selected) + else if (old_selected == selected) /* Put back the 'select' key. */ unget_kbinput('s', FALSE, FALSE); } else { diff --git a/src/nano.c b/src/nano.c index 351b93ad..197ca565 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1809,7 +1809,7 @@ bool do_wrap(filestruct *line) next_line = line->next->data; next_line_len = strlen(next_line); - if ((after_break_len + next_line_len) <= fill) { + if (after_break_len + next_line_len <= fill) { wrapping = TRUE; new_line_len += next_line_len; } -- 2.39.5