mu4e-thread-folding icon indicating copy to clipboard operation
mu4e-thread-folding copied to clipboard

Weird thing happening with the point when threads are collapsed

Open mcamou opened this issue 4 years ago • 8 comments

If I have the point at the message just below a collapsed thread and I do an action (say press d for Delete) the action applies to one of the messages inside the fold instead of the one where the point is at. It could be related to #7

mcamou avatar Sep 23 '21 16:09 mcamou

The reason might be that the cursor is not moved after folding and still relate to the message before collapsing. Not moving the cursor is useful when you fold/unfold (your cursor does not move) but in your case it is annoying. Nott sure what would be the best behavior.

rougier avatar Sep 26 '21 17:09 rougier

However, this does not just happen after folding. My buffer has all messages folded. I move the cursor to the message below the fold, and when I hit Enter the last message within the fold is displayed. You can also see it in the message list: the underline that shows the current message disappears (I assume that it is somewhere within the fold).

Regarding what you mentioned about the best behavior, in my case at least I think that having the cursor move when you fold/unfold is a lot less annoying than having the wrong message be current. At least if the cursor moves the visual feedback actually matches what is happening behind the scenes.

If you don't want the cursor to move, when you fold you could change the current message to be the first message within the fold. That would fix both problems: the visual feedback matches what is displayed, and you still don't move the cursor. However, it might be a bit jarring/inconvenient if you are viewing a different message within the fold at that point.

mcamou avatar Sep 27 '21 08:09 mcamou

This is what I mean:

  • I am in the headers view, with no message opened. All threads are folded.
  • The cursor is on a message right above a folded conversation
  • I press J. The current message indicator (the underline) is the fold.
  • I press J. The current message indicator disappears.
  • I press J. The current message indicator appears on the message just below the fold.

If the fold contains an unread message, the message indicator disappears after trying moving to the message AFTER the unread message (not when moving to the unread message itself).

mcamou avatar Sep 27 '21 08:09 mcamou

The case with the fold containing an unread message can be even weirder. I just saw this happen:

  • The cursor is on the fold. There is an unread message from the fold right below the fold.
  • I press J. The current message indicator disappears.
  • I press J. The current message indicator appears on the message BELOW the unread message (i.e. there is no way to select the unread message short of unfolding)

mcamou avatar Sep 27 '21 08:09 mcamou

Do you get the same behavior if you use (n)ext (p)revious keys?

rougier avatar Sep 27 '21 09:09 rougier

I'm using Doom Emacs (therefore evil-mode), so J above is actually mu4e-headers-next (and I should actually have said j instead of J). The down arrow actually works correctly.

In the case of a single fold (whether the message below the fold is an unread message on the same thread, or is an unrelated message):

  • C-j on a fold moves the cursor to the message after the fold and the underline disappears.
  • The next C-j moves the cursor RIGHT one space, the underline is appears on the message after the fold (where the cursor is).
  • The next C-j moves the cursor to the next message, the underline reappears.

In the case of a two consecutive folds the same thing happens, except that the cursor does not move right when pressing C-j on the second fold.

mcamou avatar Sep 27 '21 09:09 mcamou

Correction: the down arrow does the same thing as j / C-j.

mcamou avatar Sep 27 '21 16:09 mcamou

By the way, I experienced an alternative thread folding which is simpler and faster: https://gist.github.com/rougier/98e83fb50e19fb73fe34a7ecc5fc1ccc

I think the behavior is more consistent but I'm not sure if it can be adapter to mu4e-thread-folding.

rougier avatar Oct 04 '21 08:10 rougier