NCurses initialization without clearing the screen

前端 未结 5 695
名媛妹妹
名媛妹妹 2021-01-17 20:29

I am writing a program that\'s similar to a shell. Once started up, there\'s a prompt and you enter in some app-specific commands.

So far this works just fine. How

5条回答
  •  难免孤独
    2021-01-17 20:35

    Curses wants to fully control the screen, and to optimize writes to the screen, especially over slow serial lines. To do this, it needs to know what is on the screen, and the only reasonable way to do that with most terminals is to start from an empty screen and keep track of what you write to the terminal.

    Thus, I suspect (n)curses is the wrong tool for your shell. You probably need to go down a step on the abstraction layer and use terminfo and non-blocking reads from the terminal (standard input) instead.

    (This is not very helpful. Sorry.)

提交回复
热议问题