st
simple terminal
git clone https://9o.is/git/st.git
commit a2a0be97a1022b658304a9cbf45c6cf66bf515c7 parent 2ff3f4e2a81bcdedff9bf23bf48e37b899effd29 Author: Jakub Leszczak <szatan@gecc.xyz> Date: Wed, 6 May 2020 13:36:59 +0200 Fix selection: selscroll Diffstat:
| M | st.c | | | 26 | ++++++++------------------ |
1 file changed, 8 insertions(+), 18 deletions(-)
diff --git 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(); } }