Re: [hackers] [st] [PATCH] set sel.alt in selstart instead of selextend

From: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Thu, 29 Mar 2018 18:16:07 +0200

On Wed, Mar 28, 2018 at 09:27:58PM +0200, Daniel Tameling wrote:
> ---
>
> When selecting something via doubleclick after entering or leaving the
> altscreen mode, the selection is not highlighted with st 0.8. But it
> gets copied to the primary, so the problem is only the highlighting.
>
> To reproduce this, enter less and select something with a
> doubleclick. Afterwards you cannot see in the terminal what you
> selected. But once you start scrolling, the selection appears.
>
> The reason for this behavior is that selextend is only called when the
> mouse button is released the second time. But during this call the
> tsetdirt function isn't called, so the terminal isn't redrawn. What
> gets selected has at that point already been decided during selstart,
> but the subsequent tsetdirt doesn't have any effect as the function
> selected returns early if sel.alt != IS_SET(MODE_ALTSCREEN). Thus,
> setting sel.alt is moved to selstart, which fixes the bug and didn't
> show any side effects during my testing.
>
> st.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/st.c b/st.c
> index 46c954b..2612c95 100644
> --- a/st.c
> +++ b/st.c
> _AT_@ -446,6 +446,7 @@ selstart(int col, int row, int snap)
> selclear();
> sel.mode = SEL_EMPTY;
> sel.type = SEL_REGULAR;
> + sel.alt = IS_SET(MODE_ALTSCREEN);
> sel.snap = snap;
> sel.oe.x = sel.ob.x = col;
> sel.oe.y = sel.ob.y = row;
> _AT_@ -474,7 +475,6 @@ selextend(int col, int row, int type, int done)
> oldsey = sel.ne.y;
> oldtype = sel.type;
>
> - sel.alt = IS_SET(MODE_ALTSCREEN);
> sel.oe.x = col;
> sel.oe.y = row;
> selnormalize();
> --
> 2.11.0
>
>

Applied thanks, it is much appreciated.

The regression was probably in bcb5d3ad.

-- 
Kind regards,
Hiltjo
Received on Thu Mar 29 2018 - 18:16:07 CEST

This archive was generated by hypermail 2.3.0 : Thu Mar 29 2018 - 18:24:24 CEST