removed the need for a second input pass by making window global

This commit is contained in:
nova
2025-06-26 22:52:05 +02:00
parent 01fe19866c
commit f2eaeee9ea
2 changed files with 23 additions and 24 deletions

View File

@ -19,26 +19,17 @@ extern file *lft_content;
extern file *rgt_content;
extern file file_current;
extern WINDOW *win_b;
extern char *rgt_buffer;
extern char *btm_buffer;
extern unsigned int status;
void open_with_pass_2();
void rename_hovered_pass_2();
int read_string(WINDOW *win, int y, int x, char *str);
void user_interactions(char *input, WINDOW *win_b) {
void (*func_ptr)();
unsigned long i = 0;
if (status & STATUS_INTERACTIONS_MASK) {
if (status & STATUS_INTERACTIONS_OPEN_WITH) {
open_with_pass_2(win_b);
} else if (status & STATUS_INTERACTIONS_RENAME) {
rename_hovered_pass_2(win_b);
}
}
for (i = 0; i < binding_count; i++) {
if (*input == key_binding[i].key[0]) {
func_ptr = key_binding[i].func;
@ -156,9 +147,7 @@ void open_with(){
btm_buffer = concat(btm_buffer, "\" with:");
status |= (STATUS_UPDATE_SCREEN_0 | STATUS_INTERACTIONS_OPEN_WITH);
}
void open_with_pass_2(WINDOW *win_b){
render_pass();
unsigned long local_width;
unsigned long local_height;
getmaxyx(win_b, local_height, local_width);
@ -194,9 +183,7 @@ void rename_hovered(){
btm_buffer = concat(btm_buffer, "\" to:");
status |= (STATUS_UPDATE_SCREEN_0 | STATUS_INTERACTIONS_RENAME);
}
void rename_hovered_pass_2(WINDOW *win_b){
render_pass();
unsigned long local_width;
unsigned long local_height;
@ -225,3 +212,4 @@ void rename_hovered_pass_2(WINDOW *win_b){
free(str);
}