From 98bca99b2aeffb55b8aee765a7a6de13bdac4506 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Sun, 25 Sep 2016 11:38:00 +0200 Subject: vis: disable language map for replacement character of `r` command The character following the `r` command in normal mode should be treated as regular input given in insert/replace mode, that is no tranformation should be applied. Temporarily disable the language map for this reason. Close #382 --- vis.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'vis.c') diff --git a/vis.c b/vis.c index 289b7b9..41d2037 100644 --- a/vis.c +++ b/vis.c @@ -532,6 +532,10 @@ bool vis_keymap_add(Vis *vis, const char *key, const char *mapping) { return map_put(vis->keymap, key, mapping); } +void vis_keymap_disable(Vis *vis) { + vis->keymap_disabled = true; +} + static void window_jumplist_add(Win *win, size_t pos) { Mark mark = text_mark_set(win->file->text, pos); if (mark && win->jumplist) @@ -864,7 +868,9 @@ static const char *getkey(Vis *vis) { if (!key) return NULL; vis_info_hide(vis); - if (!vis->mode->input) { + bool use_keymap = !vis->mode->input && !vis->keymap_disabled; + vis->keymap_disabled = false; + if (use_keymap) { const char *mapped = map_get(vis->keymap, key); if (mapped) return mapped; -- cgit v1.2.3