fixed scroll location on file change bug

This commit is contained in:
Allen Webster 2016-06-06 12:56:22 -04:00
parent bfb02009d6
commit b6f86f4f8d
3 changed files with 37 additions and 25 deletions

35
4ed.cpp
View File

@ -3803,6 +3803,8 @@ App_Step_Sig(app_step){
active = (panel == cmd->panel);
summary = (active)?(active_input):(dead_input);
view->changed_context_in_step = 0;
View_Step_Result result = step_file_view(system, view, active_view, summary);
if (result.animating){
app_result.animating = 1;
@ -3817,23 +3819,26 @@ App_Step_Sig(app_step){
for (dll_items(panel, used_panels)){
view = panel->view;
Assert(view->current_scroll);
active = (panel == cmd->panel);
summary = (active)?(active_input):(dead_input);
if (panel == mouse_panel && !input->mouse.out_of_window){
summary.mouse = mouse_state;
}
GUI_Scroll_Vars *vars = view->current_scroll;
// TODO(allen): I feel like the scroll context should actually not
// be allowed to change in here at all.
result = do_step_file_view(system, view, panel->inner, active,
&summary, *vars, view->scroll_region);
if (result.is_animating){
app_result.animating = 1;
if (view->changed_context_in_step == 0){
Assert(view->current_scroll);
active = (panel == cmd->panel);
summary = (active)?(active_input):(dead_input);
if (panel == mouse_panel && !input->mouse.out_of_window){
summary.mouse = mouse_state;
}
GUI_Scroll_Vars *vars = view->current_scroll;
// TODO(allen): I feel like the scroll context should actually not
// be allowed to change in here at all.
result = do_step_file_view(system, view, panel->inner, active,
&summary, *vars, view->scroll_region);
if (result.is_animating){
app_result.animating = 1;
}
*vars = result.vars;
view->scroll_region = result.region;
}
*vars = result.vars;
view->scroll_region = result.region;
}
}

View File

@ -234,6 +234,8 @@ struct View{
char dest_[256];
String dest;
b32 changed_context_in_step;
// theme stuff
View *hot_file_view;
u32 *palette;
@ -3070,6 +3072,7 @@ view_show_menu(View *view, Command_Map *gui_map){
view->map = gui_map;
view->showing_ui = VUI_Menu;
view->current_scroll = &view->gui_scroll;
view->changed_context_in_step = 1;
}
inline void
@ -3077,6 +3080,7 @@ view_show_config(View *view, Command_Map *gui_map){
view->map = gui_map;
view->showing_ui = VUI_Config;
view->current_scroll = &view->gui_scroll;
view->changed_context_in_step = 1;
}
inline void
@ -3097,6 +3101,7 @@ view_show_interactive(System_Functions *system, View *view,
hot_directory_clean_end(&models->hot_directory);
hot_directory_reload(system, &models->hot_directory, &models->working_set);
view->changed_context_in_step = 1;
}
inline void
@ -3107,6 +3112,7 @@ view_show_theme(View *view, Command_Map *gui_map){
view->color = super_color_create(0xFF000000);
view->current_color_editing = 0;
view->current_scroll = &view->gui_scroll;
view->changed_context_in_step = 1;
}
inline void
@ -3121,6 +3127,7 @@ view_show_file(View *view){
view->showing_ui = VUI_None;
view->current_scroll = &view->recent->scroll;
view->recent->scroll.max_y = view_compute_max_target_y(view);
view->changed_context_in_step = 1;
}
internal void

View File

@ -22,8 +22,8 @@ popd
pushd ..\build
REM call "..\code\buildsuper.bat" ..\code\4coder_default_bindings.cpp
REM call "..\code\buildsuper.bat" ..\code\power\4coder_experiments.cpp
call "..\code\buildsuper.bat" ..\code\power\4coder_casey.cpp
call "..\code\buildsuper.bat" ..\code\power\4coder_experiments.cpp
REM call "..\code\buildsuper.bat" ..\code\power\4coder_casey.cpp
if %ERRORLEVEL% neq 0 (set FirstError=1)
set EXPORTS=/EXPORT:app_get_functions