Skip to content

Commit

Permalink
vis: process command line options when reading from stdin
Browse files Browse the repository at this point in the history
Previously the following had no effect:

 $ echo foo | vis +"set syntax markdown" -

Fix martanne#512
  • Loading branch information
martanne committed Mar 4, 2017
1 parent be53e40 commit 99d1c95
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2173,17 +2173,18 @@ int main(int argc, char *argv[]) {
close(fd);
} else if (strcmp(argv[i], "--") == 0) {
end_of_options = true;
continue;
}
} else if (argv[i][0] == '+' && !end_of_options) {
cmd = argv[i] + (argv[i][1] == '/' || argv[i][1] == '?');
continue;
} else if (!vis_window_new(vis, argv[i])) {
vis_die(vis, "Can not load `%s': %s\n", argv[i], strerror(errno));
} else {
win_created = true;
if (cmd) {
vis_prompt_cmd(vis, cmd);
cmd = NULL;
}
}
win_created = true;
if (cmd) {
vis_prompt_cmd(vis, cmd);
cmd = NULL;
}
}

Expand Down

0 comments on commit 99d1c95

Please sign in to comment.