sfm

simple file manager
git clone git://git.afify.dev/sfm
Log | Files | Refs | README | LICENSE

commit 9104d4d90aa27ff1c10c39424578ee6207266aef
parent 2fbe272663660dae2786c70a56aba7b27c6c066e
Author: afify <hassan@afify.dev>
Date:   Sat, 27 Feb 2021 08:56:51 +0300

[fix] moving after filter

- problem: start_filter() set cpane->filter then listdir(), listdir
again without setting *filter to NULL and user_input is freed.

- solution: set *filter to NULL after listdir

Diffstat:
Mconfig.def.h | 2+-
Msfm.c | 5+++--
2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -71,7 +71,7 @@ static Key nkeys[] = { { {.ch = 'N'}, crnd }, { {.ch = 'd'}, delfd }, { {.ch = 'x'}, calcdir }, - { {.ch = '/'}, filter }, + { {.ch = '/'}, start_filter }, { {.ch = 'q'}, quit }, { {.ch = 'v'}, start_vmode }, { {.ch = 'y'}, yank }, diff --git a/sfm.c b/sfm.c @@ -151,7 +151,7 @@ static int read_events(void); static void rmwatch(Pane *); static void fsev_shdn(void); static ssize_t findbm(uint32_t); -static void filter(void); +static void start_filter(void); static void start_vmode(void); static void exit_vmode(void); static void selup(void); @@ -1349,7 +1349,7 @@ findbm(uint32_t event) } static void -filter(void) +start_filter(void) { if (cpane->dirc < 1) return; @@ -1362,6 +1362,7 @@ filter(void) cpane->filter = user_input; if (listdir(AddHi) < 0) print_error("no match"); + cpane->filter = NULL; free(user_input); }