8000 Add: undoredo support by coder1152 · Pull Request #7447 · Mudlet/Mudlet · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add: undoredo support #7447

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

Open
wants to merge 152 commits into
base: development
Choose a base branch
from

Conversation

coder1152
Copy link
Contributor

Brief overview of PR changes/additions

/claim #707
Resolves issue #707

Motivation for adding to Mudlet

The PR adds support for undoredo in the editor using qt undo redo framework.

Other info (issues closed, discussion etc)

@coder1152 coder1152 requested a review from a team as a code owner September 26, 2024 10:51
Copy link
algora-pbc bot commented Sep 26, 2024

💵 To receive payouts, sign up on Algora, link your Github account and connect with Stripe.

Copy link
Contributor
github-actions bot commented Sep 26, 2024
Warnings
⚠️ PR makes changes to 16 source files. Double check the scope hasn't gotten out of hand

Generated by 🚫 dangerJS against c73bbe3

@coder1152
Copy link
Contributor Author

@vadi2 I have PR implementing undoredo support in editor. The pr implements qt undo framework which uses the command pattern.

@vadi2
Copy link
Member
vadi2 commented Sep 26, 2024

Awesome!

@vadi2
Copy link
Member
vadi2 commented Sep 26, 2024

/create links

Copy link
Member
@SlySven SlySven left a comment

Choose a reason for hiding this comment

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

There are too many unrelated whitespace / code layout changes in this PR for me to review it. (The signal-to-noise ratio is too low!) 😀

Also, the custom editor widget (edbee-lib) that we are using for the Lua-script also has undo/redo support as I understand it (but each separate Mudlet item - trigger, timer. key-binding, etc. has to be treated as a separate "document" as it calls them) - so I am not sure how that meshes with this PR.

@@ -6221,7 +6412,7 @@ void dlgTriggerEditor::slot_variableSelected(QTreeWidgetItem* pItem)
} else if (vu->isSaved(var)) {
pItem->setCheckState(0, Qt::Checked);
}
pItem->setData(0, Qt::UserRole, var->getValueType());
pItem->setData(0, Qt::UserRole, var->getId());
Copy link
Member

Choose a reason for hiding this comment

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

Are you replacing this use of the Qt::UserRole for your own, new purposes? If so have you checked that everywhere the original usage is not needed and can be removed? If not you may have to use a different "key" to store this ID number (e.g. at Qt::UserRole + 1). Of course it could be that the original use of var->getValueType() as the original source of a value to store here was bogus and wrong - I didn't have a hand in this bit of the code-base (variables part of the editor) so I am not sure of the significance of it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@SlySven I checked and the getValueType() is only retrieved from TVar type not the actual pItem, the Id is used so when the item is moved from one parent to another, the id is used to determine if the item was move to another parent. Also I checked the other items types i.e triggers, scripts, keys, actions store Id in the UserRole, so the original source of storing valueType in userRole was bogus.

Copy link
Member
@vadi2 vadi2 left a comment

Choose a reason for hiding this comment

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

Thanks for adding this, it's great to have a start on the undo/redo.

At a higher level, it seems that not all actions are added to the queue - for example, adding new named event handlers in a script is not a queue action. In a trigger, editing the trigger (adding new patterns or changing options) does not add anything either.

Could you cover all actions for triggers, aliases, scripts, timers, keys, and buttons like this? Variables can be left out I reckon in the initial implementation, those are too tricky to deal with.

@coder1152
Copy link
Contributor Author

@vadi2 For undo functionality, initially I have covered undo support for add, delete and moving items. Each item i.e trigger, key, script has various options i.e editing trigger name, command or pattern. I am in the process of adding the remaining actions for triggers, aliases, scripts, timers, keys, and buttons. I have broken down the todo remaining items,

