Skip to content

Commit

Permalink
Control + E support #159
Browse files Browse the repository at this point in the history
  • Loading branch information
double-fault committed Jan 22, 2017
1 parent 120c467 commit db5fe57
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 6 deletions.
4 changes: 3 additions & 1 deletion include/platform/pc/drv/ps2/kbd/kbd.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ kbd_info_t
bool is_shift;
bool is_ctrl;
bool is_enter;
bool is_caps;
bool is_caps;
bool is_home;
bool is_end;
uint32_t current_kbd_layout_index;
int key;

Expand Down
37 changes: 32 additions & 5 deletions platform/pc/drv/ps2/kbd/kbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ void key_release(uint8_t scancode)
}

if ((int)(scancode) == 29) //Scancode of "Control" key
kbd_info.is_ctrl = false;
kbd_info.is_ctrl = false;
if ((int)(scancode) == 71) //Scancode of "Home" key
kbd_info.is_home = false;
}

/*
Expand Down Expand Up @@ -225,7 +227,16 @@ static inline void inc_al()
* characters.(#define)
*/
void key_handler_util(int key)
{
{
if (kbd_info.is_home == true)
{
virtual_index_scank = 0;
virtual_cursor_pos = LENGTH_INPUT;
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);
return;
}
//First checking for shortcut commands
if (kbd_info.is_ctrl == true)
{
Expand Down Expand Up @@ -260,7 +271,7 @@ void key_handler_util(int key)
kbd_info.key = ' ';
return;
}
else if (key == 'a' || key == 'A')
else if (key == 'a' || key == 'A' || kbd_info.is_home == true)
{
virtual_index_scank = 0;
virtual_cursor_pos = LENGTH_INPUT;
Expand All @@ -269,6 +280,15 @@ void key_handler_util(int key)
,__crsr_start,__crsr_end);
return;
}
else if (key == 'e' || key == 'E')
{
virtual_index_scank = index_scank;
virtual_cursor_pos = 0;
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);
return;
}
else if (key == 'c' || key == 'C')
{
return;
Expand Down Expand Up @@ -422,7 +442,7 @@ void key_handler_util_tab()
* @function key_handler:
* Handles key events.
* called by primary
* keyborad handler
* keyboard handler
* @kbd_handler.
*
*/
Expand Down Expand Up @@ -477,7 +497,14 @@ void key_handler()
}
printk("%s" , cmd_active.value);
}
break;
break;
case KBD_HOME_KEY_ID:
//printk ("HOME");
kbd_info.is_home = true;
break;
case KBD_END_KEY_ID:
kbd_info.is_end = true;
break;
case KBD_CONTROL_PRESS_ID:
kbd_info.is_ctrl = true;
break;
Expand Down

0 comments on commit db5fe57

Please sign in to comment.