Improving the jump history

This commit is contained in:
Krzosa Karol
2026-01-05 10:30:17 +01:00
parent 77c6bf3da9
commit 80ea09b3ea
6 changed files with 24 additions and 13 deletions

View File

@@ -613,12 +613,24 @@ void Update(Event event) {
For (Windows) {
if (it->jump_history) {
View *view = GetView(it->active_view);
bool are_equal = it->begin_frame_crumb.view_id == it->active_view && AreEqual(view->carets[0], it->begin_frame_crumb.caret);
if (!are_equal) {
if (!it->skip_checkpoint) {
Add(&it->goto_history, it->begin_frame_crumb);
it->goto_redo.len = 0;
bool should_checkpoint = true;
if (it->skip_checkpoint) {
should_checkpoint = false;
}
if (should_checkpoint && it->begin_frame_crumb.view_id == it->active_view) {
if (AreEqual(view->carets[0], it->begin_frame_crumb.caret)) {
should_checkpoint = false;
}
Buffer *buffer = GetBuffer(view->active_buffer);
if (PosToLine(buffer, GetFront(view->main_caret_on_begin_frame)) == PosToLine(buffer, GetFront(view->carets[0]))) {
should_checkpoint = false;
}
}
if (should_checkpoint) {
Add(&it->goto_history, it->begin_frame_crumb);
it->goto_redo.len = 0;
}
it->skip_checkpoint = false;
}