mirror of
https://gittea.dev/nova/th.git
synced 2025-12-09 09:10:10 -05:00
Compare commits
2 Commits
67b99b1cec
...
0970c43c37
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0970c43c37 | ||
|
|
79f8c82338 |
@@ -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){
|
||||||
@@ -473,9 +473,7 @@ void delete(){
|
|||||||
recursive_delete(mid_content[i]);
|
recursive_delete(mid_content[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(btm_buffer);
|
|
||||||
} else {
|
} else {
|
||||||
free(btm_buffer);
|
|
||||||
if (mid_content[selected_file_current].file_type & FILE_TYPE_DIR) {
|
if (mid_content[selected_file_current].file_type & FILE_TYPE_DIR) {
|
||||||
recursive_delete(mid_content[selected_file_current]);
|
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 {
|
} else {
|
||||||
free(btm_buffer);
|
|
||||||
free(cmd);
|
free(cmd);
|
||||||
cmd = concat((char*)key_binding[index].black_magic, " \"");
|
cmd = concat((char*)key_binding[index].black_magic, " \"");
|
||||||
cmd = concat(cmd, mid_content[selected_file_current].file_name);
|
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);*/
|
/*system(cmd);*/
|
||||||
free(cmd);
|
free(cmd);
|
||||||
|
|
||||||
} else {
|
|
||||||
free(btm_buffer);
|
|
||||||
memcpy(btm_buffer, "cancled deletion", strlen("cancled deletion"));
|
|
||||||
}
|
}
|
||||||
free(btm_buffer);
|
free(btm_buffer);
|
||||||
btm_buffer = btm_buffer_tmp;
|
btm_buffer = btm_buffer_tmp;
|
||||||
|
|||||||
Reference in New Issue
Block a user