From: a bellenir Date: Sun, 3 Aug 2014 20:40:57 +0000 (+0000) Subject: perform ls when reloading a frame. add 'r' keyboard shortcut to reload current frame... X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=refs%2Fheads%2F88;p=archive%2Fafm.git perform ls when reloading a frame. add 'r' keyboard shortcut to reload current frame (R still reloads all, but with ls) --- diff --git a/source/frame.c b/source/frame.c index ab21844..65b81ab 100644 --- a/source/frame.c +++ b/source/frame.c @@ -152,3 +152,9 @@ void frame_set_highlighting(Frame_T* frame, bool highlight, bool refresh_win){ } } +void frame_reload(Frame_T* frame){ + workdir_ls(frame->workdir); + frame_draw_files(frame); + state_set_refresh_state(REFRESH_CURR_WIN); +} + diff --git a/source/frame.h b/source/frame.h index a22ec95..1e34fa1 100644 --- a/source/frame.h +++ b/source/frame.h @@ -24,6 +24,7 @@ void frame_page_up(Frame_T* p_frame); void frame_page_down(Frame_T* p_frame); void frame_draw_files(Frame_T* frame); //TODO: name pointers consistently void frame_set_highlighting(Frame_T* frame, bool highlight, bool refresh_win); +void frame_reload(Frame_T* frame); #endif /* FRAME_H */ diff --git a/source/input.c b/source/input.c index 64d1a7d..908ea5a 100644 --- a/source/input.c +++ b/source/input.c @@ -74,8 +74,8 @@ static void handle_collapse(void){ workdir_collapse_selected(state_get_focused_workdir()); } -void handle_force_redraw(void){ - state_set_refresh_state(REFRESH_ALL_WINS); +void handle_reload_frame(void){ + frame_reload(state_get_focused_frame()); } void handle_search_mode(void){ @@ -101,9 +101,10 @@ static binding_t Default_Bindings[] = { { "wk", &screen_focus_prev }, { "wm", &screen_focus_master }, { "w\n", &screen_swap_with_master }, - { "wJ", &screen_swap_frame_next }, - { "wK", &screen_swap_frame_prev }, - { "R", &handle_force_redraw } + { "wJ", &screen_swap_frame_next }, + { "wK", &screen_swap_frame_prev }, + { "R", &screen_reload_all_frames }, + { "r", &handle_reload_frame } }; static void normal_mode(void); diff --git a/source/screen.c b/source/screen.c index f5bbbe6..b39d7ec 100644 --- a/source/screen.c +++ b/source/screen.c @@ -214,3 +214,12 @@ void screen_swap_frame_prev(void){ } } +void screen_reload_all_frames(void){ + list_node_t* node = Frame_List->head; + while(NULL != node){ + frame_reload((Frame_T*)node->contents); + node = node->next; + } + state_set_refresh_state(REFRESH_ALL_WINS); +} + diff --git a/source/screen.h b/source/screen.h index f081117..7af80f7 100644 --- a/source/screen.h +++ b/source/screen.h @@ -18,5 +18,6 @@ void screen_focus_master(void); void screen_swap_with_master(void); void screen_swap_frame_next(void); void screen_swap_frame_prev(void); +void screen_reload_all_frames(void); #endif /* SCREEN_H */