NCurses and Function Keys - BSD

This is a discussion on NCurses and Function Keys - BSD ; when I press function keys , ncurses returns the character string "O" for function keys F[1-4] but returns different single character codes for the function keys F[5-9], F1[0-2] as well as for the arrow keys and the Insert, Delete, Home, ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: NCurses and Function Keys

  1. NCurses and Function Keys

    when I press function keys , ncurses returns the character string "O"
    for function keys F[1-4] but returns different single character codes for the
    function keys F[5-9], F1[0-2] as well as for the arrow keys and the Insert, Delete,
    Home, End, PgUp and PgDn keys. Can character code sequences representing the
    function keys be changed? If so, how?

    Thanks,
    Dave Feustel

    --
    Jerry Silverstein - The GOD of Jewish Lightning

  2. Re: NCurses and Function Keys

    dave wrote:
    > when I press function keys , ncurses returns the character string
    > "O" for function keys F[1-4] but returns different
    > single character codes for the function keys F[5-9], F1[0-2] as well
    > as for the arrow keys and the Insert, Delete, Home, End, PgUp and PgDn
    > keys. Can character code sequences representing the function keys be
    > changed? If so, how?


    Not without switching to a different terminal implementation. Why would
    you want to, anyway? The whole point of (n)curses is to abstract away
    such details.

    Joachim

  3. Re: NCurses and Function Keys

    Joachim Schipper wrote:
    > dave wrote:
    >> when I press function keys , ncurses returns the character string
    >> "O" for function keys F[1-4] but returns different
    >> single character codes for the function keys F[5-9], F1[0-2] as well
    >> as for the arrow keys and the Insert, Delete, Home, End, PgUp and PgDn
    >> keys. Can character code sequences representing the function keys be
    >> changed? If so, how?

    >
    > Not without switching to a different terminal implementation. Why would
    > you want to, anyway? The whole point of (n)curses is to abstract away
    > such details.
    >
    > Joachim


    The same ncurses test program gets different character sequences
    from pressing function keys, depending upon whether $TERM is set
    to xterm (in X/KDE) or vt220 (in console mode). It would be
    convenient to be able to define the codes returned by function keys
    to be the same in all environments.

  4. Re: NCurses and Function Keys

    dave wrote:
    > Joachim Schipper wrote:
    >> dave wrote:
    >>> when I press function keys , ncurses returns the character string
    >>> "O" for function keys F[1-4] but returns different
    >>> single character codes for the function keys F[5-9], F1[0-2] as well
    >>> as for the arrow keys and the Insert, Delete, Home, End, PgUp and PgDn
    >>> keys. Can character code sequences representing the function keys be
    >>> changed? If so, how?

    >>
    >> Not without switching to a different terminal implementation. Why would
    >> you want to, anyway? The whole point of (n)curses is to abstract away
    >> such details.
    >>
    >> Joachim

    >
    > The same ncurses test program gets different character sequences
    > from pressing function keys, depending upon whether $TERM is set
    > to xterm (in X/KDE) or vt220 (in console mode). It would be
    > convenient to be able to define the codes returned by function keys
    > to be the same in all environments.


    /usr/include/ncurses.h includes a list of function keys for use with
    curses wgetch(). Why don't you just use those?

    Joachim

  5. Re: NCurses and Function Keys

    On May 27, 7:10 am, dave wrote:
    > when I press function keys , ncurses returns the character string "O"
    > for function keys F[1-4] but returns different single character codes for the
    > function keys F[5-9], F1[0-2] as well as for the arrow keys and the Insert, Delete,
    > Home, End, PgUp and PgDn keys. Can character code sequences representing the
    > function keys be changed? If so, how?


    the included version of ncurses is quite old. the new ncurses library
    and included termcap have better support for function keys and some
    other things, like shifted arrow keys.


  6. Re: NCurses and Function Keys

    tedu wrote:
    > On May 27, 7:10 am, dave wrote:
    >> when I press function keys , ncurses returns the character string "O"
    >> for function keys F[1-4] but returns different single character codes for the
    >> function keys F[5-9], F1[0-2] as well as for the arrow keys and the Insert, Delete,
    >> Home, End, PgUp and PgDn keys. Can character code sequences representing the
    >> function keys be changed? If so, how?


    > the included version of ncurses is quite old. the new ncurses library
    > and included termcap have better support for function keys and some
    > other things, like shifted arrow keys.


    not exactly (it's only the terminfo data, not the library which supports
    shifted arrow keys).

    Usually termcap data is limited to 1023 bytes (not an ncurses limitation),
    which means that shifted arrow keys are not recognized.

    --
    Thomas E. Dickey
    http://invisible-island.net
    ftp://invisible-island.net

+ Reply to Thread