diff --git a/ChangeLog b/ChangeLog index 8e330305afc77446bf5d427e73455d49cefb414c..9235ed9bdac607c9aa845fb6c8f75170aad41987 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 e35a06f467b4775b6a4793bf0414f154b4f63128..23373dede5379be6e4b89d5bdb4b48744df278da 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 183bbe2641e14f339ecca63fd06e99c6be7e0777..6e28b88c5a844a780d80837057ef5fbac3233aff 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 351b93ad4ccd3170a67f99fe51e6dd6d2f6b92bd..197ca5654e8030a825316771db6ae284b8630c92 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; }