#define exitcurses() endwin()
#define printwarn(presel) printwait(strerror(errno), presel)
#define istopdir(path) ((path)[1] == '\0' && (path)[0] == '/')
-#define copycurname() xstrsncpy(lastname, pdents[cur].name, NAME_MAX + 1)
+#define copycurname() xstrsncpy(lastname, ndents ? pdents[cur].name : "\0", NAME_MAX + 1)
#define settimeout() timeout(1000)
#define cleartimeout() timeout(-1)
#define errexit() printerr(__LINE__)
ln[REGEX_MAX - 1] = ln[1];
/* Save current */
- if (ndents)
- copycurname();
+ copycurname();
curs_set(FALSE);
settimeout();
/* Start watching the directory */
watch = TRUE;
-
- if (ndents)
- copycurname();
+ copycurname();
goto begin;
}
} else {
if (cfg.filtermode || filterset())
presel = FILTER;
- if (ndents)
- copycurname();
+ copycurname();
goto nochange;
}
#endif
presel = FILTER;
clearfilter();
}
- if (ndents)
- copycurname();
+ copycurname();
goto begin;
case SEL_DETAIL:
cfg.showdetail ^= 1;
g_state.autonext ^= 1;
if (cfg.filtermode)
presel = FILTER;
- if (ndents)
- copycurname();
+ copycurname();
goto nochange;
case SEL_EDIT:
spawn(editor, newpath, NULL, NULL, F_CLI);
}
/* Save current */
- if (ndents)
- copycurname();
+ copycurname();
/* Repopulate as directory content may have changed */
goto begin;
}
if (newpath[0] && !access(newpath, F_OK))
xstrsncpy(lastname, xbasename(newpath), NAME_MAX+1);
- else if (ndents)
+ else
copycurname();
goto begin;
}
if (g_state.picked)
return EXIT_SUCCESS;
- if (ndents)
- copycurname();
+ copycurname();
if (!r) {
cfg.filtermode ? presel = FILTER : statusbar(path);
presel = FILTER;
/* Save current */
- if (ndents)
- copycurname();
+ copycurname();
if (!r)
goto nochange;
idle = 0;
}
- if (ndents)
- copycurname();
-
+ copycurname();
goto nochange;
} /* switch (sel) */
}