improventments to navigation\; now ignoring inputs without associated binding. beginning of enter_shell
This commit is contained in:
@@ -72,6 +72,8 @@ void user_interactions() {
|
|||||||
mvaddstr(terminal_height-1, (terminal_width/3)*2, input);
|
mvaddstr(terminal_height-1, (terminal_width/3)*2, input);
|
||||||
input_pass++;
|
input_pass++;
|
||||||
if (ch == 27) { /* esc key */
|
if (ch == 27) { /* esc key */
|
||||||
|
memset(input, ' ', terminal_width);
|
||||||
|
mvaddstr(terminal_height-1, (terminal_width/3)*2, input);
|
||||||
memset(input, 0, 255);
|
memset(input, 0, 255);
|
||||||
input_pass = 0;
|
input_pass = 0;
|
||||||
timeout(100); /* blocking timeout of getch() */
|
timeout(100); /* blocking timeout of getch() */
|
||||||
@@ -85,6 +87,7 @@ void user_interactions() {
|
|||||||
|
|
||||||
void (*func_ptr)(int, int);
|
void (*func_ptr)(int, int);
|
||||||
int number_length = 0;
|
int number_length = 0;
|
||||||
|
|
||||||
if (!binding_pass) {
|
if (!binding_pass) {
|
||||||
parsed_input_number = 0;
|
parsed_input_number = 0;
|
||||||
while((*input >= '0') && (*input <= '9')) {
|
while((*input >= '0') && (*input <= '9')) {
|
||||||
@@ -106,23 +109,24 @@ void user_interactions() {
|
|||||||
func_ptr = key_binding[i].func;
|
func_ptr = key_binding[i].func;
|
||||||
func_ptr(parsed_input_number, i);
|
func_ptr(parsed_input_number, i);
|
||||||
|
|
||||||
|
} else if (strncmp(input+number_length, key_binding[i].key, cmp_len) == 0) {
|
||||||
|
binding_matches++;
|
||||||
|
mvwprintw(stdscr, terminal_height-binding_matches-1, 0, "\t\t\t");
|
||||||
|
mvwprintw(stdscr, terminal_height-binding_matches-1, 0, "%s\t%s", key_binding[i].key, key_binding[i].comment);
|
||||||
|
status |= STATUS_INPUT_MATCH;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (status & STATUS_INPUT_MATCH) {
|
||||||
|
attron(A_UNDERLINE);
|
||||||
|
mvaddstr(terminal_height-binding_matches-2, 0, "input\tcommand\t\t");
|
||||||
|
attroff(A_UNDERLINE);
|
||||||
|
status &= ~STATUS_INPUT_MATCH;
|
||||||
|
} else {
|
||||||
memset(input, 0, 255);
|
memset(input, 0, 255);
|
||||||
input_pass = 0;
|
input_pass = 0;
|
||||||
binding_pass = 0;
|
binding_pass = 0;
|
||||||
number_length = 0;
|
number_length = 0;
|
||||||
timeout(100); /* blocking timeout of getch() */
|
timeout(100); /* blocking timeout of getch() */
|
||||||
} else if (strncmp(input+number_length, key_binding[i].key, cmp_len) == 0) {
|
|
||||||
binding_matches++;
|
|
||||||
attron(A_UNDERLINE);
|
|
||||||
mvaddstr(terminal_height-binding_matches-2, 0, "input");
|
|
||||||
mvaddstr(terminal_height-binding_matches-2, sizeof("input"), "\t\t\t");
|
|
||||||
mvaddstr(terminal_height-binding_matches-2, sizeof("input") + sizeof("\t\t\t"), "command");
|
|
||||||
attroff(A_UNDERLINE);
|
|
||||||
mvaddstr(terminal_height-binding_matches-1, 0, key_binding[i].key);
|
|
||||||
mvaddstr(terminal_height-binding_matches-1, 0, key_binding[i].key);
|
|
||||||
mvaddstr(terminal_height-binding_matches-1, sizeof(key_binding[i].key), "\t");
|
|
||||||
mvaddstr(terminal_height-binding_matches-1, sizeof(key_binding[i].key) + sizeof("\t"), key_binding[i].comment);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -504,6 +508,11 @@ void makefile(){
|
|||||||
void update(){
|
void update(){
|
||||||
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY | STATUS_UPDATE_SCREEN_RELOAD_FULL);
|
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY | STATUS_UPDATE_SCREEN_RELOAD_FULL);
|
||||||
}
|
}
|
||||||
|
void enter_shell(int passes, int index){
|
||||||
|
if (system(key_binding[index].black_magic) != 0) {
|
||||||
|
/*do nothing*/
|
||||||
|
}
|
||||||
|
}
|
||||||
void not_implemented(int passes, int index){
|
void not_implemented(int passes, int index){
|
||||||
mvaddstr(terminal_height-1, 0, key_binding[index].comment);
|
mvaddstr(terminal_height-1, 0, key_binding[index].comment);
|
||||||
mvaddstr(terminal_height-1, strlen(key_binding[index].comment), "\t");
|
mvaddstr(terminal_height-1, strlen(key_binding[index].comment), "\t");
|
||||||
|
Reference in New Issue
Block a user