term: add clear

pull/5426/head
Swastik Baranwal 2020-06-19 20:45:41 +05:30 committed by GitHub
parent 3cfeb92a4e
commit 72b09d4794
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -871,14 +871,6 @@ pub fn write_file(path, text string) {
f.close() f.close()
} }
// clear clears current terminal screen.
pub fn clear() {
$if !windows {
C.printf('\x1b[2J')
C.printf('\x1b[H')
}
}
pub fn on_segfault(f voidptr) { pub fn on_segfault(f voidptr) {
$if windows { $if windows {
return return

View File

@ -75,3 +75,11 @@ fn supports_escape_sequences(fd int) bool {
return is_atty(fd) > 0 && os.getenv('TERM') != 'dumb' return is_atty(fd) > 0 && os.getenv('TERM') != 'dumb'
} }
} }
// clear clears current terminal screen.
pub fn clear() {
$if !windows {
C.printf('\x1b[2J')
C.printf('\x1b[H')
}
}