Use console_cursor_on(), console_cursor_off(), console_cursor_save(), console_cursor_restore()

This commit is contained in:
Laurent Vivier
2005-08-28 21:42:18 +00:00
parent 95e99c5c24
commit 4222e48572
2 changed files with 17 additions and 11 deletions

View File

@@ -25,11 +25,12 @@ void cli_edit(char *s, int length)
for (i = l; i > pos; i--) for (i = l; i > pos; i--)
s[i] = s[i - 1]; s[i] = s[i - 1];
s[pos] = c; s[pos] = c;
printf("%s", s + pos); putchar(c);
l++;
pos++; pos++;
for (i = l; i > pos; i--) l++;
putchar('\b'); console_cursor_save();
printf("%s", s + pos);
console_cursor_restore();
} }
else switch(c) else switch(c)
{ {
@@ -52,12 +53,12 @@ void cli_edit(char *s, int length)
{ {
putchar('\b'); putchar('\b');
pos--; pos--;
l--;
strcpy(s + pos, s + pos + 1); strcpy(s + pos, s + pos + 1);
console_cursor_save();
printf("%s", s + pos); printf("%s", s + pos);
putchar(' '); putchar(' ');
for (i = l; i > pos; i--) console_cursor_restore();
putchar('\b');
l--;
} }
break; break;
case 0x7f: /* Delete */ case 0x7f: /* Delete */
@@ -65,9 +66,10 @@ void cli_edit(char *s, int length)
{ {
strcpy(s + pos, s + pos + 1); strcpy(s + pos, s + pos + 1);
l--; l--;
console_cursor_save();
printf("%s", s + pos); printf("%s", s + pos);
for (i = l; i > pos; i--) putchar(' ');
putchar('\b'); console_cursor_restore();
} }
break; break;
} }

View File

@@ -167,12 +167,16 @@ int start(emile_l2_header_t* info)
if (info->kernel_image_size == 0) if (info->kernel_image_size == 0)
error("Kernel is missing !!!!\n"); error("Kernel is missing !!!!\n");
printf("Parameters: %s", info->command_line); printf("Parameters: ");
console_cursor_save();
printf("%s", info->command_line);
console_cursor_on();
if (console_keypressed(5 * 60)) if (console_keypressed(5 * 60))
{ {
printf("\rParameters: "); console_cursor_restore();
cli_edit(info->command_line, CL_SIZE); cli_edit(info->command_line, CL_SIZE);
} }
console_cursor_off();
putchar('\n'); putchar('\n');
#ifdef SCSI_SUPPORT #ifdef SCSI_SUPPORT
info->kernel_image_offset = (unsigned long)info->kernel_image_offset + (unsigned long)info; info->kernel_image_offset = (unsigned long)info->kernel_image_offset + (unsigned long)info;