Trigger

  • Edit trigger name
  • Edit trigger command
  • Edit trigger pattern and pattern dropdown list
  • Checkboxes (play sound, matches, and/or Multi-line delta

Alias

  • Edit alias Name
  • Edit alias Pattern
  • Edit alias Command

Scripts

  • Edit script Name
  • Add/Remove User Event Handler

Timers

  • Edit timer name
  • Edit timer command
  • Edit timer time

Keys

  • Edit key name
  • Edit key command
  • Edit key binding

Buttons

  • Edit button name
  • Edit button properties
  • Edit button stylesheet

Also would be helpful if the bounty amount is reviewed and slightly increased, given the undo support has turned out to be rather large PR and the remaining todo items also add considerable effort.

Also @SlySven I tested the undo/redo functionality for custom editor widget and the Lua-Script is setup to undo using shortcuts ctrl+z, ctrl+shift+z which has no impact on the undo functionality of items.

@vadi2
Copy link
Member
vadi2 commented Oct 21, 2024

I agree. Bounty raised to $300. Looking forward to seeing this wrapped up!

@coder1152
Copy link
Contributor Author

@vadi2 I have added the remaining actions for triggers, aliases, scripts, timers, keys, and buttons. Please test the PR. Thanks.

@vadi2
Copy link
Member
vadi2 commented Nov 1, 2024

@coder1152 the PR does not seem to build, please check.

@coder1152
Copy link
Contributor Author

@vadi2 I have resolved the build issue. PR is ready.

@vadi2
Copy link
Member
vadi2 commented Nov 1, 2024

Looks like Windows builds don't work yet.

@coder1152
Copy link
Contributor Author

@vadi2 Following up on qa feedback, I have resolved the part when the name of group ends up in place of alias name. Also, the paste regression issue is resolved. For the remaining part of the feedback, I need video of the issue.

@atari2600tim
Copy link
Contributor

46d12a5 seems like progress is being made.

does not explain which five things are referred to trigger, alias etc,

Sorry about that. I'm trying different things each run through and didn't make note of whatever item type I clicked on Saturday, but it was the first item type that I clicked. Just figured they all would have similar logic so probably not specific to the one I happened to try. I think it was timers since I have some stray timers in that profile now. I'll specifically mess with timers in a moment. Verify all of the things with each of the types though.

due to the issue having paid bounty

That indicates interest in getting the feature but should not be taken as like desperation to hit a release date with lower standards. Go by what Vadi wrote here and the expectation is to have it good before being presented as ready to merge. Vadi hasn't offered to pay me a bonus on top of my normal tester salary for prioritizing bounty items instead of more interesting items. In fact I'm weirdly helping you race me.

Anyway, now for the trying of things...

With the 46d12a5 build,

  1. I went to timers list and had a folder for some timers, I added "one" through "five", renamed each of them like "one1111" and then "one1111!!!!", meaning at the end I had 5 item creations and 10 renames. Then undoing had some clear problems there with things being mixed around coming from wrong items.
  2. Then I tried out scripts and they are running excessively when switching between items.
  3. Then I tried creating triggers, and it is doing things way too early like showing errors in pattern when I've just typed the name and clicked into the pattern box about to give it one.
  4. And then clicking between items, it expands other folder I wasn't even looking at.
  5. In aliases, I created a new one, messed with others, renamed that new one, messed with others, renamed that one again, and it mixed around what it should restore to.

@coder1152
Copy link
Contributor Author

@vadi2 I have resolved the following points from qa feedback.

  1. I went to timers list and had a folder for some timers, I added "one" through "five", renamed each of them like "one1111" and then "one1111!!!!", meaning at the end I had 5 item creations and 10 renames. Then undoing had some clear problems there with things being mixed around coming from wrong items.
  2. Then I tried creating triggers, and it is doing things way too early like showing errors in pattern when I've just typed the name and clicked into the pattern box about to give it one.
  3. In aliases, I created a new one, messed with others, renamed that new one, messed with others, renamed that one again, and it mixed around what it should restore to.

The following points I was not able to replicate and need more details or video of the issue.

  1. Then I tried out scripts and they are running excessively when switching between items.
  2. And then clicking between items, it expands other folder I wasn't even looking at.

@coder1152
Copy link
Contributor Author

@vadi2 Please reach out to tester regarding qa feedback.

@atari2600tim
Copy link
Contributor
atari2600tim commented Jun 6, 2025

Changing trigger types is causing some problems, it switches focus to wrong trigger item and also draws the colors wrong for rest of session

@ZookaOnGit
10000 Copy link
Collaborator
ZookaOnGit commented Jun 8, 2025

as per Tim's comment above the focus is lost after changing trigger types

Peek.2025-06-08.09-25.mp4

also noticed that using a prompt type, then switching back to a different type looses the trigger entry and undo doesn't restore it
(this doesn't happen in a dev build)

Peek.2025-06-08.09-29.mp4

@ZookaOnGit
Copy link
Collaborator

need to remove debug messages sent to command line to tidy up

@coder1152
Copy link
Contributor Author

@vadi2 The focus issue from switching trigger types is resolved along with some other issues. Thanks for testing ZookaOnGit and atari2600tim.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0