diff options
| author | Tim Allen <screwtape@froup.com> | 2016-05-25 20:09:15 +1000 |
|---|---|---|
| committer | Tim Allen <screwtape@froup.com> | 2016-05-28 17:49:51 +1000 |
| commit | 958dc002a077997358361d9bff7a245137307d78 (patch) | |
| tree | 039bb3285f05c44e3211250ea66e07472d2f6744 | |
| parent | 5e7122cf03f842b8afa098e18f97b968b6080214 (diff) | |
| download | vis-958dc002a077997358361d9bff7a245137307d78.tar.gz vis-958dc002a077997358361d9bff7a245137307d78.tar.xz | |
[vis-open] Handle filenames with spaces and tabs.
We still don't handle filenames that contain newlines, but we're
pressing against the limits of what portable POSIX shell can do. Besides
which, we're ultimately plumbing filenames into vis-menu which uses
newlines as a delimiter *anyway*, so there's not much we can do.
| -rwxr-xr-x | vis-open | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -1,6 +1,10 @@ #!/bin/sh set -e +# Later, we're going to want to set $IFS to a single newline, so let's prepare one. +NL=' +' + VIS_MENU_PROMPT="" ALLOW_AUTO_SELECT=1 @@ -41,6 +45,7 @@ if [ $# -eq 1 -a "$ALLOW_AUTO_SELECT" = 1 ]; then # We pass -f to force the next iteration to present the # full list, even if it's just an empty directory. cd "$1" + IFS=$NL # Don't split ls output on tabs or spaces. exec "$0" -p "$VIS_MENU_PROMPT" -f .. $(ls -1) else # We've found a single item, and it's not a directory, |
