another issue with new scroll-cursor tracking fixed

This commit is contained in:
Allen Webster 2016-05-20 13:45:38 -04:00
parent 5274c7c48d
commit 0ae66f5cdd
2 changed files with 20 additions and 20 deletions

14
4ed.cpp
View File

@ -4554,23 +4554,23 @@ App_Step_Sig(app_step){
{ {
View *view = 0; View *view = 0;
Panel *panel = 0, *used_panels = 0; Panel *panel = 0, *used_panels = 0;
i32 cursor_view_state = 0; i32 cursor_scroll_state = 0;
used_panels = &models->layout.used_sentinel; used_panels = &models->layout.used_sentinel;
for (dll_items(panel, used_panels)){ for (dll_items(panel, used_panels)){
view = panel->view; view = panel->view;
cursor_view_state = view_get_cursor_view_change_state(view); cursor_scroll_state = view_get_cursor_scroll_change_state(view);
switch (cursor_view_state){ switch (cursor_scroll_state){
case CursorView_NoChange:break; case CursorScroll_NoChange:break;
case CursorView_Cursor: case CursorScroll_Cursor:
case CursorView_Both: case CursorScroll_Both:
view_move_view_to_cursor(view); view_move_view_to_cursor(view);
break; break;
case CursorView_View: case CursorScroll_Scroll:
gui_post_scroll_vars(&view->gui_target, view->current_scroll); gui_post_scroll_vars(&view->gui_target, view->current_scroll);
break; break;
} }

View File

@ -262,14 +262,14 @@ view_lock_level(View *view){
inline f32 inline f32
view_file_width(View *view){ view_file_width(View *view){
i32_Rect file_rect = view->scroll_region; i32_Rect file_rect = view->file_region;
f32 result = (f32)(file_rect.x1 - file_rect.x0); f32 result = (f32)(file_rect.x1 - file_rect.x0);
return (result); return (result);
} }
inline f32 inline f32
view_file_height(View *view){ view_file_height(View *view){
i32_Rect file_rect = view->scroll_region; i32_Rect file_rect = view->file_region;
f32 result = (f32)(file_rect.y1 - file_rect.y0); f32 result = (f32)(file_rect.y1 - file_rect.y0);
return (result); return (result);
} }
@ -3189,15 +3189,15 @@ view_move_view_to_cursor(View *view){
} }
} }
enum CursorView_State{ enum CursorScroll_State{
CursorView_NoChange, CursorScroll_NoChange,
CursorView_Cursor, CursorScroll_Cursor,
CursorView_View, CursorScroll_Scroll,
CursorView_Both CursorScroll_Both
}; };
internal i32 internal i32
view_get_cursor_view_change_state(View *view){ view_get_cursor_scroll_change_state(View *view){
i32 result = 0; i32 result = 0;
b32 cursor_change = 0; b32 cursor_change = 0;
b32 view_change = 0; b32 view_change = 0;
@ -3216,18 +3216,18 @@ view_get_cursor_view_change_state(View *view){
if (cursor_change){ if (cursor_change){
if (view_change){ if (view_change){
result = CursorView_Both; result = CursorScroll_Both;
} }
else{ else{
result = CursorView_Cursor; result = CursorScroll_Cursor;
} }
} }
else{ else{
if (view_change){ if (view_change){
result = CursorView_View; result = CursorScroll_Scroll;
} }
else{ else{
result = CursorView_NoChange; result = CursorScroll_NoChange;
} }
} }
@ -3237,7 +3237,7 @@ view_get_cursor_view_change_state(View *view){
internal void internal void
view_record_prev_cursor(View *view){ view_record_prev_cursor(View *view){
if (view->gui_target.did_file){ if (view->gui_target.did_file){
view->prev_cursor_pos = view->file_data.cursor.pos; view->prev_cursor_pos = view_get_cursor_pos(view);
} }
} }