Compare commits
2
Commits
7a3de19314
...
cebacc7017
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cebacc7017 | ||
|
|
edab9a62ad |
@@ -319,16 +319,15 @@ void dir_changed(){
|
|||||||
}
|
}
|
||||||
void change_dir(char *new_path){
|
void change_dir(char *new_path){
|
||||||
|
|
||||||
const char *old_path = global_path;
|
|
||||||
current_linked_dir = list_beginning;
|
current_linked_dir = list_beginning;
|
||||||
while (current_linked_dir->next != NULL) {
|
while (current_linked_dir->next != NULL) {
|
||||||
if(strcmp(current_linked_dir->path, old_path) == 0) {
|
if(strcmp(current_linked_dir->path, global_path) == 0) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
current_linked_dir = current_linked_dir->next;
|
current_linked_dir = current_linked_dir->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(strcmp(current_linked_dir->path, old_path) == 0) {
|
if(strcmp(current_linked_dir->path, global_path) == 0) {
|
||||||
current_linked_dir->index = mid_dir.current_file - mid_dir.file_list;
|
current_linked_dir->index = mid_dir.current_file - mid_dir.file_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,21 +337,22 @@ void change_dir(char *new_path){
|
|||||||
* especially in like 2 years when i even forgot about this possibility */
|
* especially in like 2 years when i even forgot about this possibility */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
char *new_path_real = getcwd(NULL, 0);
|
free(global_path);
|
||||||
|
global_path = getcwd(NULL, 0);
|
||||||
|
|
||||||
current_linked_dir = list_beginning;
|
current_linked_dir = list_beginning;
|
||||||
while (current_linked_dir->next != NULL) {
|
while (current_linked_dir->next != NULL) {
|
||||||
if(strcmp(current_linked_dir->path, new_path_real) == 0) {
|
if(strcmp(current_linked_dir->path, global_path) == 0) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
current_linked_dir = current_linked_dir->next;
|
current_linked_dir = current_linked_dir->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(strcmp(current_linked_dir->path, new_path_real) != 0) {
|
if(strcmp(current_linked_dir->path, global_path) != 0) {
|
||||||
current_linked_dir->next = malloc(sizeof(linked_dir));
|
current_linked_dir->next = malloc(sizeof(linked_dir));
|
||||||
current_linked_dir = current_linked_dir->next;
|
current_linked_dir = current_linked_dir->next;
|
||||||
current_linked_dir->path = malloc(strlen(new_path_real)+1);
|
current_linked_dir->path = malloc(strlen(global_path)+1);
|
||||||
memcpy(current_linked_dir->path, new_path_real, strlen(new_path_real)+1);
|
memcpy(current_linked_dir->path, global_path, strlen(global_path)+1);
|
||||||
current_linked_dir->next = NULL;
|
current_linked_dir->next = NULL;
|
||||||
current_linked_dir->index = 0;
|
current_linked_dir->index = 0;
|
||||||
/*TODO(2026-05-25T22:49:30)
|
/*TODO(2026-05-25T22:49:30)
|
||||||
@@ -360,8 +360,6 @@ void change_dir(char *new_path){
|
|||||||
}
|
}
|
||||||
mid_dir.current_file = &mid_dir.file_list[current_linked_dir->index];
|
mid_dir.current_file = &mid_dir.file_list[current_linked_dir->index];
|
||||||
|
|
||||||
free(new_path_real);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dir_init(){
|
void dir_init(){
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ unsigned int terminal_width;
|
|||||||
unsigned int temp_heigth = 0; /*used for screen refresh*/
|
unsigned int temp_heigth = 0; /*used for screen refresh*/
|
||||||
unsigned int temp_width = 0;
|
unsigned int temp_width = 0;
|
||||||
unsigned int file_modifiers = 0;
|
unsigned int file_modifiers = 0;
|
||||||
unsigned int status = (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_CLEAR | STATUS_UPDATE_SCREEN_RESIZE | STATUS_RELOAD_DIRECTORY) & ~STATUS_UPDATE_SCREEN_RESIZE;
|
unsigned int status = (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_CLEAR | STATUS_UPDATE_SCREEN_RESIZE | STATUS_RELOAD_DIRECTORY);
|
||||||
char *global_path;
|
char *global_path;
|
||||||
time_t seed;
|
time_t seed;
|
||||||
|
|
||||||
@@ -75,13 +75,19 @@ int main(){
|
|||||||
|
|
||||||
timeout(SETTINGS_CURSES_TIMEOUT);
|
timeout(SETTINGS_CURSES_TIMEOUT);
|
||||||
|
|
||||||
|
/* initial render pass to speed first render up,
|
||||||
|
* yes this only skips SETTINGS_CURSES_TIMEOUT, which by default is 100ms,
|
||||||
|
* but i started to write th out of spite; because anything else either is too slow and unresponsive
|
||||||
|
* or i just dont like their ux.
|
||||||
|
* will i ever make use of the 100ms? will i ever react and do faster inputs? no
|
||||||
|
* does it feel more responsive? sure does */
|
||||||
|
pthread_cond_signal(&cond_mid);
|
||||||
|
render_pass();
|
||||||
|
|
||||||
while(!(status & STATUS_QUIT_PROGRAM)){
|
while(!(status & STATUS_QUIT_PROGRAM)){
|
||||||
getmaxyx(stdscr, terminal_height, terminal_width);
|
getmaxyx(stdscr, terminal_height, terminal_width);
|
||||||
|
|
||||||
if (status & STATUS_RUN_BACKEND) {
|
if (status & STATUS_RUN_BACKEND) {
|
||||||
free(global_path);
|
|
||||||
global_path = getcwd(NULL, 0);
|
|
||||||
pthread_cond_signal(&cond_mid);
|
pthread_cond_signal(&cond_mid);
|
||||||
pthread_cond_signal(&cond_lft);
|
pthread_cond_signal(&cond_lft);
|
||||||
status &= ~(STATUS_RUN_BACKEND);
|
status &= ~(STATUS_RUN_BACKEND);
|
||||||
|
|||||||
Reference in New Issue
Block a user