-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
Add Shortcut for Moving Selected Lines Up and Down (Line Swapping) #953
Comments
Hi @yehiarasheed and thanks for investigating this! It could be useful to locate the commit(s) that removed this feature to understand why it was commented out. By the way, you should know that we want to move away from the current implementation of the code editor since it relies on the legacy dependency JEdit Syntax. Our long-term goal is to transition parts of the UI to Jetpack Compose Multiplatform, with the editor likely being the last component to be replaced, as it’s such a critical part of the PDE. In the meantime, making small quality-of-life improvements like this could be worthwhile, as long as they don’t introduce unwanted side effects and don't require significant work on legacy code that will eventually be removed. cc @Stefterv, who may have additional insights. |
Hi @SableRaf, I actually took a look at the commits but didn't dig deep enough since the
I think that settles that the code implementation wasn't causing any unexpected behavior or bugs and it was just too advanced for its time. That being said, this shortcut is pretty standard now, so I think it’s a solid quality-of-life improvement. As for implementation, I totally get that the long-term plan is to move to Jetpack Compose Multiplatform. If that’s happening soon, it probably makes more sense to just add this feature there. But if that’s still a while away, I can go ahead and implement it in the current editor and refactor it later when the transition happens. Let me know what you think! |
Hi @yehiarasheed feel free to open a pull request to add this functionality. I agree that it could be there but should not visible in the edit menu. |
Hello, I’m interested in working on this issue. Is there any specific reason why the previous implementation was commented out? Looking forward to your response |
Relevant sub-area for this feature?
PDE
Feature description
While investigating the codebase to fix issue #950, I stumbled upon some commented implementations of Keyboard Shortcuts in the old repository. This feature specifically involves allowing the user to move selected lines up and down the editor (essentially swapping lines) using the
Alt + ↑ / ↓
shortcut for Windows/Linux Systems or⌥ + ↑ / ↓
for macOS Systems. Currently, Processing 4 does not include a keyboard shortcut for moving selected lines up or down. This feature is available in older versions but has been omitted in the newer repo. Implementing this functionality can improve user productivity and align Processing 4 with commonly used IDE features.Benefits
According to the Processing.org website:
In my opinion, if we are promoting software and visual literacy within technology and targeting professionals alike, it makes perfect sense to add Keyboard Shortcuts and be more inclusive of all groups. Whether it's a student in school still learning programming or someone working in a professional environment.
This helps us:
Possible challenges
I am to investigate this issue further, but leaving the code in the legacy version commented gives me the hint that the previous implementation caused some errors (and I hope to be wrong), although I didn't find anything about it in previous issues or discussions. In all cases, I suggest rewriting the implementation to match the currently implemented Keyboard Shortcuts in the new Processing release to keep everything consistent.
Note
As of Now, I haven't seen any issues with my Draft Implementation of the feature. I will be testing it more intensively.
Additional context
Here is the current IntelliJ Implementation of this Keyboard Shortcut
20250305-1938-45.2301527.mp4
Here is a Draft of how the feature is supposed to look like in Processing
Processing.4.Move.Lines.Demo.mp4
References
Legacy implementation in the old processing repository here.
More specifically, the
handleMoveLines(boolean moveUp)
method as well as the method calls in the ActionListener.Note
This feature may introduce additional Multi-Line features, the implementation of a Line Duplicate Keyboard Shortcut and so on..
Would you like to work on the issue?
Yes, I would like to work on this issue.
The text was updated successfully, but these errors were encountered: