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

Compare commits

..

2 Commits

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){
@@ -473,9 +473,7 @@ void delete(){
recursive_delete(mid_content[i]);
}
}
free(btm_buffer);
} else {
free(btm_buffer);
if (mid_content[selected_file_current].file_type & FILE_TYPE_DIR) {
recursive_delete(mid_content[selected_file_current]);
}
@@ -703,10 +701,7 @@ void cmd_on_selected(unsigned long passes, int index){
}
}
}
free(btm_buffer);
memcpy(btm_buffer, "completed: ", strlen("completed: "));
} else {
free(btm_buffer);
free(cmd);
cmd = concat((char*)key_binding[index].black_magic, " \"");
cmd = concat(cmd, mid_content[selected_file_current].file_name);
@@ -720,9 +715,6 @@ void cmd_on_selected(unsigned long passes, int index){
/*system(cmd);*/
free(cmd);
} else {
free(btm_buffer);
memcpy(btm_buffer, "cancled deletion", strlen("cancled deletion"));
}
free(btm_buffer);
btm_buffer = btm_buffer_tmp;