summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErwan Velu <erwan.velu@free.fr>2009-05-03 17:49:20 (GMT)
committerErwan Velu <erwan.velu@free.fr>2009-05-03 17:49:20 (GMT)
commit16da4bf8a346e3fc7abf75d0ad903a088301dccc (patch)
treece3305573e8919002a9b177d16d2dd9501f31b82
parent3e5b7b7a03bc8264c2b68b2a3a174ec548b65f37 (diff)
downloadhdt-16da4bf8a346e3fc7abf75d0ad903a088301dccc.zip
hdt-16da4bf8a346e3fc7abf75d0ad903a088301dccc.tar.gz
hdt-16da4bf8a346e3fc7abf75d0ad903a088301dccc.tar.bz2
hdt-16da4bf8a346e3fc7abf75d0ad903a088301dccc.tar.xz
hdt: Input cursor is now blinking
Impact: Improve user experience This commit let the cursor blinking while waiting for a keyboard input. The blinking mode seems to fails under qemu but works fine on real hardware.
-rw-r--r--com32/hdt/hdt-cli.c9
-rw-r--r--com32/hdt/lib-ansi.c7
-rw-r--r--com32/hdt/lib-ansi.h1
3 files changed, 16 insertions, 1 deletions
diff --git a/com32/hdt/hdt-cli.c b/com32/hdt/hdt-cli.c
index 7e8954c..c8d9ce8 100644
--- a/com32/hdt/hdt-cli.c
+++ b/com32/hdt/hdt-cli.c
@@ -776,9 +776,16 @@ void start_cli_mode(struct s_hardware *hardware)
while (hdt_cli.mode != EXIT_MODE) {
- //fgets(cli_line, sizeof cli_line, stdin);
+ /* Let's put the cursor blinking until we get an input */
+ set_cursor_blink(true);
+
+ /* We wait endlessly for a keyboard input*/
current_key = get_key(stdin, 0);
+ /* We have to cancel the blinking mode to prevent
+ * input text to blink */
+ set_cursor_blink(false);
+
/* Reset autocomplete buffer unless TAB is pressed */
if (current_key != KEY_TAB)
autocomplete_destroy_list();
diff --git a/com32/hdt/lib-ansi.c b/com32/hdt/lib-ansi.c
index 12e5ecc..411dba8 100644
--- a/com32/hdt/lib-ansi.c
+++ b/com32/hdt/lib-ansi.c
@@ -61,6 +61,13 @@ void move_cursor_right(int count) {
fputs(buffer, stdout);
}
+void set_cursor_blink(bool status) {
+ if (status == true)
+ fputs("\033[05m",stdout);
+ else
+ fputs("\033[0m",stdout);
+}
+
void clear_line() {
fputs("\033[2K", stdout);
}
diff --git a/com32/hdt/lib-ansi.h b/com32/hdt/lib-ansi.h
index 2a17766..0b0d0d1 100644
--- a/com32/hdt/lib-ansi.h
+++ b/com32/hdt/lib-ansi.h
@@ -40,4 +40,5 @@ void disable_utf8();
void set_g1_special_char();
void set_us_g0_charset();
void clear_entire_screen();
+void set_cursor_blink(bool status);
#endif