Skip to content

Commit df63f71

Browse files
committed
Add code folding toggle to context menu
1 parent 72ee38b commit df63f71

4 files changed

Lines changed: 16 additions & 9 deletions

File tree

imgui.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[Window][Editor]
22
Pos=0,0
3-
Size=1372,778
3+
Size=1920,1009
44
Collapsed=0
55

66
[Window][DockSpace]
@@ -13,8 +13,8 @@ Size=1280,800
1313
Collapsed=1
1414

1515
[Window][Font Settings]
16-
Pos=230,182
17-
Size=476,221
16+
Pos=460,282
17+
Size=431,221
1818
Collapsed=0
1919

2020
[Window][Explorer]

pcode-settings.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
2-
"window_w": 1372,
3-
"window_h": 778,
2+
"window_w": 1920,
3+
"window_h": 1009,
44
"dark_theme": true,
55
"show_status_bar": true,
66
"word_wrap": true,
77
"show_line_numbers": true,
88
"show_minimap": true,
9-
"show_spaces": true,
9+
"show_spaces": false,
1010
"highlight_line": 0,
1111
"show_tabs": true,
1212
"tab_size": 4,
13-
"font_size": 17,
14-
"font_name": "CascadiaMono",
13+
"font_size": 18,
14+
"font_name": "JetBrainsMonoNLNerdFont-Regular",
1515
"last_open_dir": "C:\\Users\\casse\\github\\pcode-editor\\src",
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"]
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"]
1717
}

src/editor_app.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -894,6 +894,10 @@ void EditorApp::toggle_minimap() {
894894
settings_.show_minimap = !settings_.show_minimap;
895895
}
896896

897+
void EditorApp::toggle_code_folding() {
898+
settings_.show_code_folding = !settings_.show_code_folding;
899+
}
900+
897901
void EditorApp::toggle_theme() {
898902
settings_.dark_theme = !settings_.dark_theme;
899903
apply_theme(settings_.dark_theme);
@@ -2009,6 +2013,7 @@ if (editor_open) {
20092013
ImGui::Separator();
20102014
if (ImGui::MenuItem("Toggle Line Numbers", nullptr, (bool*)&settings_.show_line_numbers)) settings_.show_line_numbers = !settings_.show_line_numbers;
20112015
if (ImGui::MenuItem("Toggle Minimap", nullptr, (bool*)&settings_.show_minimap)) settings_.show_minimap = !settings_.show_minimap;
2016+
if (ImGui::MenuItem("Toggle Code Folding", nullptr, (bool*)&settings_.show_code_folding)) settings_.show_code_folding = !settings_.show_code_folding;
20122017
ImGui::EndPopup();
20132018
}
20142019

src/editor_app.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ struct AppSettings {
8181
bool word_wrap = true; // Default: word wrap enabled, no horizontal scrollbar
8282
bool show_line_numbers = false;
8383
bool show_bookmark_margin = false;
84+
bool show_code_folding = true;
8485
bool show_change_history = false;
8586
bool show_minimap = false;
8687
bool show_spaces = false;
@@ -220,6 +221,7 @@ EditorApp(int argc = 0, char* argv[] = nullptr);
220221
void toggle_line_numbers();
221222
void toggle_spaces();
222223
void toggle_minimap();
224+
void toggle_code_folding();
223225
void render_minimap(TextEditor* editor);
224226
void toggle_theme();
225227
void set_tab_size(int size);

0 commit comments

Comments
 (0)