1
0
mirror of https://gittea.dev/nova/th.git synced 2025-12-09 09:10:10 -05:00

printing of possible bindings now persist through SETTINGS_RELOAD_DIR_DELTA

This commit is contained in:
nova
2025-11-04 21:33:34 +01:00
parent 79f8c82338
commit 0970c43c37

View File

@@ -41,7 +41,6 @@ extern char *input;
extern time_t *seed;
char search_buffer[INPUT_BUFFER_SIZE];
unsigned int timeout_time = 0;
unsigned int input_pass;
unsigned long parsed_input_number;
yank yank_files = { 0 };
@@ -72,7 +71,6 @@ void user_interactions() {
if(ch != ERR) {
timeout(10); /* blocking timeout of getch() */
input[input_pass] = ch;
mvaddstr(terminal_height-1, (terminal_width/3)*2, input);
input_pass++;
if (ch == 27) { /* esc key */
memset(input, ' ', terminal_width);
@@ -86,6 +84,7 @@ void user_interactions() {
} else {
timeout(100);
}
mvaddstr(terminal_height-1, (terminal_width/3)*2, input);
@@ -101,36 +100,37 @@ void user_interactions() {
}
input -= number_length;
binding_pass = 1;
}
char cmp_len = strlen(input);
if(strlen(input) < 1) {
cmp_len++;
}
for (i = 0; i < binding_count; i++) {
char cmp_len = strlen(input);
if(strlen(input) < 1) {
cmp_len++;
}
for (i = 0; i < binding_count; i++) {
if (strncmp(input + number_length, key_binding[i].key, cmp_len) == 0) {
if (strcmp(input + number_length, key_binding[i].key) == 0) {
func_ptr = key_binding[i].func;
func_ptr(parsed_input_number, i);
} else if (strncmp(input + number_length, key_binding[i].key, cmp_len) == 0) {
} else {
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);
mvwprintw(stdscr, terminal_height-binding_matches-2, 0, "input\tcommand\t\t");
attroff(A_UNDERLINE);
status &= ~STATUS_INPUT_MATCH;
} else if (number_length != strlen(input)) {
memset(input, 0, INPUT_BUFFER_SIZE);
input_pass = 0;
binding_pass = 0;
number_length = 0;
timeout(100); /* blocking timeout of getch() */
}
}
if (status & STATUS_INPUT_MATCH) {
attron(A_UNDERLINE);
mvwprintw(stdscr, terminal_height-binding_matches-2, 0, "input\tcommand\t\t");
attroff(A_UNDERLINE);
status &= ~STATUS_INPUT_MATCH;
} else if (number_length != strlen(input)) {
memset(input, 0, INPUT_BUFFER_SIZE);
input_pass = 0;
binding_pass = 0;
number_length = 0;
binding_matches = 0;
timeout(100); /* blocking timeout of getch() */
}
}
int read_string(WINDOW *win, int y, int x, char *str){