Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: (2b) Re: History Up key



Bart wrote:
> There are some ancient terminals (I think Qume terminals are an example)
> for which the termcap bindings are (or at least, were)
> 
> 	kd => newline
> 	kl => backspace
> 	kr => space
> 
> with ku not bound, of course.  Probably an adequate solution is to avoid
> binding the "arrow" keys in those circumstances where zsh automatically
> enters single-line-zle mode.

Andrej wrote:
> A word that zsh tries first to get ESC from termcap?

This goes on top of the immediately previous patch, not the one before
that.  I'll probably commit both of these later if there are no more
comments.

The consequence of the first hunk is that the VT100 sequences are bound if
the shell doesn't like the look of the terminal.  I don't think this is a
bad fallback position (it's consistent with what happened before, apart
from the additional viins bindings, of course).

--- Src/Zle/zle_keymap.c.yeah	Tue Mar 13 10:51:13 2001
+++ Src/Zle/zle_keymap.c	Tue Mar 13 10:52:55 2001
@@ -1030,7 +1030,11 @@
 {
     char buf[2048];
 
-    if (tccan(tccode)) {
+    /*
+     * Be careful not to try too hard with bindings for dubious or
+     * dysfunctional terminals.
+     */
+    if (tccan(tccode) && !(termflags & (TERM_NOUP|TERM_BAD|TERM_UNKNOWN))) {
 	/*
 	 * We can use the real termcap sequence.  We need to
 	 * persuade termcap to output `move cursor 1 char' and capture it.
--- Doc/Zsh/zle.yo.yeah	Tue Mar 13 10:55:12 2001
+++ Doc/Zsh/zle.yo	Tue Mar 13 11:28:35 2001
@@ -201,6 +201,16 @@
 and their default bindings in emacs mode,
 vi command mode and vi insert mode
 (the `tt(emacs)', `tt(vicmd)' and `tt(viins)' keymaps, respectively).
+
+Note that cursor keys are bound to movement keys in all three keymaps;
+the shell assumes that the cursor keys send the key sequences reported
+by the terminal-handling library (termcap or terminfo).  The key sequences
+shown in the list are those based on the VT100, common on many modern
+terminals, but in fact these are not necessarily bound.  In the case of the
+tt(viins) keymap, the initial escape character of the sequences serves also
+to return to the tt(vicmd) keymap: whether this happens is determined by
+the tt(KEYTIMEOUT) parameter, see ifzman(zmanref(zshparam))\
+ifnzman(noderef(Parameters)).
 startmenu()
 menu(Movement)
 menu(History Control)

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070



Messages sorted by: Reverse Date, Date, Thread, Author