~rabbits/public-inbox

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2

[PATCH left] mouse: Fix double right-clicking expanding selection

Details
Message ID
<20210110051219.10476-1-zachdecook@librem.one>
DKIM signature
missing
Download raw message
Patch: +9 -7
---
 left.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/left.c b/left.c
index d152ed2..a9552bf 100644
--- a/left.c
+++ b/left.c
@@ -552,13 +552,15 @@ domouse(SDL_Event *event)
					dogoto(doc.text + sel.from + 1, sel.to - sel.from);
				else
					dofind(doc.text + sel.from, sel.to - sel.from);
			} else if(SDL_GetModState() & KMOD_LSHIFT)
				setselection(sel.from, getcell(xcell - 4, view.y + ycell));
			else
				setselection(getcell(xcell - 4, view.y + ycell), -1);
			if(event->button.clicks == 2) {
				Selection word = selectword(sel.from);
				setselection(word.from, word.to);
			} else {
				if(SDL_GetModState() & KMOD_SHIFT)
					setselection(sel.from, getcell(xcell - 4, view.y + ycell));
				else
					setselection(getcell(xcell - 4, view.y + ycell), -1);
				if(event->button.clicks == 2) {
					Selection word = selectword(sel.from);
					setselection(word.from, word.to);
				}
			}
		}
		break;
-- 
2.29.2

[PATCH left] mouse: Fix selecting first line

Details
Message ID
<20210110051219.10476-2-zachdecook@librem.one>
In-Reply-To
<20210110051219.10476-1-zachdecook@librem.one> (view parent)
DKIM signature
missing
Download raw message
Patch: +2 -2
---
 left.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/left.c b/left.c
index a9552bf..dbee7cf 100644
--- a/left.c
+++ b/left.c
@@ -546,7 +546,7 @@ domouse(SDL_Event *event)
			setscroll(0, (ycell) * (getrow(doc.len) / VER));
		else if(xcell >= 0 && xcell <= 3) /* line number */
			setselection(getcell(0, view.y + ycell), getcell(0, view.y + ycell + 1) - 1);
		else if(xcell >= 4 && ycell > 0 && ycell <= VER) {
		else if(xcell >= 4 && ycell >= 0 && ycell <= VER) {
			if(event->button.button != 1) {
				if(doc.text[sel.from] == ':')
					dogoto(doc.text + sel.from + 1, sel.to - sel.from);
@@ -570,7 +570,7 @@ domouse(SDL_Event *event)
			ycell = event->motion.y / ZOOM / 8 - PAD;
			if(xcell >= HOR - 1)
				setscroll(0, ycell * (getrow(doc.len) / VER) - 1);
			else if(xcell >= 4 && ycell > 0 && ycell <= VER)
			else if(xcell >= 4 && ycell >= 0 && ycell <= VER)
				setselection(sel.from, getcell(xcell - 5, view.y + ycell));
		}
		break;
-- 
2.29.2

[PATCH left v2] search: Prevent search selection from changing inadvertently

Details
Message ID
<20210112001718.13351-1-zachdecook@librem.one>
In-Reply-To
<20210110051219.10476-1-zachdecook@librem.one> (view parent)
DKIM signature
missing
Download raw message
Patch: +10 -8
Notably, it would expand the selection to the end of the word
(changing your search subject, making more complicated searches difficult)
rather than jumping forward two search results
---
 left.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/left.c b/left.c
index 0f1b911..e30f85b 100644
--- a/left.c
+++ b/left.c
@@ -555,7 +555,7 @@ dofind(char *src, int len)
	scpy(src, buf, len);
	next = ssin(src + 1, buf);
	if(next > 0)
		setselection(sel.from + next + 1, nextword(sel.from + next + 2));
		setselection(sel.from + next + 1, sel.from + next + 1 + len);
}

void
@@ -731,13 +731,15 @@ domouse(SDL_Event *event)
					dogoto(doc.text + sel.from + 1, sel.to - sel.from);
				else
					dofind(doc.text + sel.from, sel.to - sel.from);
			} else if(SDL_GetModState() & KMOD_LSHIFT)
				setselection(sel.from, getcell(view.x + xcell - 4, view.y + ycell));
			else
				setselection(getcell(view.x + xcell - 4, view.y + ycell), -1);
			if(event->button.clicks == 2) {
				Range word = selectword(sel.from);
				setselection(word.from, word.to);
			} else {
				if(SDL_GetModState() & KMOD_SHIFT)
					setselection(sel.from, getcell(view.x + xcell - 4, view.y + ycell));
				else
					setselection(getcell(view.x + xcell - 4, view.y + ycell), -1);
				if(event->button.clicks == 2) {
					Range word = selectword(sel.from);
					setselection(word.from, word.to);
				}
			}
		}
		break;
-- 
2.29.2
Reply to thread Export thread (mbox)