micro icon indicating copy to clipboard operation
micro copied to clipboard

micro: Don't forward nil events into the sub event handler

Open JoeKar opened this issue 1 year ago • 3 comments

Currently the Redraw() performed by the UpdateDiff() will bring the raw pane into trouble. According to https://github.com/zyedidia/micro/issues/2991#issuecomment-1777596853 it's possible to have the redraw event without a parallel tcell event and this can lead to event pointer de-references in the sub event handler.

Fixes #2991

JoeKar avatar Oct 24 '23 19:10 JoeKar

One more reason to merge this PR: #3011

dmaluka avatar Nov 07 '23 00:11 dmaluka

is there any reason this is still being held up?

octoshrimpy avatar Jan 22 '24 19:01 octoshrimpy

@zyedidia ping.

dmaluka avatar Jan 22 '24 22:01 dmaluka

Hey so I'm bisecting a regression to this PR. It seems that the change here is breaking existing behavior when an interactive shell is used. To reproduce it:

  • Install this plugin: https://github.com/samdmarshall/micro-fzf-plugin
  • Execute fzf command
  • Even though the plugin is configured so we don't wait for terminal output, micro will always prompt with the message Press enter to continue

So maybe there is a corner case that is not handled here? Or am I doing things the wrong way?

Thanks!

xxuejie avatar Jul 09 '24 06:07 xxuejie

Yeah, this is a regression, thanks for reporting. We missed that since commit b68461cf72cb the terminal code has been (slightly hackily) relying on nil events as notifications to close the terminal:

https://github.com/zyedidia/micro/commit/b68461cf72cb913c40dd60a77b2cb2fcc27aec0f#diff-f4c689c96c13af20e2e9fc3cfdb39b4549de701266748f0acaac5c5b4ce92fd6R113

so now micro doesn't close the terminal automatically, so you see this Press enter to close instead.

I think we can fix it in a better way. I'll try to fix it shortly.

dmaluka avatar Jul 10 '24 08:07 dmaluka

Fixed by #3386

dmaluka avatar Jul 14 '24 15:07 dmaluka

Thanks! I can confirm that #3386 indeed fixes the issue.

xxuejie avatar Jul 15 '24 01:07 xxuejie