Skip to content

Commit 092f4ae

Browse files
committed
Fix: Statusbar with proper sections, editor floating/dockable
1 parent 880663f commit 092f4ae

3 files changed

Lines changed: 79 additions & 31 deletions

File tree

imgui.ini

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[Window][Editor]
2-
Pos=0,26
3-
Size=1280,774
2+
Pos=253,26
3+
Size=1076,897
44
Collapsed=0
55
DockId=0x00000003,0
66

77
[Window][DockSpace]
88
Pos=0,0
9-
Size=1280,800
9+
Size=1329,923
1010
Collapsed=0
1111

1212
[Window][Debug##Default]
@@ -20,26 +20,29 @@ Size=501,229
2020
Collapsed=0
2121

2222
[Window][Explorer]
23-
Pos=627,650
24-
Size=290,720
23+
Pos=0,26
24+
Size=251,897
2525
Collapsed=0
26+
DockId=0x00000005,0
2627

2728
[Docking][Data]
28-
DockSpace ID=0xCCBD8CF7 Window=0x3DA2F1DE Pos=0,26 Size=1280,774 Split=X Selected=0xDF0EC458
29-
DockNode ID=0x00000011 Parent=0xCCBD8CF7 SizeRef=1306,851 Split=Y
30-
DockNode ID=0x0000000F Parent=0x00000011 SizeRef=1280,480 Split=Y
31-
DockNode ID=0x0000000D Parent=0x0000000F SizeRef=1280,472 Split=Y
32-
DockNode ID=0x0000000B Parent=0x0000000D SizeRef=1280,720 Split=Y
33-
DockNode ID=0x00000009 Parent=0x0000000B SizeRef=1280,686 Split=Y
34-
DockNode ID=0x00000007 Parent=0x00000009 SizeRef=1280,703 Split=Y
35-
DockNode ID=0x00000001 Parent=0x00000007 SizeRef=1280,386 Selected=0x00F0E82E
36-
DockNode ID=0x00000002 Parent=0x00000007 SizeRef=1280,261 Split=X
37-
DockNode ID=0x00000003 Parent=0x00000002 SizeRef=678,778 CentralNode=1 Selected=0xDF0EC458
38-
DockNode ID=0x00000004 Parent=0x00000002 SizeRef=600,778 Selected=0xD33228A6
39-
DockNode ID=0x00000008 Parent=0x00000009 SizeRef=1280,64 HiddenTabBar=1 Selected=0x2AB9DED9
40-
DockNode ID=0x0000000A Parent=0x0000000B SizeRef=1280,81 HiddenTabBar=1 Selected=0x2AB9DED9
41-
DockNode ID=0x0000000C Parent=0x0000000D SizeRef=1280,47 HiddenTabBar=1 Selected=0x2AB9DED9
42-
DockNode ID=0x0000000E Parent=0x0000000F SizeRef=1280,300 Selected=0xD33228A6
43-
DockNode ID=0x00000010 Parent=0x00000011 SizeRef=1280,300 Selected=0xD33228A6
44-
DockNode ID=0x00000012 Parent=0xCCBD8CF7 SizeRef=612,851 Selected=0xD33228A6
29+
DockSpace ID=0xCCBD8CF7 Window=0x3DA2F1DE Pos=0,26 Size=1329,897 Split=X Selected=0xDF0EC458
30+
DockNode ID=0x00000005 Parent=0xCCBD8CF7 SizeRef=251,983 Selected=0x00F0E82E
31+
DockNode ID=0x00000006 Parent=0xCCBD8CF7 SizeRef=1667,983 Split=X
32+
DockNode ID=0x00000011 Parent=0x00000006 SizeRef=1306,851 Split=Y
33+
DockNode ID=0x0000000F Parent=0x00000011 SizeRef=1280,480 Split=Y
34+
DockNode ID=0x0000000D Parent=0x0000000F SizeRef=1280,472 Split=Y
35+
DockNode ID=0x0000000B Parent=0x0000000D SizeRef=1280,720 Split=Y
36+
DockNode ID=0x00000009 Parent=0x0000000B SizeRef=1280,686 Split=Y
37+
DockNode ID=0x00000007 Parent=0x00000009 SizeRef=1280,703 Split=Y
38+
DockNode ID=0x00000001 Parent=0x00000007 SizeRef=1280,386 Selected=0x00F0E82E
39+
DockNode ID=0x00000002 Parent=0x00000007 SizeRef=1280,261 Split=X
40+
DockNode ID=0x00000003 Parent=0x00000002 SizeRef=678,778 CentralNode=1 Selected=0xDF0EC458
41+
DockNode ID=0x00000004 Parent=0x00000002 SizeRef=600,778 Selected=0xD33228A6
42+
DockNode ID=0x00000008 Parent=0x00000009 SizeRef=1280,64 HiddenTabBar=1 Selected=0x2AB9DED9
43+
DockNode ID=0x0000000A Parent=0x0000000B SizeRef=1280,81 HiddenTabBar=1 Selected=0x2AB9DED9
44+
DockNode ID=0x0000000C Parent=0x0000000D SizeRef=1280,47 HiddenTabBar=1 Selected=0x2AB9DED9
45+
DockNode ID=0x0000000E Parent=0x0000000F SizeRef=1280,300 Selected=0xD33228A6
46+
DockNode ID=0x00000010 Parent=0x00000011 SizeRef=1280,300 Selected=0xD33228A6
47+
DockNode ID=0x00000012 Parent=0x00000006 SizeRef=612,851 Selected=0xD33228A6
4548

pcode-settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
"font_size": 18,
1414
"font_name": "CascadiaMono",
1515
"last_open_dir": ".\\src",
16-
"recent_files": [".\\src\\editor_app.cpp", ".\\docs\\versioning.md", ".\\docs\\imgui_tutorial.md", ".\\docs\\VIM_MOTIONS_SPEC.md", "./src/editor_app.h", "./src/main.cpp", "./src/editor_app.cpp", "VERSION", "./CMakeLists.txt"]
16+
"recent_files": [".\\src\\editor_app.h", ".\\src\\editor_app.cpp", ".\\docs\\versioning.md", ".\\docs\\imgui_tutorial.md", ".\\docs\\VIM_MOTIONS_SPEC.md", "./src/editor_app.h", "./src/main.cpp", "./src/editor_app.cpp", "VERSION", "./CMakeLists.txt"]
1717
}

