MLE: add `bind' and `unbind' etc...
commit8a3638c931e01d5e29ce0561ed4a231508964d05
authorSteffen (Daode) Nurpmeso <steffen@sdaoden.eu>
Thu, 14 Apr 2016 21:19:26 +0000 (14 23:19 +0200)
committerSteffen (Daode) Nurpmeso <steffen@sdaoden.eu>
Thu, 15 Sep 2016 13:58:15 +0000 (15 15:58 +0200)
treea2ffcda7f03c8613bbf0cbc216d9fa261e85c533
parentdc92f2c5f8fe53409b021e1b170dd9b9c0df3e3d
MLE: add `bind' and `unbind' etc...

Add the new commands `bind' and `unbind' which allow users to
create key mappings of their desire.

This changeset has been decoupled from ([termcap.2] Add
WANT_KEY_BINDINGS..) in order to be able to move it to after the
[topic/wysh] topic branch, which added support for sh(1)ell-style
argument quoting, something that is desirable for `bind', since
backslash escape sequences are a vivid part of the key-sequences
they use.

If a part of a key-sequence starts with a colon : this will
indicate a termcap(5) or terminfo(5) capability name that will be
looked up via our termcap sauce.

User given expansion strings are checked against some special
builtin editor functions, e.g., "mle-go-home", i.e., offer access
to our internal functionality via a multiplexer, accessible like
that.
If an expansion string ends with an at-sign @ then the expansion
will not be auto-committed, but will instead be subject to further
user editing.

Rewrite the MLE input handling to work with an input tree,
relatively identical to our terminal library.
  Aaah: how nice it is to have an event-driven mainloop that
  multiplexes around select(2) and has I/O monitors, timers etc.,
  then KeyEvent and maybe even KeySequenceEvent, and, practically,
  and especially in comparison: for free.  But that can't be helped.

While here:

  - Add some MLE functions that were missing:
    hist-srch-fwd, snarf-word-fwd, paste.

  - Drop the TSTP, TTIN and TTOU signal condomes that are provided
    by callers of n_tty_readline() (collect.c, lex_input.c), which
    always longjmp(3)d away from the TTY code even for those
    signals, therefore also causing line content resets, which
    i always have hated.

    So whereas we don't have SysV signal handling yet (see
    introductional comment / roman in signal.c), temporarily use
    SysV signal behaviour around the read(2) that is the core of
    n_tty_readline(), and simply restart, the MLE even
    automatically repaints the -- unchanged. -- line content.
    GNU readline(3) needs an ^L, but doesn't loose the content.
    The nothing-at-all implementation at least doesn't bail.
    Yay.  It is very expensive, but which will change with v15.

  - Also the usual tweaks, here and there.

P.S.: it is getting large.  "Normally" the MLE should be splitted
into at least three parts, already: visual update handling, raw
data and (processed) input handling, key-binding.
cmd_tab.h
collect.c
lex_input.c
mk-conf.sh
nail.1
nail.h
nail.rc
nailfuns.h
tty.c