antirez / antirez/kilo

Use smcup and rmcup to save/restore screen buffer

Đang mở
#48 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
C
Star
9.1k
Fork
997
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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).

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.