diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-04-15 16:37:27 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-04-15 16:37:27 +0200 |
| commit | 69c43ac9c75c3b3b07845942e9bcf24f78217239 (patch) | |
| tree | 64bf8bdcb114d6df9781a3aa33280cc97a530fe5 /vis-cmds.c | |
| parent | f50465312dbb7e8fcb2409aa691d1aea7a43c466 (diff) | |
| download | vis-69c43ac9c75c3b3b07845942e9bcf24f78217239.tar.gz vis-69c43ac9c75c3b3b07845942e9bcf24f78217239.tar.xz | |
vis: improve handling of ~ and environment variables when opening files
Diffstat (limited to 'vis-cmds.c')
| -rw-r--r-- | vis-cmds.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -251,7 +251,11 @@ static bool is_file_pattern(const char *pattern) { struct stat meta; if (stat(pattern, &meta) == 0 && S_ISDIR(meta.st_mode)) return true; - return strchr(pattern, '*') || strchr(pattern, '[') || strchr(pattern, '{'); + for (char special[] = "*?[{$~", *s = special; *s; s++) { + if (strchr(pattern, *s)) + return true; + } + return false; } static const char *file_open_dialog(Vis *vis, const char *pattern) { |
