From d1b9cca73c954702efcfdcbcfaff8f2bc109cbfb Mon Sep 17 00:00:00 2001 From: bakkeby Date: Mon, 19 Jul 2021 10:14:56 +0200 Subject: [PATCH] Adding clearing of images and scrollback history when using clear ref. #30 --- st.c | 17 ++++++++++++++++- st.info | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/st.c b/st.c index 999bab6..3eee18b 100644 --- a/st.c +++ b/st.c @@ -2201,9 +2201,24 @@ csihandle(void) tclearregion(0, 0, term.col-1, term.c.y-1); tclearregion(0, term.c.y, term.c.x, term.c.y); break; - case 2: /* all */ + case 2: /* screen */ tclearregion(0, 0, term.col-1, term.row-1); break; + case 3: /* all including scrollback */ + tclearregion(0, 0, term.col-1, term.row-1); + + #if SCROLLBACK_PATCH + term.scr = 0; + term.histi = 0; + for (int i = 0; i < HISTSIZE; i++) + term.hist[i][0].u = '\0'; + #endif // SCROLLBACK_PATCH + + #if SIXEL_PATCH + for (im = term.images; im; im = im->next) + im->should_delete = 1; + #endif // SIXEL_PATCH + break; default: goto unknown; } diff --git a/st.info b/st.info index a45d8de..c21730e 100644 --- a/st.info +++ b/st.info @@ -10,7 +10,7 @@ st-mono| simpleterm monocolor, cbt=\E[Z, cvvis=\E[?25h, civis=\E[?25l, - clear=\E[H\E[2J, + clear=\E[H\E[3J, cnorm=\E[?12l\E[?25h, colors#2, cols#80,