Skip to content

Commit

Permalink
Define a function to go back in display lineage
Browse files Browse the repository at this point in the history
  • Loading branch information
QDoussot committed Oct 13, 2024
1 parent 00c6bc6 commit e663824
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions include/tig/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ struct display_lineage {
};
extern struct display_lineage *display_lineage;

void rewind_lineage();
void free_display_lineage();

void init_tty(void);
Expand Down
5 changes: 5 additions & 0 deletions src/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,11 @@ enable_mouse(bool enable)
#endif
}

void rewind_lineage() {
struct display_lineage *exited = display_lineage;
display_lineage = display_lineage->prev;
free(exited);
}
void
free_display_lineage()
{
Expand Down
4 changes: 1 addition & 3 deletions src/stage.c
Original file line number Diff line number Diff line change
Expand Up @@ -806,9 +806,7 @@ stage_read(struct view *view, struct buffer *buf, bool force_stop)
watch_apply(&view->watch, WATCH_INDEX);
stage_line_type = 0;
maximize_view(display_lineage->display[0], false);
struct display_lineage * exiting_dl = display_lineage;
display_lineage = display_lineage->prev;
free(exiting_dl);
rewind_lineage();
return false;
}

Expand Down
3 changes: 1 addition & 2 deletions src/tig.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,7 @@ view_driver(struct view *view, enum request request)
if (dl->current_view == 1) {
load_view(dl->display[1], dl->display[0], OPEN_SPLIT);
}
display_lineage = display_lineage->prev;
free(dl);
rewind_lineage();
break;
}

Expand Down

0 comments on commit e663824

Please sign in to comment.