aboutsummaryrefslogtreecommitdiff
path: root/vis-cmds.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-09-29 22:41:37 +0200
committerMarc André Tanner <mat@brain-dump.org>2016-09-29 22:41:37 +0200
commit9887127b03523097957a48657a130c0999574f1b (patch)
treef6d033d98f8a6be891f2bb9809a1bc8e1c9d3f8d /vis-cmds.c
parentcab0d2ce3f375084dd2de764e760ccc229689b71 (diff)
downloadvis-9887127b03523097957a48657a130c0999574f1b.tar.gz
vis-9887127b03523097957a48657a130c0999574f1b.tar.xz
sam: consistent argument handling for :r, :w, :e commands
:e without any argument can be used to reload the file from disk whereas before a "Filename expected" error would be displayed.
Diffstat (limited to 'vis-cmds.c')
-rw-r--r--vis-cmds.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/vis-cmds.c b/vis-cmds.c
index ea6ed8c..87ebd67 100644
--- a/vis-cmds.c
+++ b/vis-cmds.c
@@ -326,6 +326,10 @@ static void info_unsaved_changes(Vis *vis) {
}
static bool cmd_edit(Vis *vis, Win *win, Command *cmd, const char *argv[], Cursor *cur, Filerange *range) {
+ if (argv[2]) {
+ vis_info_show(vis, "Only 1 filename allowed");
+ return false;
+ }
Win *oldwin = win;
if (!oldwin)
return false;
@@ -520,13 +524,12 @@ static bool print_action(const char *key, void *value, void *data) {
static bool print_cmd(const char *key, void *value, void *data) {
char help[256];
CommandDef *cmd = value;
- snprintf(help, sizeof help, "%s%s%s%s%s%s%s%s",
+ snprintf(help, sizeof help, "%s%s%s%s%s%s%s",
cmd->name,
(cmd->flags & CMD_FORCE) ? "[!]" : "",
(cmd->flags & CMD_TEXT) ? "/text/" : "",
(cmd->flags & CMD_REGEX) ? "/regexp/" : "",
(cmd->flags & CMD_CMD) ? " command" : "",
- (cmd->flags & CMD_FILE) ? " file-name" : "",
(cmd->flags & CMD_SHELL) ? (!strcmp(cmd->name, "s") ? "/regexp/text/" : " shell-command") : "",
(cmd->flags & CMD_ARGV) ? " [args...]" : "");
return text_appendf(data, " %-30s %s\n", help, cmd->help);