From 2cfaf219558dd730478e4c5e27376091b617a50f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Tue, 4 Apr 2017 07:34:41 +0200 Subject: [PATCH] vis: reject multi letter mark and register names Fix #531 --- main.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/main.c b/main.c index c8fefaa..b5a9d9e 100644 --- a/main.c +++ b/main.c @@ -1207,6 +1207,8 @@ static const char *macro_record(Vis *vis, const char *keys, const Arg *arg) { static const char *macro_replay(Vis *vis, const char *keys, const Arg *arg) { if (!keys[0]) return NULL; + if (keys[1]) + return vis_keys_next(vis, keys); enum VisRegister reg = vis_register_from(vis, keys[0]); vis_macro_replay(vis, reg); return keys+1; @@ -1679,6 +1681,8 @@ static const char *selection_restore(Vis *vis, const char *keys, const Arg *arg) static const char *reg(Vis *vis, const char *keys, const Arg *arg) { if (!keys[0]) return NULL; + if (keys[1]) + return vis_keys_next(vis, keys); enum VisRegister reg = vis_register_from(vis, keys[0]); vis_register_set(vis, reg); return keys+1; @@ -1687,6 +1691,8 @@ static const char *reg(Vis *vis, const char *keys, const Arg *arg) { static const char *mark_set(Vis *vis, const char *keys, const Arg *arg) { if (!keys[0]) return NULL; + if (keys[1]) + return vis_keys_next(vis, keys); vis_mark_set(vis, vis_mark_from(vis, keys[0]), view_cursor_get(vis_view(vis))); return keys+1; } @@ -1694,6 +1700,8 @@ static const char *mark_set(Vis *vis, const char *keys, const Arg *arg) { static const char *mark_motion(Vis *vis, const char *keys, const Arg *arg) { if (!keys[0]) return NULL; + if (keys[1]) + return vis_keys_next(vis, keys); vis_motion(vis, arg->i, vis_mark_from(vis, keys[0])); return keys+1; } @@ -1751,6 +1759,8 @@ static const char *delete(Vis *vis, const char *keys, const Arg *arg) { static const char *insert_register(Vis *vis, const char *keys, const Arg *arg) { if (!keys[0]) return NULL; + if (keys[1]) + return vis_keys_next(vis, keys); enum VisRegister reg = vis_register_from(vis, keys[0]); size_t len; const char *data = vis_register_get(vis, reg, &len); -- 2.11.4.GIT