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

Implement dot operator #55

Merged
merged 5 commits into from
May 17, 2019
Merged

Implement dot operator #55

merged 5 commits into from
May 17, 2019

Conversation

Davejkane
Copy link
Owner

This closes #52.

  • Add the last action to ui state
  • Processes the period key
  • process all actions returned from keyhandling and clone into last_action and return the action.

Copy link
Collaborator

@gurgalex gurgalex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine

src/ui.rs Outdated
/// update_last_action takes an action, sets the last_action to said action, and returns the Action
fn process_action(&mut self, a: Action) -> Action {
match a {
Action::Quit | Action::ToggleFullscreen | Action::ReRender => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume ToggleFullscreen is here because it needs to rerender the screen?

@gurgalex
Copy link
Collaborator

Sorry about the merge conflict from #54

Copy link
Collaborator

@gurgalex gurgalex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

Could you exempt reRendering from being or resetting last_state?

That way ToggleFullscreen can be switched between with . as well.

@gurgalex
Copy link
Collaborator

gurgalex commented May 16, 2019

My solution may have been hacky. ReRender is never set as last_action.

        match a {
            Action::Quit => {
                self.last_action = Action::Noop;
                a
            }
            Action::ReRender => a,
            _ => {
                self.last_action = a.clone();
                a
            }
        }

@Davejkane
Copy link
Owner Author

I'm not sure I understand. Are you suggesting that I do what you posted in that last code sample? What does that change?

@gurgalex
Copy link
Collaborator

gurgalex commented May 16, 2019

On fullscreen switch multiple events which emit ReRender can be fired as well.
Resized, SizeChanged, Moved, exposed

So, the last action is set to

ToggleFullscreen and then Noop immediately after.

Special casing Rerender to not touch last_action preserves any action prior to the action ReRender.

@gurgalex
Copy link
Collaborator

gurgalex commented May 17, 2019 via email

@Davejkane Davejkane merged commit 558d9a3 into development May 17, 2019
@Davejkane Davejkane deleted the dot_operator_repeat_action branch May 17, 2019 12:38
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.

Dot operator to repeat last action
2 participants