Skip to content

Commit 9d595c9

Browse files
committed
Fix: Bookmarks, change history, folding on right of line numbers. v0.2.36
1 parent bfbfc5b commit 9d595c9

4 files changed

Lines changed: 15 additions & 13 deletions

File tree

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.2.35
1+
0.2.36

imgui.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Collapsed=0
3030

3131
[Window][pcode-editor]
3232
Pos=0,0
33-
Size=1280,800
33+
Size=1159,669
3434
Collapsed=0
3535

3636
[Docking][Data]

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": ".\\src",
16-
"recent_files": [".\\src\\editor_app.h", ".\\src\\main.cpp", ".\\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"]
16+
"recent_files": [".\\src\\editor_app.cpp", ".\\src\\editor_app.h", ".\\src\\main.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"]
1717
}

src/editor_app.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ static void settings_load(AppSettings& s, const std::string& path) {
159159
// Version
160160
// ============================================================================
161161
std::string EditorApp::get_version() {
162-
return "pCode Editor version 0.2.34";
162+
return "pCode Editor version 0.2.35";
163163
}
164164

165165
// ============================================================================
@@ -2195,9 +2195,10 @@ bool show_margins = settings_.show_bookmark_margin || settings_.show_change_hist
21952195
int max_line = total_lines;
21962196
int digit_count = 1;
21972197
while (max_line >= 10) { max_line /= 10; digit_count++; }
2198-
float gutter_width = 16.0f + (digit_count * 8.0f) + 8.0f; // padding + digits + margin
2198+
float line_num_width = digit_count * 8.0f + 8.0f;
2199+
float gutter_width = line_num_width + 48.0f; // line numbers + markers on right
21992200

2200-
// Build markers for lookup (using vector search is fine for small sets)
2201+
// Build markers for lookup
22012202
auto& bookmarks = tab.bookmarks;
22022203
auto& changed_lines = tab.changed_lines;
22032204
auto& folds = tab.folds;
@@ -2262,23 +2263,24 @@ bool show_margins = settings_.show_bookmark_margin || settings_.show_change_hist
22622263
for (int line = 0; line < total_lines; line++) {
22632264
ImGui::PushID(line);
22642265

2265-
// Right-align line numbers with padding
2266+
// Line numbers on LEFT side
22662267
if (settings_.show_line_numbers) {
22672268
int line_display = line + 1;
22682269
char line_num[16];
22692270
sprintf(line_num, "%*d", digit_count, line_display);
22702271

2271-
// Check if current line for highlight
22722272
bool is_current_line = (line == editor->GetCursorPosition().mLine);
22732273
if (is_current_line) {
22742274
ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.4f, 1.0f), line_num);
22752275
} else {
22762276
ImGui::TextColored(ImVec4(0.4f, 0.4f, 0.5f, 1.0f), line_num);
22772277
}
2278-
ImGui::SameLine();
22792278
}
22802279

2281-
// Bookmark column (far left, 16px)
2280+
// Move to right side of gutter
2281+
ImGui::SetCursorPosX(ImGui::GetItemRectMin().x + line_num_width);
2282+
2283+
// Bookmark column (right side)
22822284
if (settings_.show_bookmark_margin) {
22832285
bool is_bookmarked = std::find(bookmarks.begin(), bookmarks.end(), line) != bookmarks.end();
22842286
if (is_bookmarked) {
@@ -2289,7 +2291,7 @@ bool show_margins = settings_.show_bookmark_margin || settings_.show_change_hist
22892291
ImGui::SameLine();
22902292
}
22912293

2292-
// Change history indicator (shows modified lines in green/red)
2294+
// Change history indicator (right side)
22932295
if (settings_.show_change_history) {
22942296
bool is_changed = std::find(changed_lines.begin(), changed_lines.end(), line) != changed_lines.end();
22952297
if (is_changed) {
@@ -2298,7 +2300,7 @@ bool show_margins = settings_.show_bookmark_margin || settings_.show_change_hist
22982300
ImGui::SameLine();
22992301
}
23002302

2301-
// Fold indicator (+ or -)
2303+
// Fold indicator (rightmost)
23022304
bool is_fold_start = false, is_fold_end = false;
23032305
for (const auto& f : folds) {
23042306
if (f.first == line) is_fold_start = true;
@@ -2799,7 +2801,7 @@ void EditorApp::render_status_bar() {
27992801
ImGui::SameLine();
28002802

28012803
// Version with git hash
2802-
ImGui::Text("v0.2.35");
2804+
ImGui::Text("v0.2.36");
28032805
}
28042806

28052807
ImGui::PopStyleColor();

0 commit comments

Comments
 (0)