Skip to content

add: multi-select functionality in script editor#8056

Merged
vadi2 merged 7 commits intoMudlet:developmentfrom
MAVRICK-1:feature/multi-selection-issue-655
Aug 24, 2025
Merged

add: multi-select functionality in script editor#8056
vadi2 merged 7 commits intoMudlet:developmentfrom
MAVRICK-1:feature/multi-selection-issue-655

Conversation

@MAVRICK-1
Copy link
Copy Markdown
Contributor

Multi-Selection Functionality for Script Editor

Summary

Implements comprehensive multi-selection functionality in Mudlet's script editor, addressing GitHub issue #655. This enhancement brings modern file manager-style selection and operations to all script editor tree widgets (triggers, aliases, timers, scripts, actions, keys, and variables).

Edge Cases Handled

  • Empty clipboard content
  • Invalid XML in clipboard
  • Mixed item types in selection
  • Pasting with no target selected
  • Variable tree consistency with other components

Before/After Comparison

Before

  • ❌ Single selection only
  • ❌ One-by-one copy/paste operations
  • ❌ Individual delete operations
  • ❌ Inconsistent variable tree behavior
  • ❌ Blank trigger creation during paste

After

  • ✅ Multi-selection with Ctrl+Click and Shift+Click
  • ✅ Bulk copy/paste operations
  • ✅ Bulk delete with confirmation
  • ✅ Consistent behavior across all tree types
  • ✅ Clean paste without blank entries
  • ✅ Folder-aware paste functionality

Performance Impact

  • Minimal overhead: Uses Qt's built-in ExtendedSelection mode
  • Efficient operations: Processes multiple items in single transactions
  • Memory friendly: Proper cleanup of temporary clipboard states

Compatibility

  • Backwards compatible: Existing single-selection workflows unchanged
  • Cross-platform: Uses standard Qt selection mechanisms
  • No breaking changes: All existing functionality preserved

Related Issues

Closes #655 - Multi-selection in script editor

Screenshots/Demo

Screencast.from.2025-08-18.09-59-00.mp4
Screencast.from.2025-08-18.09-59-34.mp4

The multi-selection functionality works exactly like modern file managers:

  • Hold Ctrl and click to select multiple individual items
  • Hold Shift and click to select ranges
  • Right-click or use keyboard shortcuts for bulk operations
  • Paste behavior mimics VS Code where each item is pasted separately

/claim #655

- Add ExtendedSelection mode to TTreeWidget for Ctrl+Click and Shift+Click support
- Implement bulk delete operations with confirmation dialogs for multiple selected items
- Add multi-item export functions for triggers, aliases, timers, scripts, actions, and keys
- Implement VS Code-style paste where each selected item is pasted individually
- Add folder-aware paste functionality to place items inside selected groups
- Fix variable tree drag-drop to be consistent with other tree components
- Resolve blank trigger creation issue during multi-item paste operations

Closes Mudlet#655
@MAVRICK-1 MAVRICK-1 requested a review from a team as a code owner August 18, 2025 04:48
@Kebap Kebap self-assigned this Aug 18, 2025
@ZookaOnGit
Copy link
Copy Markdown
Contributor

This tests good.

My concern is hitting the confirmation dialog for deletion every time. I am a power-user, I know I want to delete it. Can we make a "don't ask me again" box, or at the very least not ask on single item deletions (previously how it worked).

Good work, let's see what the other reviewers say.

@MAVRICK-1
Copy link
Copy Markdown
Contributor Author

@ZookaOnGit There could be a lot of issues if we implement that, unless a redo/undo option is available. Mistakes can happen .

@ZookaOnGit
Copy link
Copy Markdown
Contributor

While I understand your point this is how the existing functionality works. A don't ask me again box would resolve both our concerns.

undo/redo is a separate issue #707

Let's see what other reviewers thoughts are before changing anything though.

@vadi2
Copy link
Copy Markdown
Member

vadi2 commented Aug 21, 2025

I agree that we shouldn't get into the power users way, a checkbox not to ask again would be welcome - and this should be remembered globally in all profiles, since most likely it's the same person playing on all of the profiles, and we shouldn't make them tick it in every profile.

@MAVRICK-1 you can store this preferences in QSettings provided by mudlet::getQSettings(), there's a few examples of how we use this :)

@MAVRICK-1
Copy link
Copy Markdown
Contributor Author

I agree that we shouldn't get into the power users way, a checkbox not to ask again would be welcome - and this should be remembered globally in all profiles, since most likely it's the same person playing on all of the profiles, and we shouldn't make them tick it in every profile.

