zellij-org / zellij

A terminal workspace with batteries included
https://zellij.dev
MIT License
21.99k stars 669 forks source link

Refactor Pane #3764

Open a-usr opened 1 week ago

a-usr commented 1 week ago

Refactor Pane somewhat according to https://github.com/zellij-org/zellij/blob/1dbd14f277ceff89588adf6d8db10d856c310e69/zellij-server/src/tab/mod.rs#L206

As of now I've added a enum (Pane) which holds either a TerminalPane, or a PluginPane, and derefs to the PaneTrait (previously just Pane) trait.

Things I need to know:

Other Ideas and suggestions are more than welcome

Regarding the methods that should be moved

Here is a quick list of methods that I think might be better off outside of PaneTrait:

Methods that I might be better off in TerminalPane

https://github.com/zellij-org/zellij/blob/1dbd14f277ceff89588adf6d8db10d856c310e69/zellij-server/src/tab/mod.rs#L483

https://github.com/zellij-org/zellij/blob/1dbd14f277ceff89588adf6d8db10d856c310e69/zellij-server/src/tab/mod.rs#L486

https://github.com/zellij-org/zellij/blob/1dbd14f277ceff89588adf6d8db10d856c310e69/zellij-server/src/tab/mod.rs#L493

Methods that might be better off in PluginPane

https://github.com/zellij-org/zellij/blob/1dbd14f277ceff89588adf6d8db10d856c310e69/zellij-server/src/tab/mod.rs#L475-L477

Q&A

Q: Why make this Draft instead of just coding away?

A: Because I prefer gathering info and tips before doing a somewhat huge amount of changes over having to scrap 90% of my code because it doesnt conform to the general vision of the Maintainers

Q: Why this?

A: Because Im currently working on another (smaller) change, and I dont want to have to write Spagetti Code to make it work. And Im sure the Maintainer(s) dont want me to either.

a-usr commented 1 week ago

Im just gonna let this sit here for the next week or so, and hope the people that need to see this do.