diff options
| -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) |
