diff options
author | Jakub Leszczak <szatan@gecc.xyz> | 2020-05-06 13:36:59 +0200 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2020-05-12 15:38:17 +0200 |
commit | 045a0fab4f80b57f4a982ae6bc5f33fe21d66111 (patch) | |
tree | d123b77bfc535f284a209fcd83659a9711f8ac0b /st.c | |
parent | 9c30066e73f0105c3fccb7582c8172d5117857b3 (diff) | |
download | st-045a0fab4f80b57f4a982ae6bc5f33fe21d66111.tar.gz st-045a0fab4f80b57f4a982ae6bc5f33fe21d66111.tar.bz2 st-045a0fab4f80b57f4a982ae6bc5f33fe21d66111.zip |
Fix selection: selscroll
Diffstat (limited to 'st.c')
-rw-r--r-- | st.c | 26 |
1 files changed, 8 insertions, 18 deletions
@@ -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(); } } |