One may wish to disable the arrow keys in vi(1), because it is cold and
the jacket will sometimes brush up against said keys, causing unexpected
cursor motions. This may be done by modifying cl/cl_term.c to set
"kcud1" and friends to use NULL for the output string, plus some obvious
tkp->output string length changes just below that. This is according to
the seq_set() comment:

  * An input string must always be present.  The output string
  * can be NULL, when set internally, that's how we throw away
  * input.

However, after recompiling, vi crashes when the arrow keys are pressed.

The cause is an unguarded use of the NULL output pointer. I am pretty
sure an .exrc cannot cause this condition (map rhs requires
something, not nothing) only recompiling with a NULL output string
for some command.

One fix is to guard the "init_nomap = !e_memcmp(qp->output," line in
common/key.c with something like

  if (qp->output)
    init_nomap = !e_memcmp(qp->output, &gp->i_event[gp->i_next], qp->ilen);

Reply via email to