Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default mode 368 #513

Merged
merged 3 commits into from
May 29, 2021
Merged

Default mode 368 #513

merged 3 commits into from
May 29, 2021

Conversation

a-kenji
Copy link
Contributor

@a-kenji a-kenji commented May 15, 2021

This aims to make setting a default_mode (the first mode you start with) possible.
This works already, but the plugin doesn't correctly show it yet until the first change of events.

@a-kenji a-kenji requested a review from TheLostLambda May 15, 2021 12:07
@a-kenji a-kenji force-pushed the default-mode-368 branch 2 times, most recently from 909035f to d90c31f Compare May 15, 2021 15:43
@a-kenji
Copy link
Contributor Author

a-kenji commented May 18, 2021

@TheLostLambda
Would it make sense to add some sort of update function to the
load function?

I want the plugin to read the InputMode already on load, so it can display
the locked mode.

Maybe all it does is call the update function that is already defined on load?

@TheLostLambda
Copy link
Member

@a-kenji Is the issue that you aren't getting a properly updated mode when the plugin first loads? If so, we'll have to smush a bug somewhere because I made the ModeInfo struct special at some point. Every plugin that is loaded should have a ModeInfo event dispatched to it automatically. I've been able to start plugins with different modes on the first load in the past (that's what happens every time you open a new tab, since that reloads the plugins), so it should be easy to start in a different mode.

I suspect a bug more than a missing feature here, but I'll have to take a closer look soon (I'm still a bit busy this week with exams)

@a-kenji
Copy link
Contributor Author

a-kenji commented May 18, 2021

@TheLostLambda
Thanks for the response - no pressure!

Is the issue that you aren't getting a properly updated mode when the plugin first loads? If so, we'll have to smush a bug somewhere because I made the ModeInfo struct special at some point.

I think so yeah, I suspect the plugin is loaded with defaults on the first creation.

I'll into it a little more!

@a-kenji a-kenji force-pushed the default-mode-368 branch from a9d640e to d90c31f Compare May 24, 2021 20:59
* Parsing Implemented

* Adds option to specify a default mode
  either through a flag `--options default-mode [MODE]`,
  or a configuration option `default_mode: [MODE]`

closes zellij-org#368
@a-kenji a-kenji force-pushed the default-mode-368 branch from d90c31f to 80fe803 Compare May 24, 2021 21:07
@a-kenji
Copy link
Contributor Author

a-kenji commented May 24, 2021

@TheLostLambda

Thank you for the help!
I figured it out now, the plugins are getting an update when
a tab is created, but not on the initial load.

I propagate the information now on creation.
I think that should be sufficient for now.
As soon as I am able I will merge from main.

…ult-mode-368

* If starting in the locked mode after the merge,
the locked mode seems to need 2 actions to go to
the normal mode - after that everything works
as expected.

- This is not intended.
@a-kenji a-kenji force-pushed the default-mode-368 branch from d31616a to 81b026d Compare May 27, 2021 13:51
@a-kenji
Copy link
Contributor Author

a-kenji commented May 27, 2021

@kunalmohan,

I am having Issues merging this change into the current main,
maybe you have some idea where the mode behaviour change
may come from.

Pre merge, the mode functions properly, even when starting in the
locked mode. But after the merge I need to switch to the normal mode
twice in order for it to have an effect.

And as always no rush!

@kunalmohan
Copy link
Member

@a-kenji how do the plugins receive the default_mode from the config options?

@a-kenji
Copy link
Contributor Author

a-kenji commented May 27, 2021

@kunalmohan
Either through:
zellij options --default-mode [mode]
or setting default_mode: [mode] in the config file

@kunalmohan
Copy link
Member

@a-kenji Sorry, I wasn't clear. I meant in the code. Where/when does the wasm thread receive the default_mode at startup?

@a-kenji
Copy link
Contributor Author

a-kenji commented May 29, 2021

@kunalmohan
No problem!
I left a comment where the changes are picked up for the plugin.

But as I said. It works correctly prior to the merge in
80fe803
but after the merge it still picks up the correct mode on startup,
but it stays there until I switch the mode twice back to normal mode.
This is not the plugin that just doesn't show the mode switch,
it is the mode that is not switched.

I will keep on looking into it but I don't understand currently what has
changed here.

@a-kenji a-kenji merged commit 4c079ca into zellij-org:main May 29, 2021
@a-kenji a-kenji deleted the default-mode-368 branch May 29, 2021 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants