antirez / antirez/kilo

Use smcup and rmcup to save/restore screen buffer

オープン
#48 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
C
スター
9.1k
フォーク
997
PR マージ指標
30日以内にマージされた PR はありません

説明

Vim and others appear to do this. It also has the added benefit of fixing `Page Up` and `Page Down` on MacOS using Terminal.app.

```c
void initEditor() {
write(STDOUT_FILENO, "\033[?47h", 6); // New (smcup)
EditorConfig.cursor.x = 0;
EditorConfig.cursor.y = 0;
if (getWindowSize(&EditorConfig.screenRows, &EditorConfig.screenCols) == -1) die("getWindowSize");
terminalClearScreen();
}

// ...

void disableRawMode() {
write(STDOUT_FILENO, "\033[?47l", 6); // New (rmcup)
tcsetattr(STDIN_FILENO, TCSAFLUSH, &EditorConfig.orig_termios);
}
```

More info [here](http://austinhanson.com/page-up-page-down-with-kilo-editor).

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。