diff --git a/src/mainloop.cpp b/src/mainloop.cpp index 7c04094..bed0f64 100644 --- a/src/mainloop.cpp +++ b/src/mainloop.cpp @@ -135,6 +135,7 @@ void run_main_loop(GLFWwindow *window, Arena *arena, App_State &app) monitor_key(window, key_state, GLFW_KEY_RIGHT, KEY_RIGHT); monitor_key(window, key_state, GLFW_KEY_LEFT_ALT, KEY_ALT); monitor_key(window, key_state, GLFW_KEY_TAB, KEY_TAB); + monitor_key(window, key_state, GLFW_KEY_LEFT_SHIFT, KEY_SHIFT); // Update mouse f64 mposx, mposy; diff --git a/src/render.cpp b/src/render.cpp index bee8faf..99ec8f4 100644 --- a/src/render.cpp +++ b/src/render.cpp @@ -395,11 +395,15 @@ void update_and_render(Arena *arena, App_State &app, f32 delta_time_ms) app.inspected_file.mem, hover_display_grouped); if (!app.rndata.header_is_compressed) ImGui::TextColored(ImColor(0.5f, 0.5f, 0.5f), "(Hint: press Alt for single-field hover information)"); + if (hovered_section.id == Sec_Page) + ImGui::TextColored(ImColor(0.5f, 0.5f, 0.5f), "(Hint: Shift-Click to jump to the start of this page)"); imgui_render_string_tree(scratch.arena, hover_info.desc->head); app.viewer.hovered_range = hover_info.rng; - // Clicking on a page section will update the current page in the legend - if (hovered_section.id == Sec_Page && (app.user_input.mouse_btn_state[MOUSE_BTN_LEFT] & MOUSE_BTN_STATE_JUST_PRESSED)) { + // Shift-clicking on a page section will update the current page in the legend + if (hovered_section.id == Sec_Page && (app.user_input.key_state[KEY_SHIFT] & KEY_STATE_IS_DOWN) && + (app.user_input.mouse_btn_state[MOUSE_BTN_LEFT] & MOUSE_BTN_STATE_JUST_PRESSED)) + { u64 page_id = ((const Page_Info_Node *)hovered_section.info)->page_id; app.viewer.latest_page = viewer_jump_to_page(app, page_id); } diff --git a/src/window.h b/src/window.h index 55dc3e7..eaf14fb 100644 --- a/src/window.h +++ b/src/window.h @@ -6,6 +6,7 @@ enum Input_Key { KEY_Q, KEY_ALT, KEY_TAB, + KEY_SHIFT, KEY_COUNT };