improventments to navigation\; now ignoring inputs without associated binding. beginning of enter_shell

This commit is contained in:
nova
2025-08-10 14:12:37 +02:00
parent 7ab04a5a87
commit 7b563894f7

View File

@@ -72,6 +72,8 @@ void user_interactions() {
mvaddstr(terminal_height-1, (terminal_width/3)*2, input);
input_pass++;
if (ch == 27) { /* esc key */
memset(input, ' ', terminal_width);
mvaddstr(terminal_height-1, (terminal_width/3)*2, input);
memset(input, 0, 255);
input_pass = 0;
timeout(100); /* blocking timeout of getch() */
@@ -85,6 +87,7 @@ void user_interactions() {
void (*func_ptr)(int, int);
int number_length = 0;
if (!binding_pass) {
parsed_input_number = 0;
while((*input >= '0') && (*input <= '9')) {
@@ -106,24 +109,25 @@ void user_interactions() {
func_ptr = key_binding[i].func;
func_ptr(parsed_input_number, i);
memset(input, 0, 255);
input_pass = 0;
binding_pass = 0;
number_length = 0;
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);
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);
input_pass = 0;
binding_pass = 0;
number_length = 0;
timeout(100); /* blocking timeout of getch() */
}
}
}
int read_string(WINDOW *win, int y, int x, char *str){
@@ -504,6 +508,11 @@ void makefile(){
void update(){
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){
mvaddstr(terminal_height-1, 0, key_binding[index].comment);
mvaddstr(terminal_height-1, strlen(key_binding[index].comment), "\t");