Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 126
[feat] Introduce Move Lines Feature, Fix Selection Bug on macOS, and Update JavaDoc#964
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
[feat] Introduce Move Lines Feature, Fix Selection Bug on macOS, and Update JavaDoc #964
Conversation
yehiarasheed commented Mar 7, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
…teners - Implement handleMoveLines to manage line movement functionality - Add keystroke bindings for triggering line movements - Integrate ActionListeners for responsive UI interactions - Ensure cross-platform compatibility for macOS and Linux
Previously, moving lines down on macOS caused incorrect selection, moving the cursor to the end of the enclosing braces instead of properly selecting the moved line. This issue did not occur on Windows. The fix ensures that selection updates happen inside Swing's event dispatch thread by wrapping the selection logic in SwingUtilities.invokeLater(). This guarantees proper selection behavior across all platforms. Additionally, updated the JavaDoc for the method to reflect the fix and clarify the behavior of the selection update. Tested on Windows and macOS.
yehiarasheed commented Mar 7, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
I've been exploring the project and noticed a few areas where we might enhance user experience and functionality. I’d appreciate your thoughts on the following ideas:
ScreenshotsI’d appreciate your feedback on these points or any additional guidance regarding the project’s roadmap. |
- Updated line moving logic to select until the end of the line only, avoiding selection of the new line character. - Added functionality to move lines without selecting anything if no text is selected.
yehiarasheed commented Mar 10, 2025
I've implemented two enhancements inspired by IntelliJ IDEA for this feature:
Video DemonstrationWindows-moveLines-enhancedSelect.mp4I've tested this on Windows, macOS and Linux to ensure consistency and to avoid wrinkles.Also, just a quick heads-up: I accidentally closed this PR by mistake. Hope it didn't cause too much confusion. This feature is now finalized and ready for review. |
SableRaf commented Mar 11, 2025
Hi @yehiarasheed, thanks for your work on this! Just a quick note: As Stef mentioned here, the option shouldn’t be visible in the Edit menu. Right now, "Move Selected Lines Up" and "Move Selected Lines Down" appear there (screenshot below). I’ll let @Stefterv review the code itself. ![]() |
yehiarasheed commented Mar 11, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
SableRaf commented Mar 11, 2025
Hi @yehiarasheed, it looks like the changes in bb80a78 broke the shortcut, at least on macOS. Could you double check on other platforms and investigate the cause? Thanks!
I think the changes are good in terms of user experience. Note: We're busy right now preparing the release of Processing 4.4 but we'll review your PR as soon as we can. |
yehiarasheed commented Mar 11, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Hi @SableRaf, The shortcut broke for me too, but I’ve investigated the issue, and it seems to be related to how the shortcut was registered. It turns out that the Important I've re-implemented the shortcut registration and it's working now across all platforms. |
… shortcut registration. Added alternative shortcut handling for Move Lines functionality.
yehiarasheed commented Mar 12, 2025
Hey @SableRaf, I can create an issue for the Keyboard Shortcuts section in the |
…ary whitespace and added two blank lines between function blocks for improved readability.
…ply with style guidelines.
SableRaf commented Mar 21, 2025
@all-contributors please add @yehiarasheed for code |
I've put up a pull request to add @yehiarasheed! 🎉 |




Feature Overview
This PR closes issue #953 and introduces the Move Lines feature, allowing users to move selected lines up or down in the editor. The feature ensures:
Ctrl + Z) and redo (Ctrl + Yon Windows/Linux andShift + Cmd + Zon macOS) functionality.Fixes & Improvements
Fixed Selection Bug on macOS
SwingUtilities.invokeLater(), ensuring execution on the Swing event dispatch thread.Updated JavaDoc for Users
Shift + Cmd + Z, notCmd + Y.Testing
Media
Linux Video Demonstration:
Linux-MoveLines-Demo.mp4
macOS Video Demonstration and Screenshots:
Video Demonstration
macOS-moveLines-Demo.mp4
Screenshots
Windows Video Demonstration:
Windows.Move.Lines.Feature.mp4
JavaDoc for the
handleMoveLines(boolean moveUp)methodNext Steps
This PR introduces a new feature while ensuring cross-platform reliability. Further review and feedback are welcome.