* .safe keymap doesn't use builtin widgets?
@ 2016-05-09 22:17 Daniel Shahaf
2016-05-10 18:00 ` Bart Schaefer
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Shahaf @ 2016-05-09 22:17 UTC (permalink / raw)
To: zsh-workers
Currently, the ".safe" keymap is:
% bindkey -LM .safe
bindkey -R -M .safe "^@"-"^I" self-insert
bindkey -M .safe "^J" accept-line
bindkey -R -M .safe "^K"-"^L" self-insert
bindkey -M .safe "^M" accept-line
bindkey -R -M .safe "^N"-"\M-^?" self-insert
Shouldn't it use the dot-prefixed versions of self-insert and
accept-line, so that for example the following wouldn't lock the user
out:
% self-insert() {}
% zle -N self-insert; bindkey -A .safe main
%
?
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: .safe keymap doesn't use builtin widgets?
2016-05-09 22:17 .safe keymap doesn't use builtin widgets? Daniel Shahaf
@ 2016-05-10 18:00 ` Bart Schaefer
0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2016-05-10 18:00 UTC (permalink / raw)
To: zsh-workers
On May 9, 10:17pm, Daniel Shahaf wrote:
}
} Shouldn't it use the dot-prefixed versions of self-insert and
} accept-line [...]
}
} ?
The immutable keymap and the immortal widgets were invented at different
times, so this was probably just overlooked when setting things up.
Fortunately it's pretty easy to change, and makes sense.
diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c
index 13fd138..f547dbf 100644
--- a/Src/Zle/zle_keymap.c
+++ b/Src/Zle/zle_keymap.c
@@ -1322,15 +1322,15 @@ default_bindings(void)
amap->first[i] = refthingy(t_undefinedkey);
/* safe fallback keymap:
- * 0-255 self-insert, except: *
- * '\n' accept-line *
- * '\r' accept-line */
+ * 0-255 .self-insert, except: *
+ * '\n' .accept-line *
+ * '\r' .accept-line */
for (i = 0; i < 256; i++)
- smap->first[i] = refthingy(t_selfinsert);
- unrefthingy(t_selfinsert);
- unrefthingy(t_selfinsert);
- smap->first['\n'] = refthingy(t_acceptline);
- smap->first['\r'] = refthingy(t_acceptline);
+ smap->first[i] = refthingy(t_Dselfinsert);
+ unrefthingy(t_Dselfinsert);
+ unrefthingy(t_Dselfinsert);
+ smap->first['\n'] = refthingy(t_Dacceptline);
+ smap->first['\r'] = refthingy(t_Dacceptline);
/* vt100 arrow keys are bound by default, for historical reasons. *
* Both standard and keypad modes are supported. */
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-05-10 17:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-09 22:17 .safe keymap doesn't use builtin widgets? Daniel Shahaf
2016-05-10 18:00 ` Bart Schaefer
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).