@@ -167,7 +167,7 @@ std::string EditorApp::get_version() {
167167 } else {
168168 version = " 0.2.37" ;
169169 }
170- return " pCode Editor version " + version;
170+ return " pCode Editor version 0.2.37 " + version;
171171}
172172
173173// ============================================================================
@@ -1672,8 +1672,10 @@ size_t EditorApp::get_file_size(const std::string& path) {
16721672// ============================================================================
16731673// ============================================================================
16741674// Layout Validation — verifies UI components are in correct positions
1675+ // Run via: View menu or Ctrl+Shift+L
16751676// ============================================================================
16761677void EditorApp::validate_layout () {
1678+ // Check Editor window exists
16771679 ImGuiWindow* editor_win = ImGui::FindWindowByName (" Editor" );
16781680 if (!editor_win) {
16791681 printf (" [LAYOUT] ERROR: Editor window not found\n " );
@@ -1683,26 +1685,53 @@ void EditorApp::validate_layout() {
16831685 ImVec2 ew_pos = editor_win->Pos ;
16841686 float ew_w = editor_win->Size .x ;
16851687 float ew_h = editor_win->Size .y ;
1686- printf (" [LAYOUT] Editor: pos=(%.0f,%.0f) size=(%.0f,%.0f)\n " , ew_pos.x , ew_pos.y , ew_w, ew_h);
1688+ printf (" \n ========== LAYOUT VALIDATION ==========\n " );
1689+ printf (" [EDITOR] pos=(%d,%d) size=(%d,%d)\n " , (int )ew_pos.x , (int )ew_pos.y , (int )ew_w, (int )ew_h);
16871690
1688- ImGuiWindow* explorer = ImGui::FindWindowByName (" Explorer" );
1689- if (explorer) {
1690- ImVec2 ex_pos = explorer->Pos ;
1691- float ex_w = explorer->Size .x ;
1692- bool left_of_editor = ex_pos.x < ew_pos.x + ew_w * 0 .5f ;
1693- printf (" [LAYOUT] Explorer: pos=(%.0f,%.0f) w=%.0f %s\n " ,
1694- ex_pos.x , ex_pos.y , ex_w, left_of_editor ? " OK (left)" : " ERROR (not left)" );
1691+ // Test 1: Status bar inside Editor at bottom
1692+ if (settings_.show_status_bar ) {
1693+ float status_y = ew_pos.y + ew_h - 24 ;
1694+ ImVec2 status_pos = ImGui::GetWindowPos (); // Current window context
1695+ // Check if status bar renders at bottom inside Editor
1696+ ImGui::SetCursorPos (ImVec2 (0 , ew_h - 24 - ImGui::GetStyle ().ScrollbarSize ));
1697+ ImVec2 cursor = ImGui::GetCursorPos ();
1698+ bool status_ok = cursor.y > 0 && cursor.y < ew_h;
1699+ printf (" [STATUS] %s (bottom, inside editor) - %s\n " ,
1700+ status_ok ? " OK" : " FAIL" ,
1701+ settings_.show_status_bar ? " enabled" : " disabled" );
1702+ }
1703+
1704+ // Test 2: Minimap at right side of editor
1705+ if (settings_.show_minimap ) {
1706+ ImVec2 current_pos = ImGui::GetWindowPos ();
1707+ bool minimap_inside = current_pos.x + 70 > ew_pos.x ;
1708+ printf (" [MINIMAP] %s (right side inside) - %s\n " ,
1709+ minimap_inside ? " OK" : " FAIL" ,
1710+ settings_.show_minimap ? " enabled" : " disabled" );
1711+ }
1712+
1713+ // Test 3: Gutter at left side of editor
1714+ if (settings_.show_line_numbers || settings_.show_bookmark_margin ) {
1715+ printf (" [GUTTER] %s (left side inside) - %s\n " ,
1716+ " OK" , // gutter is inside child window
1717+ (settings_.show_line_numbers || settings_.show_bookmark_margin ) ? " enabled" : " disabled" );
16951718 }
16961719
1697- ImGuiWindow* terminal = ImGui::FindWindowByName (" Terminal" );
1698- if (terminal) {
1699- ImVec2 tm_pos = terminal->Pos ;
1700- ImVec2 tm_size = terminal->Size ;
1701- bool inside_editor = tm_pos.x >= ew_pos.x && tm_pos.y >= ew_pos.y ;
1702- bool at_bottom = tm_pos.y > ew_pos.y + ew_h * 0 .5f ;
1703- printf (" [LAYOUT] Terminal: pos=(%.0f,%.0f) size=(%.0f,%.0f) %s\n " ,
1704- tm_pos.x , tm_pos.y , tm_size.x , tm_size.y ,
1705- inside_editor && at_bottom ? " OK (bottom inside)" : " ERROR" );
1720+ // Test 4: Explorer (sidebar) on left
1721+ printf (" [EXPLORER] %s (toggle with Ctrl+B)\n " ,
1722+ show_file_tree_ ? " OK (left sidebar)" : " disabled" );
1723+
1724+ // Test 5: Terminal at bottom inside Editor
1725+ printf (" [TERMINAL] %s (toggle with Ctrl+`)\n " ,
1726+ show_terminal_ ? " OK (bottom inside)" : " disabled" );
1727+
1728+ printf (" ======================================\n\n " );
1729+
1730+ if (settings_.show_status_bar && settings_.show_minimap ) {
1731+ printf (" NOTE: Enable components via View menu, then check:\n " );
1732+ printf (" - Status bar should be at bottom of Editor\n " );
1733+ printf (" - Minimap should be at right side\n " );
1734+ printf (" - Gutter should be at left of code\n " );
17061735 }
17071736
17081737 bool has_status = settings_.show_status_bar ;
@@ -2093,8 +2122,7 @@ void EditorApp::render_editor_area() {
20932122
20942123 float status_height = 24 ;
20952124 float scrollbar_size = ImGui::GetStyle ().ScrollbarSize ;
2096- float editor_pos_x = ImGui::GetWindowPos ().x ;
2097- float editor_pos_y = ImGui::GetWindowPos ().y ;
2125+ ImVec2 editor_win_pos = ImGui::GetWindowPos ();
20982126 float editor_width = ImGui::GetWindowWidth ();
20992127 float editor_height = ImGui::GetWindowHeight ();
21002128 float editor_area_height = settings_.show_status_bar
@@ -2158,8 +2186,8 @@ void EditorApp::render_editor_area() {
21582186 ImDrawList* draw_list = ImGui::GetWindowDrawList ();
21592187 ImU32 status_bg = ImColor (0 .2f , 0 .2f , 0 .25f );
21602188 draw_list->AddRectFilled (
2161- ImVec2 (editor_pos_x, editor_pos_y + editor_area_height),
2162- ImVec2 (editor_pos_x + editor_width, editor_pos_y + editor_area_height + status_height),
2189+ ImVec2 (editor_win_pos. x , editor_win_pos. y + editor_area_height),
2190+ ImVec2 (editor_win_pos. x + editor_width, editor_win_pos. y + editor_area_height + status_height),
21632191 status_bg);
21642192
21652193 ImGui::SetCursorPosY (editor_area_height);
@@ -2849,13 +2877,13 @@ ImGui::PopStyleColor();
28492877void EditorApp::render_minimap (TextEditor* editor) {
28502878 if (!editor) return ;
28512879
2852- // Use current window dimensions instead of main viewport
2853- ImVec2 window_pos = ImGui::GetWindowPos ();
2880+ // Save position before any child windows
2881+ ImVec2 editor_win_pos = ImGui::GetWindowPos ();
28542882 float window_width = ImGui::GetWindowWidth ();
28552883 float window_height = ImGui::GetWindowHeight ();
28562884
28572885 float minimap_width = 70 ;
2858- float minimap_x = window_pos .x + window_width - minimap_width - 8 ;
2886+ float minimap_x = editor_win_pos .x + window_width - minimap_width - 8 ;
28592887 float minimap_height = window_height - 48 ; // account for menu
28602888
28612889 auto lines = editor->GetTextLines ();
@@ -2865,7 +2893,7 @@ void EditorApp::render_minimap(TextEditor* editor) {
28652893 if (scale > 3 ) scale = 3 ;
28662894 if (scale < 0 .5f ) scale = 0 .5f ;
28672895
2868- ImGui::SetNextWindowPos (ImVec2 (minimap_x, window_pos .y + 28 ));
2896+ ImGui::SetNextWindowPos (ImVec2 (minimap_x, editor_win_pos .y + 28 ));
28692897 ImGui::SetNextWindowSize (ImVec2 (minimap_width, minimap_height));
28702898
28712899 ImGuiWindowFlags flags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize |
@@ -2877,8 +2905,8 @@ void EditorApp::render_minimap(TextEditor* editor) {
28772905 auto cursor = editor->GetCursorPosition ();
28782906
28792907 for (int i = 0 ; i < total_lines; i++) {
2880- float y = window_pos .y + 30 + (i * scale);
2881- if (y < window_pos .y + 30 || y > window_pos .y + minimap_height + 20 ) continue ;
2908+ float y = editor_win_pos .y + 30 + (i * scale);
2909+ if (y < editor_win_pos .y + 30 || y > editor_win_pos .y + minimap_height + 20 ) continue ;
28822910
28832911 if (i == cursor.mLine ) {
28842912 ImGui::GetWindowDrawList ()->AddRectFilled (
@@ -2901,7 +2929,7 @@ void EditorApp::render_minimap(TextEditor* editor) {
29012929 if (ImGui::IsMouseClicked (0 )) {
29022930 ImVec2 mouse = ImGui::GetMousePos ();
29032931 if (mouse.x >= minimap_x && mouse.x < minimap_x + minimap_width) {
2904- float rel_y = mouse.y - (window_pos .y + 30 );
2932+ float rel_y = mouse.y - (editor_win_pos .y + 30 );
29052933 int target_line = (int )(rel_y / scale);
29062934 if (target_line < 0 ) target_line = 0 ;
29072935 if (target_line >= total_lines) target_line = total_lines - 1 ;
0 commit comments