def _alternative_left_right(term):
r"""
Determine and return mapping of left and right arrow keys sequences.
:arg blessed.Terminal term: :class:`~.Terminal` instance.
:rtype: dict
This function supports :func:`get_terminal_sequences` to discover
the preferred input sequence for the left and right application keys.
Return dict of sequences ``term._cuf1``, and ``term._cub1``,
valued as ``KEY_RIGHT``, ``KEY_LEFT`` (when appropriate). It is
necessary to check the value of these sequences to ensure we do not
use ``u' '`` and ``u'\b'`` for ``KEY_RIGHT`` and ``KEY_LEFT``,
preferring their true application key sequence, instead.
"""
keymap = dict()
if term._cuf1 and term._cuf1 != u' ':
keymap[term._cuf1] = curses.KEY_RIGHT
if term._cub1 and term._cub1 != u'\b':
keymap[term._cub1] = curses.KEY_LEFT
return keymap
评论列表
文章目录