[hackers] [st] Fix selection: selscroll || Jakub Leszczak

From: <git_AT_suckless.org>
Date: Tue, 12 May 2020 16:23:33 +0200 (CEST)

commit 045a0fab4f80b57f4a982ae6bc5f33fe21d66111
Author: Jakub Leszczak <szatan_AT_gecc.xyz>
AuthorDate: Wed May 6 13:36:59 2020 +0200
Commit: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
CommitDate: Tue May 12 15:38:17 2020 +0200

    Fix selection: selscroll

diff --git a/st.c b/st.c
index 7c15d5f..0d35613 100644
--- a/st.c
+++ b/st.c
_AT_@ -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();
         }
 }
 
Received on Tue May 12 2020 - 16:23:33 CEST

This archive was generated by hypermail 2.3.0 : Tue May 12 2020 - 16:24:44 CEST