Subject: Re: bug#52092: 28.0.60; hs-toggle-hiding does not toggle once folded
From: Stefan Monnier <[email-masked]>
To: kobarity <[email-masked]>
Cc: Dan Nicolaescu <[email-masked]>, Thien-Thi Nguyen <[email-masked]>, Eli Zaretskii <[email-masked]>, [email-masked], Mohammed Sadiq <[email-masked]>
Date: Sat, 24 Sep 2022 11:10:26 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

[ Added Thien-Thi and Dan to the Cc since they're listed as maintainers
  of `hideshow.el`.  ]

kobarity [2022-09-24 14:59:56] wrote:
> Stefan Monnier wrote:
>> The patch below should fix it.
> Thanks, I didn't know `last-nonmenu-event'.  I confirmed that the
> patch enables the mouse to hide the clicked block.

I pushed it to the `emacs-28` branch, because it's fixing a stupid regression.

>> I had no idea that (posn-point (posn-at-point POS)) doesn't return POS
>> if POS is within an invisible chunk of text and instead returns the next
>> visible position.
>> 
>> I'll have to think about how best to fix the consequence.
>
> Thank you for consideration.

I pushed to `master` a patch which makes `event-end` return a position
that's always at `point` for keyboard events, even if `point` is hidden.
That should bring back the previous behavior (it's not safe enough for
the `emacs-28` branch, sadly).

But I think your patch is still an improvement since it makes
`hs-toggle-hiding` work even when point is right after the hidden block.
I also like the additional tests you provide.
So I adjusted it to the new code and pushed it to `master`.

Thank you,

        Stefan