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

Undo redo fixes and improvements #6950

Merged
merged 13 commits into from
Jun 12, 2023
Merged

Undo redo fixes and improvements #6950

merged 13 commits into from
Jun 12, 2023

Conversation

mwu-tow
Copy link
Contributor

@mwu-tow mwu-tow commented Jun 5, 2023

Pull Request Description

This PR adds facilities for controllers to be aware of what shortcut command is currently being processed. This allows grouping consequences of single user action into a single transaction without hard-coding it separately for all the separate paths case-by-case, which turned out to be challenging and error-prone.

Additionally, a number of minor fixes were carried over from #6877:

Important Notes

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • All code has been tested:
    • Unit tests have been written where possible.
    • If GUI codebase was changed, the GUI was tested when built using ./run ide build.

@mwu-tow mwu-tow self-assigned this Jun 5, 2023
@mwu-tow mwu-tow mentioned this pull request Jun 5, 2023
5 tasks
Comment on lines +492 to +499
from Standard.Table import all
from Standard.Database import all
from Standard.AWS import all
import Standard.Visualization

main =
operator1 = "Press TAB key to create a new node"

Copy link
Member

Choose a reason for hiding this comment

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

Can we in such cases maintain the code indentation? We can before passing this to engine just cut the left indentation to the common one, making this file looks nicer. What do you think of this idea?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are pros and cons to both approaches. Personally, I prefer to keep the indentation as-is, because it makes it easier to:

  • copy-paste code as-is to test it;
  • easily update code without reformatting.
    As this is used only in tests (which are generally not long and separated from other code), the irregular indention doesn't bother me much.

But this is not a strong opinion and generally matter of taste.

Some compromise might be to the code to separate files, and then use include to load them. This way, the code is still separated, but the indentation is regular. On the other hand, it becomes impossible to understand the code at a glance, because you have to jump between files.

At this time I'd keep it as-is, as this convention is also used in many other tests. If we decide we want to use other style, I'd rather have it a separate PR that changes all tests at once, so that we don't have a mix of styles.

Copy link
Member

Choose a reason for hiding this comment

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

I'm ok with leaving it this way! Thanks for the explanation!

debug!("Skipping this snapshot, as module's state was already saved.")
}
})
with(self.frame.borrow_mut(), |mut data| data.store_module_content(id, content))
Copy link
Member

Choose a reason for hiding this comment

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

you can use self.frame.with_borrowed_mut(|...| ...) instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@wdanilo
As far as I know, there is no such method on RefCell, it seems to be provided only for things defined with thread_local.

Copy link
Member

Choose a reason for hiding this comment

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

This method is defined in prelude!

Comment on lines 52 to 56
/// The name of the command used to undo the last action.
///
/// It is used to discern undo command in `current_shortcut` output, allowing other components to
/// handle it in a special way.
const UNDO_COMMAND_NAME: &str = "undo";
Copy link
Contributor

Choose a reason for hiding this comment

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

It is used to discern undo command in current_shortcut output,

I don't see any such usage of this constant.

mwu-tow and others added 3 commits June 7, 2023 13:58
@mwu-tow mwu-tow added the CI: No changelog needed Do not require a changelog entry for this PR. label Jun 7, 2023
@farmaazon
Copy link
Contributor

farmaazon commented Jun 7, 2023

QA Report: 🔴

  1. After moving an existing node, and then opening the Component Browser for a new node, and canceling it (escape), I need to press ctrl+z several times before movement will be undone. This is a regression.

  2. After changing something in collapsed node, when I get out and enter it again, I need to press ctrl+z several times before it will be undone. This is also on develop, so it won't block the merge.

@wdanilo
Copy link
Member

wdanilo commented Jun 9, 2023

@farmaazon really good catches!

@mwu-tow
Copy link
Contributor Author

mwu-tow commented Jun 12, 2023

QA Report: 🔴

1. After moving an existing node, and then opening the Component Browser for a new node, and canceling it (escape), I need to press ctrl+z several times before movement will be undone. This is a regression.

2. After changing something in collapsed node, when I get out and enter it again, I need to press ctrl+z several times before it will be undone. This is also on develop, so it won't block the merge.

Both are fixed.

@mwu-tow mwu-tow added the CI: Ready to merge This PR is eligible for automatic merge label Jun 12, 2023
@mwu-tow mwu-tow changed the title Undo refo fixes and improvements Undo redo fixes and improvements Jun 12, 2023
@mergify mergify bot merged commit a31c671 into develop Jun 12, 2023
@mergify mergify bot deleted the wip/mwu/undo-redo branch June 12, 2023 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: No changelog needed Do not require a changelog entry for this PR. CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants