aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--com32/hdt/hdt-cli.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/com32/hdt/hdt-cli.c b/com32/hdt/hdt-cli.c
index 5f25b4c7..95274762 100644
--- a/com32/hdt/hdt-cli.c
+++ b/com32/hdt/hdt-cli.c
@@ -352,6 +352,7 @@ void start_cli_mode(struct s_hardware *hardware)
{
struct s_cli cli;
int current_key = 0;
+ char ansi_command[MAX_LINE_SIZE];
set_mode(&cli, HDT_MODE, hardware);
printf("Entering CLI mode\n");
@@ -362,12 +363,21 @@ void start_cli_mode(struct s_hardware *hardware)
//fgets(cli_line, sizeof cli_line, stdin);
current_key = get_key(stdin, 0);
switch (current_key) {
+ /* quit current line */
case KEY_CTRL('c'):
more_printf("\n");
reset_prompt(&cli);
break;
case KEY_TAB:
break;
+ /* Returning at the begining of the line*/
+ case KEY_CTRL('a'):
+ case KEY_HOME:
+ sprintf(ansi_command,"\033[%dD",cli.cursor_pos);
+ /* Return to the begining of line */
+ fputs(ansi_command, stdout);
+ cli.cursor_pos=0;
+ break;
case KEY_ENTER:
more_printf("\n");
exec_command(skipspace(cli.input), &cli, hardware);
@@ -378,7 +388,7 @@ void start_cli_mode(struct s_hardware *hardware)
if (cli.cursor_pos == 0)
break;
- /* Return to the begining of line */
+ /* Return one char back */
fputs("\033[1D", stdout);
/* Erase that char */