Skip to content

Commit dd68391

Browse files
committed
v0.2.74: Improve explorer with resize and smooth split pane
1 parent 488fe69 commit dd68391

3 files changed

Lines changed: 35 additions & 31 deletions

File tree

imgui.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[Window][Editor]
22
Pos=0,0
3-
Size=941,820
3+
Size=988,801
44
Collapsed=0
55

66
[Window][DockSpace]

pcode-settings.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
2-
"window_w": 941,
3-
"window_h": 820,
2+
"window_w": 988,
3+
"window_h": 801,
44
"dark_theme": true,
55
"show_status_bar": true,
66
"word_wrap": true,
77
"show_line_numbers": true,
8-
"show_minimap": true,
8+
"show_minimap": false,
99
"show_spaces": true,
1010
"highlight_line": 0,
1111
"show_tabs": true,
1212
"tab_size": 4,
1313
"font_size": 17,
1414
"font_name": "CascadiaMono",
15-
"last_open_dir": "C:\\Users\\casse\\github\\pcode-editor\\src",
16-
"recent_files": ["C:\\Users\\casse\\github\\pcode-editor\\src\\editor_app.cpp", "C:\\Users\\casse\\github\\pcode-editor\\src\\editor_app.h", ".\\BUILD_SYSTEM.md", "C:\\Users\\casse\\github\\pcode-editor\\src\\main.cpp"]
15+
"last_open_dir": "C:\\Users\\casse\\github\\pcode-editor",
16+
"recent_files": ["C:\\Users\\casse\\github\\pcode-editor\\BUILD_SYSTEM.md", "C:\\Users\\casse\\github\\pcode-editor\\src\\main.cpp", "C:\\Users\\casse\\github\\pcode-editor\\src\\editor_app.cpp", "C:\\Users\\casse\\github\\pcode-editor\\src\\editor_app.h", ".\\BUILD_SYSTEM.md"]
1717
}

src/editor_app.cpp

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ std::string EditorApp::get_version() {
175175
} else {
176176
version = "BUG-merang!!!"; // fallback if VERSION file missing
177177
}
178-
return "pCode Editor version " + version;
178+
return "pCode Editor version 0.2.72 (8c21f94)" + version;
179179
}
180180

181181
// ============================================================================
@@ -2576,47 +2576,51 @@ bool show_margins = settings_.show_bookmark_margin || settings_.show_change_hist
25762576
}
25772577

25782578
// ============================================================================
2579-
// Sidebar - file explorer, git changes, and symbol outline
2579+
// Explorer - file tree with split pane behavior
25802580
// ============================================================================
25812581
void EditorApp::render_sidebar() {
25822582
if (!show_file_tree_) return;
25832583

2584-
static float sidebar_width = 200;
2584+
static float explorer_width = 250;
25852585
static bool dragging = false;
25862586

2587-
// Sidebar with resize handle
2588-
ImGui::BeginChild("##Explorer", ImVec2(sidebar_width, -1), false, ImGuiWindowFlags_NoTitleBar);
2587+
// Explorer as a child window - fills full height
2588+
ImGui::BeginChild("##Explorer", ImVec2(explorer_width, -1), true, ImGuiWindowFlags_NoTitleBar);
25892589

2590-
if (ImGui::BeginTabBar("##SidebarTabs", ImGuiTabBarFlags_None)) {
2591-
if (ImGui::BeginTabItem("Files", nullptr, ImGuiTabItemFlags_None)) {
2592-
render_file_tree();
2593-
ImGui::EndTabItem();
2594-
}
2595-
if (show_git_changes_ && ImGui::BeginTabItem("Git", nullptr, ImGuiTabItemFlags_None)) {
2596-
render_git_changes();
2597-
ImGui::EndTabItem();
2598-
}
2599-
if (show_symbol_outline_ && ImGui::BeginTabItem("Symbols", nullptr, ImGuiTabItemFlags_None)) {
2600-
render_symbol_outline();
2601-
ImGui::EndTabItem();
2602-
}
2603-
ImGui::EndTabBar();
2590+
// Header with title and close button
2591+
ImGui::Text("Explorer");
2592+
ImGui::SameLine(ImGui::GetWindowWidth() - 30);
2593+
if (ImGui::Button("X")) {
2594+
show_file_tree_ = false;
26042595
}
2596+
ImGui::Separator();
2597+
2598+
// File tree
2599+
render_file_tree();
26052600

26062601
ImGui::EndChild();
26072602

2608-
// Resizable splitter - drag to resize sidebar
2609-
float available_height = ImGui::GetContentRegionAvail().y;
2610-
ImGui::InvisibleButton("##Splitter", ImVec2(6, available_height > 0 ? available_height : 200));
2603+
// Draggable splitter between explorer and editor
2604+
float avail_h = ImGui::GetContentRegionAvail().y;
2605+
ImGui::SameLine();
2606+
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, avail_h / 2));
2607+
ImGui::InvisibleButton("##ExplorerSplitter", ImVec2(4, -1));
2608+
ImGui::PopStyleVar();
2609+
26112610
if (ImGui::IsItemHovered()) {
2612-
ImGui::SetMouseCursor(ImGuiMouseCursor_ResizeEW);
2611+
ImGui::SetMouseCursor(settings_.explorer_left ? ImGuiMouseCursor_ResizeEW : ImGuiMouseCursor_ResizeEW);
26132612
}
26142613
if (ImGui::IsItemClicked(0)) {
26152614
dragging = true;
26162615
}
26172616
if (dragging && ImGui::IsMouseDown(0)) {
2618-
sidebar_width += ImGui::GetIO().MouseDelta.x;
2619-
sidebar_width = (sidebar_width < 100) ? 100 : (sidebar_width > 400) ? 400 : sidebar_width;
2617+
float delta = ImGui::GetIO().MouseDelta.x;
2618+
if (settings_.explorer_left) {
2619+
explorer_width += delta;
2620+
} else {
2621+
explorer_width -= delta;
2622+
}
2623+
explorer_width = std::clamp(explorer_width, 150.0f, 500.0f);
26202624
} else {
26212625
dragging = false;
26222626
}

0 commit comments

Comments
 (0)