aboutsummaryrefslogtreecommitdiffstats
path: root/com32/hdt
diff options
context:
space:
mode:
authorErwan Velu <erwan.velu@free.fr>2009-03-19 19:01:43 +0100
committerErwan Velu <erwan.velu@free.fr>2009-03-19 19:01:43 +0100
commit73bbf0d63853d87e00c95df9e9293eb8dad15c5b (patch)
treefb2dd24078d0bc2a562a6bba825f4edc156f0093 /com32/hdt
parent537b0b1af03cc6c53eada6df7afb4b4283f6dadb (diff)
downloadsyslinux.git-73bbf0d63853d87e00c95df9e9293eb8dad15c5b.tar.gz
syslinux.git-73bbf0d63853d87e00c95df9e9293eb8dad15c5b.tar.xz
syslinux.git-73bbf0d63853d87e00c95df9e9293eb8dad15c5b.zip
hdt: ctrl+a or HOME key return to the beginning of line
Impact: Users can now uses ctrl+a or HOME to return at the beginning of a line Ctrl+a or home key is now implemented
Diffstat (limited to 'com32/hdt')
-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 */