src/editor_app.cpp

Lines changed: 53 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2031,8 +2031,8 @@ ImGui::EndMenu();
20312031
// Editor Area
20322032
// ============================================================================
20332033
void EditorApp::render_editor_area() {
2034-
// Editor window - dockable and can float
2035-
ImGui::Begin("Editor", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove);
2034+
// Editor window - can float and dock
2035+
ImGui::Begin("Editor", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse);
20362036

20372037
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_RootWindow)) {
20382038
editor_focused_ = true;
@@ -2688,7 +2688,6 @@ void EditorApp::render_status_bar() {
26882688
auto pos = editor ? editor->GetCursorPosition() : TextEditor::Coordinates();
26892689

26902690
const char* mode_str = get_vim_mode_str();
2691-
const char* sep = " | ";
26922691

26932692
// Get directory info
26942693
std::string dir_info = ".";
@@ -2704,29 +2703,75 @@ void EditorApp::render_status_bar() {
27042703
}
27052704
}
27062705

2706+
// Status bar sections
2707+
const char* sep = " | ";
2708+
2709+
// Mode: NORMAL/INSERT
27072710
ImGui::Text("%s", mode_str);
27082711
ImGui::SameLine();
27092712
ImGui::Text("%s", sep);
27102713
ImGui::SameLine();
2714+
2715+
// Filename with dirty indicator
2716+
std::string display = tab.display_name + (tab.dirty ? " *" : "");
2717+
ImGui::Text("%s", display.c_str());
2718+
ImGui::SameLine();
2719+
ImGui::Text("%s", sep);
2720+
ImGui::SameLine();
2721+
2722+
// Line and column
27112723
ImGui::Text("Ln %d, Col %d", pos.mLine + 1, pos.mColumn + 1);
27122724
ImGui::SameLine();
27132725
ImGui::Text("%s", sep);
27142726
ImGui::SameLine();
2715-
ImGui::Text("%s", tab.file_encoding.c_str());
2727+
2728+
// Git branch or directory
2729+
ImGui::Text("Git: %s", dir_info.c_str());
27162730
ImGui::SameLine();
27172731
ImGui::Text("%s", sep);
27182732
ImGui::SameLine();
2719-
ImGui::Text("%s", tab.line_ending.c_str());
2733+
2734+
// Encoding (read-only display)
2735+
ImGui::Text("%s", tab.file_encoding.c_str());
27202736
ImGui::SameLine();
27212737
ImGui::Text("%s", sep);
27222738
ImGui::SameLine();
2723-
ImGui::Text("%d%%", tabs_[active_tab_].zoom_pct);
2739+
2740+
// Line ending - clickable popup
2741+
std::string le_id = tab.line_ending;
2742+
if (ImGui::Selectable(le_id.c_str(), false)) {
2743+
ImGui::OpenPopup("LineEndingPopup");
2744+
}
2745+
if (ImGui::BeginPopup("LineEndingPopup")) {
2746+
if (ImGui::MenuItem("LF", nullptr, tab.line_ending == "LF")) { tab.line_ending = "LF"; }
2747+
if (ImGui::MenuItem("CRLF", nullptr, tab.line_ending == "CRLF")) { tab.line_ending = "CRLF"; }
2748+
if (ImGui::MenuItem("CR", nullptr, tab.line_ending == "CR")) { tab.line_ending = "CR"; }
2749+
ImGui::EndPopup();
2750+
}
27242751
ImGui::SameLine();
27252752
ImGui::Text("%s", sep);
27262753
ImGui::SameLine();
2727-
ImGui::Text("%s", tab.display_name.c_str());
2754+
2755+
// Tab size - clickable popup
2756+
std::string tab_id = "Tab: " + std::to_string(settings_.tab_size);
2757+
if (ImGui::Selectable(tab_id.c_str(), false)) {
2758+
ImGui::OpenPopup("TabSizePopup");
2759+
}
2760+
if (ImGui::BeginPopup("TabSizePopup")) {
2761+
for (int i = 1; i <= 8; i++) {
2762+
if (ImGui::MenuItem(("Tab: " + std::to_string(i)).c_str(), nullptr, settings_.tab_size == i)) {
2763+
settings_.tab_size = i;
2764+
for (auto& t : tabs_) t.editor->SetTabSize(i);
2765+
}
2766+
}
2767+
ImGui::EndPopup();
2768+
}
27282769
ImGui::SameLine();
2729-
ImGui::Text(" | v0.2.28");
2770+
ImGui::Text("%s", sep);
2771+
ImGui::SameLine();
2772+
2773+
// Version
2774+
ImGui::Text("v0.2.28");
27302775
}
27312776

27322777
ImGui::PopStyleColor();

0 commit comments

Comments
 (0)