1
0
mirror of https://gittea.dev/nova/th.git synced 2025-10-21 18:30:15 -04:00

linked list to keep track of past directory indexes

This commit is contained in:
nova
2025-08-18 21:07:18 +02:00
parent 55cd4077b1
commit f25768d522
5 changed files with 57 additions and 1 deletions

View File

@@ -197,6 +197,7 @@ void move_down(int passes){
selected_file_current += passes;
update_selected_file();
dir_set_selected_file_current(selected_file_current);
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_0);
pthread_mutex_unlock(&mutex_selection);
@@ -213,6 +214,7 @@ void move_up(int passes){
}
update_selected_file();
dir_set_selected_file_current(selected_file_current);
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK);
pthread_mutex_unlock(&mutex_selection);
@@ -226,6 +228,8 @@ void move_left(int passes){
if (chdir("..") != 0) {
/* TODO(2025-07-09T00:30:05) fix */
FAIL("move_left", "unhandled error of chdir");
} else {
selected_file_current = dir_get_selected_file_current();
}
}
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY);
@@ -234,6 +238,8 @@ void move_right(){
if (file_current->file_type == FILE_TYPE_DIR || file_current->file_type == FILE_TYPE_SYMLINK) {
if (chdir(file_current->file_name) != 0) {
FAIL("move_right", "unhandled error of chdir");
} else {
selected_file_current = dir_get_selected_file_current();
}
} else {
unsigned long i = 0;
@@ -291,6 +297,7 @@ void jump_bottom(){
pthread_mutex_lock(&mutex_selection);
selected_file_current = 0 - 1;
update_selected_file();
dir_set_selected_file_current(selected_file_current);
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK);
pthread_mutex_unlock(&mutex_selection);
}
@@ -298,6 +305,7 @@ void jump_top(){
pthread_mutex_lock(&mutex_selection);
selected_file_current = 0;
update_selected_file();
dir_set_selected_file_current(selected_file_current);
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK);
pthread_mutex_unlock(&mutex_selection);
}
@@ -566,6 +574,8 @@ void jump_to_dir(int passes, int index){
}
if (chdir(path) != 0) {
FAIL("jump_to_dir", "jumping to black_magic in config.h failed");
} else {
selected_file_current = dir_get_selected_file_current();
}
/*env_parsed shall not be modified (read: free'd) - the man page*/
@@ -774,8 +784,8 @@ void search(){
for (i = 0; i < mid_file_count; i++) {
if (smartstrcasestr(mid_content[i].file_name, search_buffer)) {
selected_file_current = i;
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_0);
update_selected_file();
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_0);
render_pass();
break;
}