vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit b6b267f5ad83315e847ad4c3066a54f4037bb329
parent 4bb4b6094092b688d11b4a5d07c695d0ba8129b1
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Tue, 19 Apr 2016 22:43:33 +0200

vis: add an unsigned option type for :set command

Diffstat:
Mvis-cmds.c | 4+++-
Mvis.h | 1+
2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/vis-cmds.c b/vis-cmds.c @@ -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; @@ -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; } diff --git a/vis.h b/vis.h @@ -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*);