Skip to content

Commit

Permalink
vis: add an unsigned option type for :set command
Browse files Browse the repository at this point in the history
  • Loading branch information
martanne committed Apr 19, 2016
1 parent 5e1c948 commit aab8b6c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion vis-cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ static bool cmd_set(Vis *vis, Win *win, Command *cmd, const char *argv[], Cursor
OPTION_TYPE_STRING,
OPTION_TYPE_BOOL,
OPTION_TYPE_NUMBER,
OPTION_TYPE_UNSIGNED,
} type;
bool optional;
int index;
Expand Down Expand Up @@ -134,12 +135,13 @@ static bool cmd_set(Vis *vis, Win *win, Command *cmd, const char *argv[], Cursor
arg.b = !arg.b;
break;
case OPTION_TYPE_NUMBER:
case OPTION_TYPE_UNSIGNED:
if (!argv[2]) {
vis_info_show(vis, "Expecting number");
return false;
}
/* TODO: error checking? long type */
arg.i = strtoul(argv[2], NULL, 10);
arg.u = strtoul(argv[2], NULL, 10);
break;
}

Expand Down
1 change: 1 addition & 0 deletions vis.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ typedef struct {
typedef union { /* various types of arguments passed to key action functions */
bool b;
int i;
size_t u;
const char *s;
const void *v;
void (*w)(View*);
Expand Down

0 comments on commit aab8b6c

Please sign in to comment.