mirror of
https://github.com/limine-bootloader/limine
synced 2025-01-21 03:52:04 +03:00
term: Fix bug introduced when moving from int to size_t for coordinates. Fixes #110
This commit is contained in:
parent
de673e2ac9
commit
7ad45e8daf
@ -242,10 +242,18 @@ void text_move_character(size_t new_x, size_t new_y, size_t old_x, size_t old_y)
|
||||
void text_set_cursor_pos(size_t x, size_t y) {
|
||||
clear_cursor();
|
||||
if (x >= VD_COLS / 2) {
|
||||
x = VD_COLS / 2 - 1;
|
||||
if ((int)x < 0) {
|
||||
x = 0;
|
||||
} else {
|
||||
x = VD_COLS / 2 - 1;
|
||||
}
|
||||
}
|
||||
if (y >= VD_ROWS) {
|
||||
y = VD_ROWS - 1;
|
||||
if ((int)y < 0) {
|
||||
y = 0;
|
||||
} else {
|
||||
y = VD_ROWS - 1;
|
||||
}
|
||||
}
|
||||
cursor_offset = y * VD_COLS + x * 2;
|
||||
draw_cursor();
|
||||
|
@ -416,10 +416,18 @@ bool gterm_disable_cursor(void) {
|
||||
void gterm_set_cursor_pos(size_t x, size_t y) {
|
||||
clear_cursor();
|
||||
if (x >= cols) {
|
||||
x = cols - 1;
|
||||
if ((int)x < 0) {
|
||||
x = 0;
|
||||
} else {
|
||||
x = cols - 1;
|
||||
}
|
||||
}
|
||||
if (y >= rows) {
|
||||
y = rows - 1;
|
||||
if ((int)y < 0) {
|
||||
y = 0;
|
||||
} else {
|
||||
y = rows - 1;
|
||||
}
|
||||
}
|
||||
cursor_x = x;
|
||||
cursor_y = y;
|
||||
|
Loading…
Reference in New Issue
Block a user