Skip to content

Commit

Permalink
Merge pull request #149 from Bone-Project/dev_ashish
Browse files Browse the repository at this point in the history
Fix #137
  • Loading branch information
double-fault authored Jan 12, 2017
2 parents 8ee6ab8 + 4d866ae commit 9cfcf6e
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 32 deletions.
8 changes: 8 additions & 0 deletions bin/boneshell/boneshell.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ int __found = 0;
volatile bool exit_set__shell = false;
volatile bool tab_multiple_opts = false;
volatile bool tab_one_opt = false;
volatile bool tab_zero_opt = false;
bool executed_internally=false;

void removeSpaces(char* source)
Expand Down Expand Up @@ -94,6 +95,7 @@ void loop_terminal()
video_drivers[VGA_VIDEO_DRIVER_INDEX]->bg = BG__;


//continue_read:
scank(true,true, "%s" , cmd_active.value);

if(tab_multiple_opts==true)
Expand All @@ -108,6 +110,12 @@ void loop_terminal()
executed_internally = true;
removeSpaces (cmd_active.value);
}
else if (tab_zero_opt == true)
{
key_handler_util_backspace();
tab_zero_opt = false;
scank (true, true, "%s", cmd_active.value + (strlen (cmd_active.value)));
}


//removeSpaces(cmd_active.value);
Expand Down
7 changes: 4 additions & 3 deletions include/apps/sh/shell.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <stdint.h>
#include <stdbool.h>

typedef enum
typedef enum
{
ROOT,
USER
Expand All @@ -25,7 +25,7 @@ struct cmd_t
char* usage;
char* help;
char* invalid_use_msg;
exec_prv privilege;
exec_prv privilege;
struct cmd_opt_t** cmd_opts;
int(*handler)(char* cmd);
};
Expand Down Expand Up @@ -58,7 +58,8 @@ extern struct cmd_t *cmds[];
extern volatile struct typed_cmd cmd_active;
extern volatile uint32_t cmd_active_index;
extern volatile bool tab_multiple_opts;
extern volatile bool tab_one_opt;
extern volatile bool tab_one_opt;
extern volatile bool tab_zero_opt;
volatile uint32_t shell_instance_cnt;

#endif /*_APPS_TERM_TERMINAL_H_*/
Expand Down
62 changes: 33 additions & 29 deletions platform/pc/drv/ps2/kbd/kbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,38 +241,42 @@ void key_handler_util_backspace()

void key_handler_util_tab()
{

printk("\n");
//char tab__ [1024];
int index_tab=0;
int num_cmds=0;
for(int i=0; cmds[i]; i++)
{
if(tab_util(buffer_scank, cmds[i]->name) == true)
{
num_cmds++;
for(int j=0; cmds[i]->name[j]; j++)
{
tab__[index_tab] = cmds[i]->name[j];
index_tab++;
int index_tab=0;
int num_cmds=0;
for(int i=0; cmds[i]; i++)
{
if(tab_util(buffer_scank, cmds[i]->name) == true)
{
num_cmds++;
for(int j=0; cmds[i]->name[j]; j++)
{
tab__[index_tab] = cmds[i]->name[j];
index_tab++;
}
for(int rep=0; rep<4; rep++)tab__[index_tab++] = ' ';
}
for(int rep=0; rep<4; rep++)tab__[index_tab++] = ' ';
}
}
tab__[index_tab] = 0;
if(num_cmds==1)
{
for(int i = 0; tab__[i]; i ++) {
printk("%c", tab__[i]);
cmd_active.value [i] = tab__ [i];
}
tab__[index_tab] = 0;
if(num_cmds==1)
{
printk ("\n");
for(int i = 0; tab__[i]; i ++) {
printk("%c", tab__[i]);
cmd_active.value [i] = tab__ [i];
}
tab_one_opt=true;
return;
}
return;
}

for(int i=0; tab__[i]; i++)
printk("%c", tab__[i]);
tab_multiple_opts=true;
if (num_cmds > 1) {
tab_multiple_opts=true;
printk ("\n");
for(int i=0; tab__[i]; i++)
printk("%c", tab__[i]);
}
else {
tab_zero_opt = true;
}
}


Expand Down Expand Up @@ -336,7 +340,7 @@ void key_handler()
key_handler_util_tab();
active_scank = false;
buffer_scank[index_scank] = 0;
if(print_scank == true) printk("\n");
if(print_scank == true && tab_zero_opt == false) printk("\n");
UP_KEY_ACTIVE = true; //Reset Up Key
TAB_PREVIOUS_VALUE_SET = true;
TAB_PREVIOUS_VALUE = buffer_scank;
Expand Down

0 comments on commit 9cfcf6e

Please sign in to comment.