Using GNU Readline; how can I add ncurses in the same program?

后端 未结 6 1204
醉酒成梦
醉酒成梦 2020-12-01 07:57

The title is a bit more specific than my actual goal:

I have a command-line program which uses GNU Readline, primarily for command history (i.e. retrieving previous

6条回答
  •  清歌不尽
    2020-12-01 08:39

    I have done some searching, and it seems like you are out of luck.

    For ncurses alternatives there are SLang, Newt and Turbo Vision. Slang is much more than just screen handling and thus more complex, but maybe it can be used for your purpose?. Newt uses the screen handling and is much simpler, but too simple and single-threaded-mode for your purpose I think.

    Turbo vision is the text mode graphics library from Borland, used by all their tools in the late 80s/early 90s. Borland released the source code when the market for that kind of thing diminished, and there is now a port for linux (side note, this project seems to have written its own turbo vision implementation). That port is not dead (there have been some cvs updates this year which compiled fine (the older releases did not)), but none of the TV examples I found were up to date and I did only got a few of them to compile before giving up on the rest. This is a bit of a shame, because TV was a lovely environment to use. TV is btw C++ (and I assume you are using C?).

    For an alternative to readline, there is libkinput, which maybe works together with ncurses (it says it can use ncurses' terminfo. but I am not sure if that means that it can co-exists together with ncurses usage)?

    Maybe one option is to run readline "externally" to your ncurses program using rlwrap?

提交回复
热议问题