aboutsummaryrefslogtreecommitdiffstats
path: root/noice.c
diff options
context:
space:
mode:
authorsin <sin@2f30.org>2014-10-21 15:13:21 +0100
committersin <sin@2f30.org>2014-10-21 15:14:04 +0100
commit61bc5cd817ca25f2a1b2c3d10f739772376d1dbe (patch)
treee8f3d332e4e94cb72434c56e0d5f50110a22b862 /noice.c
parent58f897fead53d15621029d5f76a68500588a23af (diff)
downloadnoice-61bc5cd817ca25f2a1b2c3d10f739772376d1dbe.tar.gz
Add 'c' command to change into a destination directory by typing the path
Diffstat (limited to 'noice.c')
-rw-r--r--noice.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/noice.c b/noice.c
index b15a5ed..ba2774a 100644
--- a/noice.c
+++ b/noice.c
@@ -204,6 +204,7 @@ enum {
SEL_GOIN,
SEL_FLTR,
SEL_SH,
+ SEL_CD,
};
int
@@ -258,6 +259,8 @@ nextsel(int *cur, int max)
break;
case '!':
return SEL_SH;
+ case 'c':
+ return SEL_CD;
}
return 0;
@@ -604,6 +607,28 @@ nochange:
if (chdir(ipath) == -1)
printwarn();
break;
+ case SEL_CD:
+ /* Read target dir */
+ printmsg("");
+ move(LINES - 1, 0);
+ printw("chdir: ");
+ tmp = readln();
+ if (tmp == NULL) {
+ printmsg("");
+ goto nochange;
+ }
+ if (testopendir(tmp) == 0) {
+ printwarn();
+ goto nochange;
+ } else {
+ free(path);
+ path = strdup(tmp);
+ free(filter);
+ filter = strdup(ifilter); /* Reset filter */
+ DPRINTF_S(path);
+ cur = 0;
+ goto out;
+ }
}
}
Un proyecto texto-plano.xyz