From a2b7df1920a3480b05053f8cda1dcc58c4180e26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaakko=20Ker=C3=A4nen?= Date: Wed, 25 Oct 2023 14:28:08 +0300 Subject: [PATCH 1/1] DocumentWidget: Text selection extending inadvertently during scrolling This was a regression that occurred when the "auto-scrolling while selecting" feature was implemented. --- res/about/version.gmi | 1 + src/ui/documentwidget.c | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/res/about/version.gmi b/res/about/version.gmi index b4d377c6..7522df97 100644 --- a/res/about/version.gmi +++ b/res/about/version.gmi @@ -7,6 +7,7 @@ # Release notes ## 1.17.2 +* Fixed current text selection extending during scrolling even after mouse button has been released. * Fixed the numbered links key (default: Alt/Option) while navigating to new pages. It is no longer necessary to release and press the key again on the new page. * Fixed long bookmark titles making the Bookmarks menu too wide. * Mouse wheel direction switches back to vertical when a wide block has been scrolled all the way. diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 0817a912..5bd8c9ea 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c @@ -4713,7 +4713,7 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e else if (y > bottom_Rect(bounds) - autoScrollRegion) { delta = (y - bottom_Rect(bounds) + autoScrollRegion) / (float) autoScrollRegion; } - float speed = iClamp(fabsf(delta * delta * delta), 0, 1) * gap_Text * 200; + float speed = iClamp(fabsf(delta * delta * delta), 0, 1) * gap_Text * 150; if (speed != 0.0f) { setValueSpeed_Anim(&d->view->scrollY.pos, delta < 0 ? 0.0f : d->view->scrollY.max, @@ -4741,7 +4741,8 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e closeMenu_Widget(d->menu); } d->flags &= ~(movingSelectMarkStart_DocumentWidgetFlag | - movingSelectMarkEnd_DocumentWidgetFlag); + movingSelectMarkEnd_DocumentWidgetFlag | + selecting_DocumentWidgetFlag); if (!isMoved_Click(&d->click)) { setFocus_Widget(NULL); /* Tap in tap selection mode. */ @@ -4883,6 +4884,7 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e setGrabbedPlayer_DocumentWidget_(d, NULL); return iTrue; } + iChangeFlags(d->flags, selecting_DocumentWidgetFlag, iFalse); stop_Anim(&d->view->scrollY.pos); return iTrue; default: -- 2.34.1