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