diff options
| author | verdant <im@verdant.ee> | 2026-07-27 09:26:02 +0800 |
|---|---|---|
| committer | verdant <im@verdant.ee> | 2026-07-27 09:26:02 +0800 |
| commit | 48ca0d55b562230644e5f71597979c8d813b80e2 (patch) | |
| tree | f1309624a546c76c9a638500456cbeb82b1d12a5 /fm.h | |
| parent | a988bc1eb3c0dbc0ce3ccd0f3422a459a9e61295 (diff) | |
| download | sf-48ca0d55b562230644e5f71597979c8d813b80e2.tar.gz sf-48ca0d55b562230644e5f71597979c8d813b80e2.zip | |
Refactor fm
Diffstat (limited to 'fm.h')
| -rw-r--r-- | fm.h | 37 |
1 files changed, 25 insertions, 12 deletions
@@ -4,9 +4,15 @@ #include <limits.h> #include <linux/limits.h> #include <ncurses.h> +#include <stdbool.h> #include "wm.h" +#define PANE_LEFT 0 +#define PANE_RIGHT 1 + +#define MARGIN 3 + typedef struct { char name[256]; int is_dir; @@ -14,26 +20,33 @@ typedef struct { typedef struct { file_item *items; - int count; - int cap; + size_t count; + size_t cap; } file_list; typedef struct { file_list *cur; file_list *next; - int selected_idx; - window *fm_l, *fm_r; - int got_next_dir; + int cursor; + window *windows[2]; + /* int got_next_dir; */ char got_dir[PATH_MAX]; char cwd[PATH_MAX]; - int top, bottom, margin_bottom; - int needs_redraw; + int top, bottom; + bool need_redraw; } fm_info; -void fm_getdir(fm_info *i, file_list *l, const char *path); +file_list *fm_getdir(file_list *list, const char *path); fm_info *fm_init(terminal *t); -void fm_getcwd(fm_info *f); -void fm_draw_entries(fm_info *i, int n, int m); -void fm_entries_scrool(terminal *t, fm_info *i, int n); -void fm_draw_right_window(fm_info *i); +void fm_getcwd(fm_info *info); +void fm_draw_entries(window *window, file_list *list, size_t cursor, int top, + int bottom); +void fm_entries_scroll(fm_info *info, int n); +/* void fm_draw_right_window(fm_info *i); */ + +void fm_cd_up(fm_info *i); +void fm_cd_down(fm_info *i); +bool fm_preview_file(window *w, const char *path); +void magic_init(void); +void magic_cleanup(void); #endif /* SF_FM_H */ |
