Skip to content

Commit 84eb80d

Browse files
committed
Add terminal tab, sidebar views (F/G/S), right-click toggles for Explorer/Git/Symbol/LineNumbers/Minimap
1 parent 23f6772 commit 84eb80d

4 files changed

Lines changed: 45 additions & 7 deletions

File tree

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.2.75 (814478e)
1+
0.2.76 (23f6772)

pcode-settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
"font_size": 17,
1414
"font_name": "CascadiaMono",
1515
"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\\main.cpp", "C:\\Users\\casse\\github\\pcode-editor\\src\\editor_app.h", "C:\\Users\\casse\\github\\pcode-editor\\CMakeLists.txt", "C:\\Users\\casse\\github\\pcode-editor\\TESTS.md", "C:\\Users\\casse\\github\\pcode-editor\\IMPLEMENTATION_SUMMARY.md", "C:\\Users\\casse\\github\\pcode-editor\\BUILD_SYSTEM.md", ".\\BUILD_SYSTEM.md"]
16+
"recent_files": ["C:\\Users\\casse\\github\\pcode-editor\\src\\editor_app.h", "C:\\Users\\casse\\github\\pcode-editor\\src\\editor_app.cpp", "C:\\Users\\casse\\github\\pcode-editor\\src\\main.cpp", "C:\\Users\\casse\\github\\pcode-editor\\CMakeLists.txt", "C:\\Users\\casse\\github\\pcode-editor\\TESTS.md", "C:\\Users\\casse\\github\\pcode-editor\\IMPLEMENTATION_SUMMARY.md", "C:\\Users\\casse\\github\\pcode-editor\\BUILD_SYSTEM.md", ".\\BUILD_SYSTEM.md"]
1717
}

src/editor_app.cpp

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ std::string EditorApp::get_version() {
175175
} else {
176176
version = "0.0.0 (unknown)"; // fallback if VERSION file missing
177177
}
178-
return "pCode Editor version 0.2.74 (d6226fa)" + version;
178+
return "pCode Editor version 0.2.75 (814478e)" + version;
179179
}
180180

181181
// ============================================================================
@@ -481,6 +481,19 @@ void EditorApp::new_tab() {
481481
tabs_[active_tab_].active_split = 0;
482482
}
483483

484+
void EditorApp::new_terminal_tab() {
485+
EditorTab tab;
486+
tab.display_name = "Terminal";
487+
tab.is_terminal = true;
488+
tab.editor = nullptr;
489+
490+
tabs_.push_back(std::move(tab));
491+
active_tab_ = (int)tabs_.size() - 1;
492+
493+
// Start terminal process for this tab
494+
if (!terminal_process_) start_terminal();
495+
}
496+
484497
void EditorApp::new_window() {
485498
// Launch a new instance of the same executable
486499
// Using execl is safer than system()
@@ -1990,6 +2003,12 @@ if (editor_open) {
19902003
ImGui::Separator();
19912004
if (ImGui::MenuItem("Toggle Explorer", "Ctrl+B")) show_file_tree_ = !show_file_tree_;
19922005
if (ImGui::MenuItem("Toggle Terminal", "Ctrl+`")) show_terminal_ = !show_terminal_;
2006+
ImGui::Separator();
2007+
if (ImGui::MenuItem("Toggle Git")) show_git_changes_ = !show_git_changes_;
2008+
if (ImGui::MenuItem("Toggle Symbol")) show_symbol_outline_ = !show_symbol_outline_;
2009+
ImGui::Separator();
2010+
if (ImGui::MenuItem("Toggle Line Numbers", nullptr, (bool*)&settings_.show_line_numbers)) settings_.show_line_numbers = !settings_.show_line_numbers;
2011+
if (ImGui::MenuItem("Toggle Minimap", nullptr, (bool*)&settings_.show_minimap)) settings_.show_minimap = !settings_.show_minimap;
19932012
ImGui::EndPopup();
19942013
}
19952014

@@ -2027,6 +2046,7 @@ void EditorApp::render_menu_bar() {
20272046
void EditorApp::render_menu_file() {
20282047
if (ImGui::BeginMenu("File")) {
20292048
if (ImGui::MenuItem("New Tab", "Ctrl+N")) new_tab();
2049+
if (ImGui::MenuItem("New Terminal", "Ctrl+Shift+T")) new_terminal_tab();
20302050
if (ImGui::MenuItem("New Window", "Ctrl+Shift+N")) new_window();
20312051
if (ImGui::BeginMenu("Open...")) {
20322052
if (ImGui::MenuItem("In New Tab", "Ctrl+O")) open_file("");
@@ -2289,6 +2309,11 @@ void EditorApp::render_about_dialog() {
22892309
// Editor Area
22902310
// ============================================================================
22912311
void EditorApp::render_editor_area() {
2312+
if (active_tab_ >= 0 && active_tab_ < (int)tabs_.size() && tabs_[active_tab_].is_terminal) {
2313+
render_terminal();
2314+
return;
2315+
}
2316+
22922317
// Editor area inside the Editor window (already opened)
22932318
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_RootWindow)) {
22942319
editor_focused_ = true;
@@ -2637,20 +2662,31 @@ void EditorApp::render_sidebar() {
26372662

26382663
static float explorer_width = 250;
26392664
static bool dragging = false;
2665+
static int sidebar_view = 0; // 0=Files, 1=Git, 2=Symbol
26402666

26412667
// Explorer as a child window - fills full height
26422668
ImGui::BeginChild("##Explorer", ImVec2(explorer_width, -1), true, ImGuiWindowFlags_NoTitleBar);
26432669

2644-
// Header with title and close button
2645-
ImGui::Text("Explorer");
2670+
// Header with tabs and close button
2671+
if (ImGui::Button("F##view")) sidebar_view = 0;
2672+
ImGui::SameLine();
2673+
if (ImGui::Button("G##view")) sidebar_view = 1;
2674+
ImGui::SameLine();
2675+
if (ImGui::Button("S##view")) sidebar_view = 2;
26462676
ImGui::SameLine(ImGui::GetWindowWidth() - 30);
26472677
if (ImGui::Button("X")) {
26482678
show_file_tree_ = false;
26492679
}
26502680
ImGui::Separator();
26512681

2652-
// File tree
2653-
render_file_tree();
2682+
// Show selected view
2683+
if (sidebar_view == 0) {
2684+
render_file_tree();
2685+
} else if (sidebar_view == 1) {
2686+
render_git_changes();
2687+
} else {
2688+
render_symbol_outline();
2689+
}
26542690

26552691
ImGui::EndChild();
26562692

src/editor_app.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ struct EditorTab {
3939
std::string display_name; // "untitled" or filename
4040
bool dirty = false; // Has unsaved changes
4141
TextEditor* editor = nullptr; // Owned by tab
42+
bool is_terminal = false; // This tab is a terminal
4243
int zoom_pct = 100; // Zoom percentage
4344

4445
// Bookmark and change tracking
@@ -188,6 +189,7 @@ EditorApp(int argc = 0, char* argv[] = nullptr);
188189

189190
// File operations
190191
void new_tab();
192+
void new_terminal_tab();
191193
void new_window();
192194
void open_file(const std::string& path = "");
193195
bool save_tab(int idx);

0 commit comments

Comments
 (0)