diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2015-11-23 12:45:23 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2015-11-23 14:18:27 +0100 |
| commit | 6aa9342c60d4faa0510264f7a51e1b753704fc2b (patch) | |
| tree | 37b94d34609a1b6d6e94fe071501c784efe9cf31 | |
| parent | c4d675a2c600aaceb5f11644fdac8692f048ff22 (diff) | |
| download | vis-6aa9342c60d4faa0510264f7a51e1b753704fc2b.tar.gz vis-6aa9342c60d4faa0510264f7a51e1b753704fc2b.tar.xz | |
vis: use file open dialog for all directories
| -rw-r--r-- | vis-cmds.c | 8 | ||||
| -rwxr-xr-x | vis-open | 1 |
2 files changed, 7 insertions, 2 deletions
@@ -344,8 +344,12 @@ static bool cmd_set(Vis *vis, Filerange *range, enum CmdOpt cmdopt, const char * } static bool is_file_pattern(const char *pattern) { - return pattern && (strcmp(pattern, ".") == 0 || strchr(pattern, '*') || - strchr(pattern, '[') || strchr(pattern, '{')); + if (!pattern) + return false; + struct stat meta; + if (stat(pattern, &meta) == 0 && S_ISDIR(meta.st_mode)) + return true; + return strchr(pattern, '*') || strchr(pattern, '[') || strchr(pattern, '{'); } static const char *file_open_dialog(Vis *vis, const char *pattern) { @@ -32,6 +32,7 @@ if ! type "$VIS_MENU" >/dev/null 2>&1; then fi DIR="" +[ ! -z "$PATTERN" -a "$PATTERN" != "." -a -d "$PATTERN" ] && DIR="$PATTERN" while true; do SEL=$({ echo ..; ls -1 $PATTERN; } | $VIS_MENU $VIS_MENU_ARGS) |
