- 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:
* 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
{
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;
/* 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;
* 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 {
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;
}