Use smcup and rmcup to save/restore screen buffer
未关闭
- 主要语言
- 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 还没有评估数据。