From c88f715ac208344a2bd1b7dc1f54a54e06162d9b Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Sun, 14 Jan 2024 14:53:45 -0800 Subject: [PATCH] fix horizontal scroll in text containers causing repeated hidden animation --- src/df/gfx/df_views.c | 8 ++++---- src/ui/ui_core.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/df/gfx/df_views.c b/src/df/gfx/df_views.c index 00fa2b1d..00c0b26a 100644 --- a/src/df/gfx/df_views.c +++ b/src/df/gfx/df_views.c @@ -5153,7 +5153,7 @@ DF_VIEW_UI_FUNCTION_DEF(Code) if(txti_buffer_is_ready) UI_Parent(container_box) { //- rjf: build fractional space - container_box->view_off.x = view->scroll_pos.x.idx + view->scroll_pos.x.off; + container_box->view_off.x = container_box->view_off_target.x = view->scroll_pos.x.idx + view->scroll_pos.x.off; container_box->view_off.y = container_box->view_off_target.y = code_line_height*mod_f32(view->scroll_pos.y.off, 1.f) + code_line_height*(view->scroll_pos.y.off < 0) - code_line_height*(view->scroll_pos.y.off == -1.f && view->scroll_pos.y.idx == 1); //- rjf: build code slice @@ -6033,7 +6033,7 @@ DF_VIEW_UI_FUNCTION_DEF(Disassembly) if(has_disasm) UI_Parent(container_box) { //- rjf: build fractional space - container_box->view_off.x = view->scroll_pos.x.idx + view->scroll_pos.x.off; + container_box->view_off.x = container_box->view_off_target.x = view->scroll_pos.x.idx + view->scroll_pos.x.off; container_box->view_off.y = container_box->view_off_target.y = code_line_height*mod_f32(view->scroll_pos.y.off, 1.f) + code_line_height*(view->scroll_pos.y.off < 0) - code_line_height*(view->scroll_pos.y.off == -1.f && view->scroll_pos.y.idx == 1); //- rjf: build code slice @@ -6967,7 +6967,7 @@ DF_VIEW_UI_FUNCTION_DEF(Output) if(txti_buffer_is_ready) UI_Parent(container_box) { //- rjf: build fractional space - container_box->view_off.x = view->scroll_pos.x.idx + view->scroll_pos.x.off; + container_box->view_off.x = container_box->view_off_target.x = view->scroll_pos.x.idx + view->scroll_pos.x.off; container_box->view_off.y = container_box->view_off_target.y = code_line_height*mod_f32(view->scroll_pos.y.off, 1.f) + code_line_height*(view->scroll_pos.y.off < 0) - code_line_height*(view->scroll_pos.y.off == -1.f && view->scroll_pos.y.idx == 1); //- rjf: build code slice @@ -7723,7 +7723,7 @@ DF_VIEW_UI_FUNCTION_DEF(Memory) UI_BoxFlag_AllowOverflowX| UI_BoxFlag_AllowOverflowY, "scrollable_box"); - scrollable_box->view_off.x = view->scroll_pos.x.idx + view->scroll_pos.x.off; + container_box->view_off.x = container_box->view_off_target.x = view->scroll_pos.x.idx + view->scroll_pos.x.off; scrollable_box->view_off.y = scrollable_box->view_off_target.y = floor_f32(row_height_px*mod_f32(view->scroll_pos.y.off, 1.f) + row_height_px*(view->scroll_pos.y.off < 0)); } diff --git a/src/ui/ui_core.c b/src/ui/ui_core.c index 0765a856..7e9760de 100644 --- a/src/ui/ui_core.c +++ b/src/ui/ui_core.c @@ -118,7 +118,7 @@ ui_nav_eat_action_node(UI_NavActionList *list, UI_NavActionNode *node) internal B32 ui_nav_char_is_code_symbol(U8 c) { - return (char_is_alpha(c) || char_is_digit(c, 10) || c == '_'); + return (char_is_alpha(c) || char_is_digit(c, 10) || c == '_'); } internal S64 @@ -134,7 +134,7 @@ ui_nav_scanned_column_from_column(String8 string, S64 start_column, Side side) U8 byte = (col <= string.size) ? string.str[col-1] : 0; B32 is_non_space = !char_is_space(byte); B32 is_name = ui_nav_char_is_code_symbol(byte); - + if (((side == Side_Min) && (col == 1)) || ((side == Side_Max) && (col == string.size+1)) || (found_non_space && !is_non_space) || @@ -143,9 +143,9 @@ ui_nav_scanned_column_from_column(String8 string, S64 start_column, Side side) new_column = col + (!side && col != 1); break; } else if (!found_text && is_name) { - found_text = 1; + found_text = 1; } else if (!found_non_space && is_non_space ) { - found_non_space = 1; + found_non_space = 1; } } return new_column;