fe
terminal file explorer and picker
git clone https://9o.is/git/fe.git
commit 92006568f975ff5e11e6c6170d227e97124ab2e6 parent fb854e640b1eb062712e54512481dd4ca4e16aa8 Author: Jul <jul@9o.is> Date: Tue, 27 Jan 2026 03:40:11 -0500 add 'r' keybinding for reloading file listing Diffstat:
| M | config.def.h | | | 1 | + |
| M | entries.c | | | 7 | +++++++ |
| M | entries.h | | | 1 | + |
| M | tty_interface.c | | | 6 | ++++++ |
| M | tty_interface.h | | | 1 | + |
5 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/config.def.h b/config.def.h @@ -33,6 +33,7 @@ static const keybinding_t keybindings[] = { {KEY_CTRL('U'), action_halfpageup, NULL}, /* C-U */ {KEY_CTRL('D'), action_halfpagedown, NULL}, /* C-D */ {KEY('q'), action_exit, NULL}, /* q */ + {KEY('r'), action_reload, NULL}, /* r */ {KEY('g'), action_first, NULL}, /* g */ {KEY('G'), action_last, NULL}, /* G */ {KEY('~'), action_home, NULL}, /* ~ */ diff --git a/entries.c b/entries.c @@ -417,3 +417,10 @@ int entries_find_file(entries_t *entries, const char *filename) { } return -1; } + +void entries_reload(entries_t *entries) { + char *name = entries->dents[entries->selection].name; + set_directory(entries, entries->path); + int index = entries_find_file(entries, name); + entries_position(entries, (size_t)index); +} diff --git a/entries.h b/entries.h @@ -25,6 +25,7 @@ void entries_init(entries_t *entries, const options_t *options); void entries_init_path(entries_t *entries, const char *path); void entries_init_stdinpath(entries_t *entries); void entries_destroy(entries_t *entries); +void entries_reload(entries_t *entries); void entries_parent(entries_t *entries); void entries_prev(entries_t *entries); void entries_next(entries_t *entries); diff --git a/tty_interface.c b/tty_interface.c @@ -174,6 +174,12 @@ void action_select(tty_interface_t *state, const char *argv) { } } +void action_reload(tty_interface_t *state, const char *argv) { + (void)argv; + entries_reload(state->entries); + draw(state); +} + void action_parent(tty_interface_t *state, const char *argv) { (void)argv; entries_parent(state->entries); diff --git a/tty_interface.h b/tty_interface.h @@ -19,6 +19,7 @@ int tty_interface_run(tty_interface_t *state); void action_ignore(tty_interface_t *state, const char *argv); void action_select(tty_interface_t *state, const char *argv); +void action_reload(tty_interface_t *state, const char *argv); void action_parent(tty_interface_t *state, const char *argv); void action_prev(tty_interface_t *state, const char *argv); void action_next(tty_interface_t *state, const char *argv);