Skip to content

Commit e4aae5b

Browse files
committed
respect cursor trail enabling in single line trail path
1 parent 0549f67 commit e4aae5b

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

src/raddbg/raddbg_widgets.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4151,6 +4151,7 @@ rd_cell(RD_CellParams *params, String8 string)
41514151
draw_data->edited_string = push_str8_copy(ui_build_arena(), edit_string);
41524152
draw_data->cursor = params->cursor[0];
41534153
draw_data->mark = params->mark[0];
4154+
draw_data->trail = do_cursor_trail;
41544155
ui_box_equip_custom_draw(text_box, ui_line_edit_draw, draw_data);
41554156
Vec2F32 text2mouse = sub_2f32(ui_mouse(), ui_box_text_position(text_box));
41564157
FNT_Tag font = ui_top_font();

src/ui/ui_basic_widgets.c

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ struct UI_LineEditDrawData
131131
String8 edited_string;
132132
TxtPt cursor;
133133
TxtPt mark;
134+
B32 trail;
134135
};
135136

136137
internal UI_BOX_CUSTOM_DRAW(ui_line_edit_draw)
@@ -178,16 +179,19 @@ internal UI_BOX_CUSTOM_DRAW(ui_line_edit_draw)
178179
Rng2F32 select_rect = union_2f32(cursor_rect, mark_rect);
179180
dr_rect(select_rect, select_color, font_size/2.f, 0, 1.f);
180181
dr_rect(cursor_rect, cursor_color, 0.f, 0, 0.f);
181-
R_Rect2DInst *trail_inst = dr_rect(trail_rect, trail_color, ui_top_font_size()*0.2f, 0, 1.f);
182-
if(cursor_pixel_off > cursor_pixel_off__animated)
182+
if(draw_data->trail)
183183
{
184-
trail_inst->colors[Corner_00].w *= 0.1f;
185-
trail_inst->colors[Corner_01].w *= 0.1f;
186-
}
187-
else
188-
{
189-
trail_inst->colors[Corner_10].w *= 0.1f;
190-
trail_inst->colors[Corner_11].w *= 0.1f;
184+
R_Rect2DInst *trail_inst = dr_rect(trail_rect, trail_color, ui_top_font_size()*0.2f, 0, 1.f);
185+
if(cursor_pixel_off > cursor_pixel_off__animated)
186+
{
187+
trail_inst->colors[Corner_00].w *= 0.1f;
188+
trail_inst->colors[Corner_01].w *= 0.1f;
189+
}
190+
else
191+
{
192+
trail_inst->colors[Corner_10].w *= 0.1f;
193+
trail_inst->colors[Corner_11].w *= 0.1f;
194+
}
191195
}
192196
}
193197

@@ -288,6 +292,7 @@ ui_line_edit(TxtPt *cursor, TxtPt *mark, U8 *edit_buffer, U64 edit_buffer_size,
288292
draw_data->edited_string = push_str8_copy(ui_build_arena(), edit_string);
289293
draw_data->cursor = *cursor;
290294
draw_data->mark = *mark;
295+
draw_data->trail = 1;
291296
ui_box_equip_display_string(editstr_box, edit_string);
292297
ui_box_equip_custom_draw(editstr_box, ui_line_edit_draw, draw_data);
293298
mouse_pt = txt_pt(1, 1+ui_box_char_pos_from_xy(editstr_box, ui_mouse()));

0 commit comments

Comments
 (0)