membrane

2021-08-26T20:29:16.005700Z

@smith.adriane finally got a chance to try it out, it works very well, thanks again 👍 One thing that I noticed using the re-frame wrapper is that with terminal-resized it does not work to use pure vectors to dispatch re-frame events like [[:some-event]] , but it is not a big deal because there is a simple workaround of using (dispatch [:some-event]) explicitly. So instead of:

(on :terminal-resized
    (fn [new-size]
      [[:set-terminal-size new-size]]))
I do:
(on :terminal-resized
    (fn [new-size]
      (dispatch [:set-terminal-size new-size])
      nil))

phronmophobic 2021-08-26T20:31:43.007400Z

ah, ok. I added support for extensible events like terminal-resized in membrane.component, but not for re-frame. Just need to do the same thing in the membrane.re-frame

phronmophobic 2021-08-26T20:32:49.008500Z

One thing I realized with the terminal-resized event is that you need to create the view before firing the :terminal-resized event and there's probably some use cases that want to know the size before creating the view

phronmophobic 2021-08-26T20:33:49.009300Z

which makes me thing that having it as an event might not be the best fit and it should instead be a callback provided to membrane.lanterna/run

2021-08-26T20:57:39.010900Z

Maybe that could be a bit nicer, but I don't see a problem also with wrapping it like this for example:

(on :terminal-resized
    ...
    (when-some [[w h] @(subscribe [:size])]
      (vertical-layout ...)))