break;
case 'j': workdir_next(state_get_focused_frame()->workdir); break;
case 'k': workdir_prev(state_get_focused_frame()->workdir); break;
- //case 'e': workdir_cd(state_get_focused_frame()->workdir); break;
+ case 'e': workdir_cd(state_get_focused_frame()->workdir); break;
case 'n': screen_open();
break;
case 'c': screen_close();
-#include "screen.h"
-#include "state.h"
-#include "aardvark.h"
-#include "workdir.h"
+/* external libraries */
#include <ncurses.h>
#include <unistd.h>
+#include <stdio.h>
+
+/* internal libraries */
#include "vec.h"
#include "mem.h"
+/* internal headers */
+#include "screen.h"
+#include "state.h"
+#include "aardvark.h"
+#include "workdir.h"
+
static void screen_place_windows(void);
static frame_t* screen_frame_new(void);
static void screen_frame_free(void* p_frame);
} else {
newpath = mem_allocate(sizeof(char)*last_slash, NULL);
strncpy(newpath, wd->path, last_slash);
- newpath[last_slash-1]=0;
+ newpath[last_slash] = 0;
}
- mem_release(wd->path);
- wd->path = newpath;
+ return newpath;
}
//go down a directory: append '/subdir' to path
}
void workdir_cd(WorkDir_T* wd) {
- char* newpath = (wd->idx == 0) ? workdir_cd_up(wd) : workdir_cd_down(wd);
+ char* newpath = (wd->idx == 0) ? workdir_cd_up(wd) : workdir_cd_down(wd);
if(is_dir(newpath)){
- mem_release(wd->path);
+ //TODO: this segfaults: mem_release(wd->path);
wd->path = newpath;
wd->idx = 0;
wd->top_index = 0;
}
- //TODO: refresh file list
+ workdir_ls(wd);
}
void workdir_ls(WorkDir_T* wd){