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

varrious small changes

This commit is contained in:
nova
2025-11-09 17:40:56 +01:00
parent 5b7f017588
commit 5287c77648
3 changed files with 30 additions and 50 deletions

View File

@@ -64,53 +64,42 @@ void user_interactions() {
char ch;
unsigned long i;
unsigned long binding_matches = 0;
static char binding_pass = 0;
ch = getch();
if(ch != ERR) {
timeout(10); /* blocking timeout of getch() */
input[input_pass] = ch;
input_pass++;
if (ch == 27) { /* esc key */
memset(input, ' ', terminal_width);
mvaddstr(terminal_height-1, (terminal_width/3)*2, input);
memset(input, 0, INPUT_BUFFER_SIZE);
input_pass = 0;
timeout(100); /* blocking timeout of getch() */
}
binding_pass = 0;
status |= STATUS_UPDATE_SCREEN_0;
} else {
timeout(100);
}
mvaddstr(terminal_height-1, (terminal_width/3)*2, input);
void (*func_ptr)(int, int);
unsigned long number_length = 0;
if (!binding_pass) {
parsed_input_number = 0;
while((*input >= '0') && (*input <= '9')) {
parsed_input_number = (parsed_input_number * 10) + (*input - '0');
input++;
number_length++;
}
input -= number_length;
binding_pass = 1;
parsed_input_number = 0;
while((*input >= '0') && (*input <= '9')) {
parsed_input_number = (parsed_input_number * 10) + (*input - '0');
input++;
number_length++;
}
input -= number_length;
char cmp_len = strlen(input);
if(strlen(input) < 1) {
cmp_len++;
cmp_len = 1;
}
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);
timeout(SETTINGS_CURSES_TIMEOUT); /* blocking timeout of getch() */
} else {
binding_matches++;
mvwprintw(stdscr, terminal_height-binding_matches-1, 0, "\t\t\t");
@@ -127,10 +116,8 @@ void user_interactions() {
} 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){
@@ -169,7 +156,6 @@ int read_string(WINDOW *win, int y, int x, char *str){
}
str[pass] = '\0';
timeout(100);
curs_set(0);
return err;
@@ -487,7 +473,6 @@ void delete(){
free(file_str);
}
timeout(10);
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY | STATUS_UPDATE_SCREEN_RELOAD_FULL);
pthread_mutex_unlock(&mutex_btm);
@@ -719,7 +704,6 @@ void cmd_on_selected(unsigned long passes, int index){
free(btm_buffer);
btm_buffer = btm_buffer_tmp;
timeout(10);
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY | STATUS_UPDATE_SCREEN_RELOAD_FULL);
if (hits) {
@@ -900,7 +884,6 @@ void search(){
}
search_buffer[pass] = '\0';
timeout(10);
curs_set(0);
dir_set_selected_file_current(selected_file_current);