fix: backspace
This commit is contained in:
@@ -2,4 +2,7 @@
|
|||||||
build
|
build
|
||||||
.venv
|
.venv
|
||||||
kernel/data
|
kernel/data
|
||||||
|
*.md
|
||||||
|
tools/
|
||||||
|
bootloader/
|
||||||
bootloader/src/uefi
|
bootloader/src/uefi
|
||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
// Copyright (c) 2025 0xKarinyash
|
||||||
|
|
||||||
#ifndef KEYBOARD_H
|
#ifndef KEYBOARD_H
|
||||||
#define KEYBOARD_H
|
#define KEYBOARD_H
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ static SG_Context *ctx_ptr = nullptr;
|
|||||||
static SG_Point s_cursor_pos = {0};
|
static SG_Point s_cursor_pos = {0};
|
||||||
static SG_Font s_font = {0};
|
static SG_Font s_font = {0};
|
||||||
static u32 s_color = COLOR_WHITE;
|
static u32 s_color = COLOR_WHITE;
|
||||||
|
static u32 s_bg_color = COLOR_BLACK;
|
||||||
|
|
||||||
void console_init(SG_Context *ctx) {
|
void console_init(SG_Context *ctx) {
|
||||||
ctx_ptr = ctx;
|
ctx_ptr = ctx;
|
||||||
@@ -50,6 +51,7 @@ void console_clear(u32 color) {
|
|||||||
|
|
||||||
s_cursor_pos.x = 0;
|
s_cursor_pos.x = 0;
|
||||||
s_cursor_pos.y = 0;
|
s_cursor_pos.y = 0;
|
||||||
|
s_bg_color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
SG_Context* console_get_context() {
|
SG_Context* console_get_context() {
|
||||||
@@ -77,6 +79,9 @@ static void console_putc(char c) {
|
|||||||
s_cursor_pos.y += s_font.h;
|
s_cursor_pos.y += s_font.h;
|
||||||
} else if (c == '\t') {
|
} else if (c == '\t') {
|
||||||
s_cursor_pos.x += s_font.w * 4;
|
s_cursor_pos.x += s_font.w * 4;
|
||||||
|
} else if (c == '\b') {
|
||||||
|
s_cursor_pos.x -= s_font.w;
|
||||||
|
sg_draw_rect(ctx_ptr, &s_cursor_pos, s_font.w, s_font.h, s_bg_color);
|
||||||
} else {
|
} else {
|
||||||
sg_draw_char_bitmap(ctx_ptr, &s_cursor_pos, c, s_color, &s_font);
|
sg_draw_char_bitmap(ctx_ptr, &s_cursor_pos, c, s_color, &s_font);
|
||||||
s_cursor_pos.x += s_font.w;
|
s_cursor_pos.x += s_font.w;
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
// Copyright (c) 2025 0xKarinyash
|
||||||
|
|
||||||
#include <drivers/keyboard.h>
|
#include <drivers/keyboard.h>
|
||||||
#include <drivers/console.h>
|
#include <drivers/console.h>
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -52,7 +52,7 @@ void kmain(Bootinfo* info) {
|
|||||||
kprintf("ksh_> ");
|
kprintf("ksh_> ");
|
||||||
char buff[32];
|
char buff[32];
|
||||||
kgets(buff, 32);
|
kgets(buff, 32);
|
||||||
kprintf("You typed: %s", &buff);
|
kprintf("You typed: %s", buff);
|
||||||
|
|
||||||
__asm__ volatile ("sti");
|
__asm__ volatile ("sti");
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
// Copyright (c) 2025 0xKarinyash
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user