From 0e31684cf441525cf309102ee40f14725a342b2b Mon Sep 17 00:00:00 2001 From: Fortunate-MAN Date: Sat, 21 Jan 2017 17:56:19 +0530 Subject: [PATCH] Some bugfixes, still not ready though #118 --- platform/pc/drv/ps2/kbd/kbd.c | 45 ++++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/platform/pc/drv/ps2/kbd/kbd.c b/platform/pc/drv/ps2/kbd/kbd.c index da10194..15c08fb 100644 --- a/platform/pc/drv/ps2/kbd/kbd.c +++ b/platform/pc/drv/ps2/kbd/kbd.c @@ -44,7 +44,10 @@ #include #include #include -#include +#include +#include +#include +#include @@ -306,14 +309,44 @@ void key_handler_util_backspace() { if(!((LENGTH_INPUT-1) < 0)) { - if(active_scank) + if(active_scank == true) { - buffer_scank[index_scank--] = 0; + /*buffer_scank[virtual_index_scank--] = 0; + index_scank --; + //virtual_index_scank --;*/ + if (index_scank > (unsigned)virtual_index_scank) + { + for (int i = virtual_index_scank; i < (int)index_scank; i ++) + { + buffer_scank [i - 1] = buffer_scank [i]; + } + buffer_scank [index_scank - 1] = 0; + } + else + { + buffer_scank [index_scank-1] = 0; + } + index_scank --; virtual_index_scank --; } - if(print_scank == true) - printk("\b"); + if(print_scank == true) + { + //printk ("\n%d\n", virtual_index_scank); + if ((unsigned)virtual_index_scank + 1 < index_scank) + { + int temp = LENGTH_INPUT; + while (temp > 0) {printk ("\b"); temp --;} + printk ("%s", buffer_scank); + video_drivers[VGA_VIDEO_DRIVER_INDEX]->update_cursor + (video_drivers[VGA_VIDEO_DRIVER_INDEX]->video_row,video_drivers[VGA_VIDEO_DRIVER_INDEX]->video_column - virtual_cursor_pos + ,__crsr_start,__crsr_end); + } + else + { + printk ("\b"); + } + } INDEX_CURSOR_POSITION-=1; LENGTH_INPUT-=1; @@ -402,7 +435,7 @@ void key_handler() } break; case KBD_RIGHT_KEY_ID: - if ((LENGTH_INPUT - virtual_cursor_pos) > 0) + if ((LENGTH_INPUT - virtual_cursor_pos) >= 0 && virtual_cursor_pos > 0) { virtual_cursor_pos --; video_drivers[VGA_VIDEO_DRIVER_INDEX]->update_cursor