GNU Readline: how to clear the input line?

前端 未结 6 1339
你的背包
你的背包 2021-01-05 14:35

I use GNU Readline in the \"select\" fashion, by registering a callback function like so:

rl_callback_handler_install(\"\", on_readline_input);
6条回答
  •  星月不相逢
    2021-01-05 15:28

    Do any of these functions help?

    • rl_reset_line_state()
    • rl_clear_message()
    • rl_delete_text()
    • rl_kill_text()

    Also, can you mediate the server output - have the server output controlled so that it only appears when and where you want it to, rather than just sprawling over what the user is typing? For example, if your application is running in curses mode, could you have a split window with a line or two at the bottom in one sub-window reserved for user input and the rest of the output (server output and accepted user input) in a second sub-window above it?

提交回复
热议问题