Oops. Forgot to attach patches.
From da484767e0640244f719e4223ef786b550a8a07e Mon Sep 17 00:00:00 2001 From: Jakub Leszczak <[email protected]> Date: Wed, 6 May 2020 13:35:06 +0200 Subject: [PATCH 1/3] Fix selection: selclear in tputc
--- st.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/st.c b/st.c index 0ce6ac2..5258579 100644 --- a/st.c +++ b/st.c @@ -2413,7 +2413,7 @@ check_control_code: */ return; } - if (sel.ob.x != -1 && BETWEEN(term.c.y, sel.ob.y, sel.oe.y)) + if (selected(term.c.x, term.c.y)) selclear(); gp = &term.line[term.c.y][term.c.x]; -- 2.26.2
From 1fdeb246899b38472220d5168dd6e6f445113736 Mon Sep 17 00:00:00 2001 From: Jakub Leszczak <[email protected]> Date: Wed, 6 May 2020 13:35:53 +0200 Subject: [PATCH 2/3] Fix selection: ignore ATTR_WRAP when rectangular selection in getsel --- st.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/st.c b/st.c index 5258579..7210b5f 100644 --- a/st.c +++ b/st.c @@ -634,7 +634,8 @@ getsel(void) * st. * FIXME: Fix the computer world. */ - if ((y < sel.ne.y || lastx >= linelen) && !(last->mode & ATTR_WRAP)) + if ((y < sel.ne.y || lastx >= linelen) && + (!(last->mode & ATTR_WRAP) || sel.type == SEL_RECTANGULAR)) *ptr++ = '\n'; } *ptr = 0; -- 2.26.2
From 266183041e450794ed538358d0bd96e66ac2233e Mon Sep 17 00:00:00 2001 From: Jakub Leszczak <[email protected]> Date: Wed, 6 May 2020 13:36:59 +0200 Subject: [PATCH 3/3] Fix selection: selscroll --- st.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/st.c b/st.c index 7210b5f..cbc97de 100644 --- a/st.c +++ b/st.c @@ -1106,27 +1106,17 @@ selscroll(int orig, int n) if (sel.ob.x == -1) return; - if (BETWEEN(sel.ob.y, orig, term.bot) || BETWEEN(sel.oe.y, orig, term.bot)) { - if ((sel.ob.y += n) > term.bot || (sel.oe.y += n) < term.top) { + if (BETWEEN(sel.nb.y, orig, term.bot) != BETWEEN(sel.ne.y, orig, term.bot)) { + selclear(); + } else if (BETWEEN(sel.nb.y, orig, term.bot)) { + sel.ob.y += n; + sel.oe.y += n; + if (sel.ob.y < term.top || sel.ob.y > term.bot || + sel.oe.y < term.top || sel.oe.y > term.bot) { selclear(); - return; - } - if (sel.type == SEL_RECTANGULAR) { - if (sel.ob.y < term.top) - sel.ob.y = term.top; - if (sel.oe.y > term.bot) - sel.oe.y = term.bot; } else { - if (sel.ob.y < term.top) { - sel.ob.y = term.top; - sel.ob.x = 0; - } - if (sel.oe.y > term.bot) { - sel.oe.y = term.bot; - sel.oe.x = term.col; - } + selnormalize(); } - selnormalize(); } } -- 2.26.2
