@@ -159,7 +159,7 @@ static void settings_load(AppSettings& s, const std::string& path) {
159159// Version
160160// ============================================================================
161161std::string EditorApp::get_version () {
162- return " pCode Editor version 0.2.33 " ;
162+ return " pCode Editor version 0.2.34 " ;
163163}
164164
165165// ============================================================================
@@ -2799,7 +2799,7 @@ void EditorApp::render_status_bar() {
27992799 ImGui::SameLine ();
28002800
28012801 // Version with git hash
2802- ImGui::Text (" v0.2.34 " );
2802+ ImGui::Text (" v0.2.35 " );
28032803 }
28042804
28052805ImGui::PopStyleColor ();
@@ -2809,27 +2809,24 @@ ImGui::PopStyleColor();
28092809void EditorApp::render_minimap (TextEditor* editor) {
28102810 if (!editor) return ;
28112811
2812- ImGuiViewport* viewport = ImGui::GetMainViewport ();
2813- ImVec2 vp = viewport->Pos ;
2814- ImVec2 vs = viewport->Size ;
2812+ // Use current window dimensions instead of main viewport
2813+ ImVec2 window_pos = ImGui::GetWindowPos ();
2814+ float window_width = ImGui::GetWindowWidth ();
2815+ float window_height = ImGui::GetWindowHeight ();
28152816
2816- float sidebar_width = show_file_tree_ ? 220 .0f : 0 .0f ;
2817- float editor_x = vp.x + sidebar_width + 60 ;
2818- float editor_width = vs.x - sidebar_width - 60 - 90 ;
2819- float editor_height = vs.y - 80 ;
2820- float minimap_width = 80 ;
2821- float minimap_x = editor_x + editor_width + 5 ;
2817+ float minimap_width = 70 ;
2818+ float minimap_x = window_pos.x + window_width - minimap_width - 8 ;
2819+ float minimap_height = window_height - 48 ; // account for menu
28222820
28232821 auto lines = editor->GetTextLines ();
28242822 int total_lines = (int )lines.size ();
28252823 if (total_lines == 0 ) total_lines = 1 ;
2826- float scale = (editor_height - 20 ) / (float )total_lines;
2827- if (scale > 4 ) scale = 4 ;
2824+ float scale = (minimap_height - 20 ) / (float )total_lines;
2825+ if (scale > 3 ) scale = 3 ;
28282826 if (scale < 0 .5f ) scale = 0 .5f ;
28292827
2830- ImGui::SetNextWindowPos (ImVec2 (minimap_x, vp.y + 8 ));
2831- ImGui::SetNextWindowSize (ImVec2 (minimap_width, editor_height - 16 ));
2832- ImGui::SetNextWindowViewport (viewport->ID );
2828+ ImGui::SetNextWindowPos (ImVec2 (minimap_x, window_pos.y + 28 ));
2829+ ImGui::SetNextWindowSize (ImVec2 (minimap_width, minimap_height));
28332830
28342831 ImGuiWindowFlags flags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize |
28352832 ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoScrollbar |
@@ -2840,8 +2837,8 @@ void EditorApp::render_minimap(TextEditor* editor) {
28402837 auto cursor = editor->GetCursorPosition ();
28412838
28422839 for (int i = 0 ; i < total_lines; i++) {
2843- float y = vp .y + 10 + (i * scale);
2844- if (y < vp .y + 10 || y > vp .y + editor_height - 10 ) continue ;
2840+ float y = window_pos .y + 30 + (i * scale);
2841+ if (y < window_pos .y + 30 || y > window_pos .y + minimap_height + 20 ) continue ;
28452842
28462843 if (i == cursor.mLine ) {
28472844 ImGui::GetWindowDrawList ()->AddRectFilled (
@@ -2864,7 +2861,7 @@ void EditorApp::render_minimap(TextEditor* editor) {
28642861 if (ImGui::IsMouseClicked (0 )) {
28652862 ImVec2 mouse = ImGui::GetMousePos ();
28662863 if (mouse.x >= minimap_x && mouse.x < minimap_x + minimap_width) {
2867- float rel_y = mouse.y - (vp .y + 10 );
2864+ float rel_y = mouse.y - (window_pos .y + 30 );
28682865 int target_line = (int )(rel_y / scale);
28692866 if (target_line < 0 ) target_line = 0 ;
28702867 if (target_line >= total_lines) target_line = total_lines - 1 ;
0 commit comments