1

curses ライブラリを使用して画面の最初の 2 行をクリアするにはどうすればよいですか? コマンドがあることがわかりますがdeleteln()、カーソルの下の行のみをクリアします。

また、2 つ目の質問ですが、このコマンドclear()は画面全体をクリアしますか?

4

2 に答える 2

1

deleteln()行を削除し、残りのテキストを上に移動します。clrtoeol()現在の行の終わりまでクリアします。

を使用int move(int y, int x)して、上の 2 行のそれぞれの先頭にカーソルを置き、 を呼び出す必要がありますclrtoeol()

clear()ウィンドウ全体をクリアします

于 2013-05-29T08:54:52.530 に答える
1

parkydrは次のように述べclrtoeol()ています。「現在の行の終わりまでクリアします。」

それはほぼ正しいです。clrtoeol()カーソルから現在の行の終わりまでクリアします。したがって、カーソルが行の先頭にない場合、行全体がクリアされません。

次に例を示します。

int y, x;            // to store where you are
getyx(stdscr, y, x); // save current pos
move(0, 0);          // go to the beginning of the first line
clrtoeol();          // clear the line
move(1, 0);          // go to the beginning of the second line
clrtoeol();          // clear the line
move(y, x);          // move back to where you were
于 2013-12-04T06:12:52.513 に答える