diff --git a/LOG.md b/LOG.md index 08aea3f74..2ebec0e68 100644 --- a/LOG.md +++ b/LOG.md @@ -8,13 +8,18 @@ - Currently only RGB monitor panels - Release checklist - - Change the version - - Remove the [not implemented] + - Update readme and package it - Google Analytics? - Disqus =========================== +- Project commands: + - Open projects folder + - Open global config + - Open project config + - Switch project + - Line wrap: - Sticky viewport - When editing with multiple cursors it makes sense to adjust the glue point even for the current buffer diff --git a/src/draw.jai b/src/draw.jai index 05b034dd3..c6f1e8d39 100644 --- a/src/draw.jai +++ b/src/draw.jai @@ -144,7 +144,6 @@ draw_welcome_screen :: (main_area: Rect) { .{ .search_in_buffer, "Search In Open File" }, .{ .search_in_buffer_dropdown_mode, "Search In Open File (Dropdown Mode)" }, .{ .search_in_project, "Search In Workspace" }, - .{ .go_to_line, "Go To Line" }, ]; right_area = shrink(right_area, margin); @@ -1380,14 +1379,18 @@ draw_commands_dialog :: () { if mouse_pointer_is_within(entry_rect) && ui.hot_last_frame == ui_id && (ui.active == .none || ui.active == ui_id) { + if mouse.left.just_pressed then selected_by_mouse = entry_index; + if selected_by_mouse == -1 then draw_rect(entry_rect, Colors.LIST_CURSOR_LITE); draw_rect(entry_rect, Colors.LIST_CURSOR_LITE); - if mouse.left.just_pressed { + if selected_by_mouse == entry_index && mouse.left.just_released { selected = entry_index; commands_execute_selected(); redraw_requested = true; + break; } } + if selected_by_mouse == entry_index then draw_rect(entry_rect, Colors.LIST_CURSOR); if entry_index == selected then draw_rect(entry_rect, Colors.LIST_CURSOR); pen := make_vector2( @@ -1420,6 +1423,8 @@ draw_commands_dialog :: () { } } + if mouse.left.just_released || !mouse.left.is_down then selected_by_mouse = -1; + if scroll_y != 0 then draw_top_down_shadow(cut_top(entries_rect, char_size)); } } diff --git a/src/main.jai b/src/main.jai index 688fa6577..0dd5b4eb2 100644 --- a/src/main.jai +++ b/src/main.jai @@ -1,4 +1,4 @@ -VERSION :: "0.1.0-rc"; +VERSION :: "0.1.0"; RELEASE_DATE :: "26 April 2023"; main :: () { diff --git a/src/widgets/commands.jai b/src/widgets/commands.jai index 8ae57b6d3..e0276e395 100644 --- a/src/widgets/commands.jai +++ b/src/widgets/commands.jai @@ -56,12 +56,20 @@ commands_execute_selected :: () { if selected >= filtered.count return; command := filtered[selected].command; - for * commands { if command.action == it.action { it.num_times_used += 1; break; } } - dummy_event: Input.Event; // TODO: refactor so that this event is not needed - // (need to put the search bar into its own widget for this) - editors_handle_action(dummy_event, command.action); + if command.action == { + case .do_nothing; return; + + case .open_projects_directory; + case .open_global_config; + case .open_project_config; + case .switch_project; + case; + dummy_event: Input.Event; // TODO: refactor so that this event is not needed + // (need to put the search bar into its own widget for this) + editors_handle_action(dummy_event, command.action); + } } #scope_file @@ -153,6 +161,7 @@ commands := #run Command.[ .{ .select_all, "Select All", 0, true }, .{ .select_line, "Select Line", 0, true }, + .{ .go_to_line, "Go To Line", 0, true }, .{ .close_current_editor, "Close Current File", 0, true }, .{ .close_other_editor, "Close Other File", 0, true }, @@ -199,6 +208,7 @@ Commands_Dialog :: struct { input: Text_Input; filtered: [..] Entry; selected: s64; + selected_by_mouse: s64 = -1; // to remember which entry the left mouse button went down on scroll_y: s32; scroll_anim := #run Tween_Animation(s32).{ speed = xx 0.1, func = .lerp };