vrepl, term: return cursor to the top-left corner in vrepl after `clear` (#7600)
parent
8cd470b56e
commit
0210d1bf24
|
@ -146,7 +146,7 @@ fn run_repl(workdir string, vrepl_prefix string) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if r.line == 'clear' {
|
if r.line == 'clear' {
|
||||||
term.erase_display('2')
|
term.erase_clear()
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if r.line == 'help' {
|
if r.line == 'help' {
|
||||||
|
|
|
@ -46,6 +46,7 @@ pub fn cursor_back(n int) {
|
||||||
// type: 1 -> current cursor position to beginning of the screen
|
// type: 1 -> current cursor position to beginning of the screen
|
||||||
// type: 2 -> clears entire screen
|
// type: 2 -> clears entire screen
|
||||||
// type: 3 -> clears entire screen and also delete scrollback buffer
|
// type: 3 -> clears entire screen and also delete scrollback buffer
|
||||||
|
|
||||||
pub fn erase_display(t string) {
|
pub fn erase_display(t string) {
|
||||||
print('\x1b[' + t + 'J')
|
print('\x1b[' + t + 'J')
|
||||||
}
|
}
|
||||||
|
@ -58,8 +59,9 @@ pub fn erase_tobeg() {
|
||||||
erase_display('1')
|
erase_display('1')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// clears entire screen and returns cursor to top left-corner
|
||||||
pub fn erase_clear() {
|
pub fn erase_clear() {
|
||||||
erase_display('2')
|
print("\033[H\033[J")
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn erase_del_clear() {
|
pub fn erase_del_clear() {
|
||||||
|
|
Loading…
Reference in New Issue