feat(console): customize interactive prompt to 'Airlys >>> ' and add backspace handling
This commit is contained in:
1 parent
da6253030a
commit
08610afa9d
3 files changed
+20
-2
No files matched your search
+8
-1
@@ -61,7 +61,14 @@ static void keyboard_callback(registers_t* regs) {
|
|||||||
if (scancode < 128) {
|
if (scancode < 128) {
|
||||||
char c = shift_pressed ? kbd_scancode_shift[scancode] : kbd_scancode_normal[scancode];
|
char c = shift_pressed ? kbd_scancode_shift[scancode] : kbd_scancode_normal[scancode];
|
||||||
if (c != 0) {
|
if (c != 0) {
|
||||||
vga_putchar(c);
|
if (c == '\n') {
|
||||||
|
vga_putchar('\n');
|
||||||
|
vga_set_color(VGA_COLOR_LIGHT_CYAN, VGA_COLOR_BLACK);
|
||||||
|
vga_puts("Airlys >>> ");
|
||||||
|
vga_set_color(VGA_COLOR_WHITE, VGA_COLOR_BLACK);
|
||||||
|
} else {
|
||||||
|
vga_putchar(c);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -62,7 +62,8 @@ void kernel_main(uint64_t magic, uint64_t addr) {
|
|||||||
vga_puts(" ------------------------------------------------------------------------------\n\n");
|
vga_puts(" ------------------------------------------------------------------------------\n\n");
|
||||||
|
|
||||||
vga_set_color(VGA_COLOR_LIGHT_CYAN, VGA_COLOR_BLACK);
|
vga_set_color(VGA_COLOR_LIGHT_CYAN, VGA_COLOR_BLACK);
|
||||||
vga_puts("airlys> ");
|
vga_puts("Airlys >>> ");
|
||||||
|
vga_set_color(VGA_COLOR_WHITE, VGA_COLOR_BLACK);
|
||||||
|
|
||||||
/* Infinite safe idle loop awaiting hardware interrupts */
|
/* Infinite safe idle loop awaiting hardware interrupts */
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|||||||
@@ -53,6 +53,16 @@ void vga_clear(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void vga_putchar(char c) {
|
void vga_putchar(char c) {
|
||||||
|
if (c == '\b') {
|
||||||
|
if (vga_column > 0) {
|
||||||
|
vga_column--;
|
||||||
|
const size_t index = vga_row * VGA_WIDTH + vga_column;
|
||||||
|
vga_buffer[index] = vga_entry(' ', vga_current_color);
|
||||||
|
vga_update_cursor();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (c == '\n') {
|
if (c == '\n') {
|
||||||
vga_column = 0;
|
vga_column = 0;
|
||||||
if (++vga_row == VGA_HEIGHT) {
|
if (++vga_row == VGA_HEIGHT) {
|
||||||
|
|||||||
Reference in new issue
Block a user