~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
1

[PATCH left] scroll: Don't allow scrolling too far

Details
Message ID
<20210109062000.13545-1-zachdecook@librem.one>
DKIM signature
missing
Download raw message
Patch: +1 -0
---
 left.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/left.c b/left.c
index 8de7130..87e1d44 100644
--- a/left.c
+++ b/left.c
@@ -325,6 +325,7 @@ error(char *msg, const char *err)
void
setscroll(int v)
{
	v = clamp(v, 0, getrow(doc.len) - VER);
	if(v >= 0) {
		sel.scroll = v;
		redraw(pixels);
-- 
2.29.2

[PATCH left] Mouse Wheel: enable scrolling and move cursor with CTRL+Scroll

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

diff --git a/left.c b/left.c
index 87e1d44..781122f 100644
--- a/left.c
+++ b/left.c
@@ -510,6 +510,18 @@ domouse(SDL_Event *event)
	}
}

void
dowheel(SDL_Event *event)
{
	int ctrl = SDL_GetModState() & (KMOD_LCTRL | KMOD_RCTRL);
	if(ctrl)
		setselection(getcell(
			getcol(sel.from),getrow(sel.from)-event->wheel.y
		), -1);
	else
		setscroll(sel.scroll - event->wheel.y);
}

void
dokey(SDL_Event *event)
{
@@ -632,6 +644,7 @@ main(int argc, char *argv[])
			case SDL_MOUSEBUTTONUP:
			case SDL_MOUSEBUTTONDOWN:
			case SDL_MOUSEMOTION: domouse(&event); break;
			case SDL_MOUSEWHEEL: dowheel(&event); break;
			case SDL_TEXTINPUT: dotext(&event); break;
			case SDL_KEYDOWN: dokey(&event); break;
			case SDL_WINDOWEVENT:
-- 
2.29.2
Reply to thread Export thread (mbox)