allow browsing the directory during scanning

This commit is contained in:
Sergey Alirzaev 2020-02-27 02:19:05 +03:00
parent 8d58297328
commit 9682a488ef
No known key found for this signature in database
GPG key ID: D771E0A47DF51BA3
3 changed files with 12 additions and 3 deletions

View file

@ -259,6 +259,15 @@ void browse_draw() {
char *tmp; char *tmp;
int selected = 0, i; int selected = 0, i;
extern struct dir *root; /* root directory struct we're scanning */
if (pstate == ST_CALC) {
static bool open = false;
if (!open) {
dirlist_open(root);
open = true;
}
}
erase(); erase();
t = dirlist_get(0); t = dirlist_get(0);

View file

@ -31,7 +31,7 @@
#include <khashl.h> #include <khashl.h>
static struct dir *root; /* root directory struct we're scanning */ struct dir *root; /* root directory struct we're scanning */
static struct dir *curdir; /* directory item that we're currently adding items to */ static struct dir *curdir; /* directory item that we're currently adding items to */
static struct dir *orig; /* original directory, when refreshing an already scanned dir */ static struct dir *orig; /* original directory, when refreshing an already scanned dir */

View file

@ -52,7 +52,7 @@ static long lastupdate = 999;
static void screen_draw() { static void screen_draw() {
switch(pstate) { switch(pstate) {
case ST_CALC: dir_draw(); break; case ST_CALC: browse_draw(); break;
case ST_BROWSE: browse_draw(); break; case ST_BROWSE: browse_draw(); break;
case ST_HELP: help_draw(); break; case ST_HELP: help_draw(); break;
case ST_SHELL: shell_draw(); break; case ST_SHELL: shell_draw(); break;
@ -98,7 +98,7 @@ int input_handle(int wait) {
continue; continue;
} }
switch(pstate) { switch(pstate) {
case ST_CALC: return dir_key(ch); case ST_CALC: return browse_key(ch);
case ST_BROWSE: return browse_key(ch); case ST_BROWSE: return browse_key(ch);
case ST_HELP: return help_key(ch); case ST_HELP: return help_key(ch);
case ST_DEL: return delete_key(ch); case ST_DEL: return delete_key(ch);