[tools] Hide cursor while drawing prompt in heapsnapshot analysis tool to avoid flickering cursor
Change-Id: I544bfd16a1fc5f4bbb243d66d73526995037e9bc Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388821 Commit-Queue: Martin Kustermann <kustermann@google.com> Reviewed-by: Slava Egorov <vegorov@google.com>
This commit is contained in:
committed by
Commit Queue
parent
5eacff3ab8
commit
f3bce39727
@@ -25,11 +25,18 @@ class SmartConsole extends Console {
|
||||
write('\x1b[${column + 1}`');
|
||||
}
|
||||
|
||||
void hideCursor() {
|
||||
write('\x1b[? 5l');
|
||||
}
|
||||
|
||||
void showCursor() {
|
||||
write('\x1b[? 5h');
|
||||
}
|
||||
|
||||
ReadLineResult smartReadLine() {
|
||||
final buffer = LineEditBuffer();
|
||||
|
||||
drawPrompt(buffer);
|
||||
|
||||
while (true) {
|
||||
final key = readKey();
|
||||
|
||||
@@ -73,6 +80,7 @@ class SmartConsole extends Console {
|
||||
}
|
||||
|
||||
void drawPrompt(LineEditBuffer buffer) {
|
||||
hideCursor();
|
||||
const prefix = '(hsa) ';
|
||||
|
||||
moveCursorToColumn(0);
|
||||
@@ -93,6 +101,7 @@ class SmartConsole extends Console {
|
||||
}
|
||||
|
||||
moveCursorToColumn(prefix.length + buffer.index);
|
||||
showCursor();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user