Skip to content

Commit

Permalink
Control + T support #159
Browse files Browse the repository at this point in the history
  • Loading branch information
double-fault committed Jan 31, 2017
1 parent b64cb15 commit bbb2615
Showing 1 changed file with 31 additions and 6 deletions.
37 changes: 31 additions & 6 deletions platform/pc/drv/ps2/kbd/kbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,12 +306,37 @@ void key_handler_util(int key)
}
else if (key == 'c' || key == 'C')
{
skip_prints = true;
exit_set__shell = false;
is_read = false;
cmds [CMD_BONESHELL_INDEX]->handler ("boneshell");
kbd_info.key = KBD_ENTER_PRESS_ID;
key_handler();
return;
}
else if (key == 't' || key == 'T')
{
if ((int)index_scank - virtual_cursor_pos < 2)
return;

if (virtual_index_scank == (int)index_scank)
{
volatile char temp_char = buffer_scank [index_scank - 1];
buffer_scank [index_scank - 1] = buffer_scank [index_scank - 2];
buffer_scank [index_scank - 2] = temp_char;

printk ("\b\b");
printk ("%c%c", buffer_scank [index_scank - 2], buffer_scank [index_scank - 1]);
return;
}

volatile char temp_char = buffer_scank [index_scank - (1 + virtual_cursor_pos)];
buffer_scank [index_scank - (1 + virtual_cursor_pos)] = buffer_scank [index_scank - (2 + virtual_cursor_pos)];
buffer_scank [index_scank - (2 + virtual_cursor_pos)] = temp_char;

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);

return;
}
}
Expand Down

0 comments on commit bbb2615

Please sign in to comment.