@MAVRICK-1 you can store this preferences in QSettings provided by mudlet::getQSettings(), there's a few examples of how we use this :)

on it

@MAVRICK-1
Copy link
Copy Markdown
Contributor Author

MAVRICK-1 commented Aug 21, 2025

Screencast.from.2025-08-21.14-14-06.mp4

@vadi2 @ZookaOnGit is it okay now ?

- Add showDeleteConfirmation() helper function with QCheckBox support
- Store preference globally in QSettings (works across all profiles)
- Replace all 6 delete confirmation dialogs to use new helper
- Addresses reviewer feedback about power users hitting confirmation dialogs
- Default behavior unchanged - confirmations still shown by default
- Once enabled, deletions proceed without interruption

Fixes feedback on Mudlet#655
@MAVRICK-1
Copy link
Copy Markdown
Contributor Author

@ZookaOnGit @vadi2 friendly ping

@ZookaOnGit
Copy link
Copy Markdown
Contributor

Tests good and fixes my concerns. Thank you.

@vadi2 vadi2 changed the title add: Implement multi-selection functionality for script editor add: multi-select functionality in script editor Aug 24, 2025
Copy link
Copy Markdown
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.

Works great, thanks!

@vadi2 vadi2 merged commit 2edce32 into Mudlet:development Aug 24, 2025
13 checks passed
mpconley pushed a commit to mpconley/Mudlet that referenced this pull request Sep 20, 2025
# Multi-Selection Functionality for Script Editor

## Summary

Implements comprehensive multi-selection functionality in Mudlet's
script editor, addressing GitHub issue Mudlet#655. This enhancement brings
modern file manager-style selection and operations to all script editor
tree widgets (triggers, aliases, timers, scripts, actions, keys, and
variables).

### Edge Cases Handled
- Empty clipboard content
- Invalid XML in clipboard
- Mixed item types in selection
- Pasting with no target selected
- Variable tree consistency with other components

## Before/After Comparison

### Before
- ❌ Single selection only
- ❌ One-by-one copy/paste operations
- ❌ Individual delete operations
- ❌ Inconsistent variable tree behavior
- ❌ Blank trigger creation during paste

### After
- ✅ Multi-selection with Ctrl+Click and Shift+Click
- ✅ Bulk copy/paste operations
- ✅ Bulk delete with confirmation
- ✅ Consistent behavior across all tree types
- ✅ Clean paste without blank entries
- ✅ Folder-aware paste functionality

## Performance Impact

- **Minimal overhead**: Uses Qt's built-in ExtendedSelection mode
- **Efficient operations**: Processes multiple items in single
transactions
- **Memory friendly**: Proper cleanup of temporary clipboard states

## Compatibility

- **Backwards compatible**: Existing single-selection workflows
unchanged
- **Cross-platform**: Uses standard Qt selection mechanisms
- **No breaking changes**: All existing functionality preserved

## Related Issues

Closes Mudlet#655 - Multi-selection in script editor

## Screenshots/Demo


https://github.com/user-attachments/assets/2f626ef4-6d77-491a-9fb5-22b8f24f84bc



https://github.com/user-attachments/assets/d7becefe-2670-4ec0-9d2c-53715f9ac6aa



The multi-selection functionality works exactly like modern file
managers:
- Hold Ctrl and click to select multiple individual items
- Hold Shift and click to select ranges
- Right-click or use keyboard shortcuts for bulk operations
- Paste behavior mimics VS Code where each item is pasted separately

/claim Mudlet#655

---------

Co-authored-by: Vadim Peretokin <vperetokin@hey.com>
Co-authored-by: Zooka <136661366+ZookaOnGit@users.noreply.github.com>
vadi2 pushed a commit that referenced this pull request Oct 12, 2025
<!-- Keep the title short & concise so anyone non-technical can
understand it,
     the title appears in PTB changelogs -->
#### Brief overview of PR changes/additions
Adjusted trigger editor selection handler to prevent clearing the newly
pasted trigger before it gets saved
Fix: #8249 pasted trigger via loose content
this was originated after a litle collateral after #8056 


#### Motivation for adding to Mudlet
Fix 8249
#### Other info (issues closed, discussion etc)
this could be related to issues 8259 and 8293. as first step to solve
(but this PR dont solve thoise)

Signed-off-by: SammerPetria <sammerpetria@gmail.com>
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.

Enable multi-selection in Mudlet editor

4 participants