Skip to content

Add Shortcut for Moving Selected Lines Up and Down (Line Swapping) #953

Closed
@yehiarasheed

Description

@yehiarasheed

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:

On August 9th 2021, we celebrated the twentieth anniversary of the first Processing software release. Through this time, we’ve promoted software literacy, particularly within the visual arts, and visual literacy within technology. Initially created to serve as a software sketchbook and to teach programming fundamentals within a visual context, Processing has also evolved into a development tool for professionals.

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:

  • Align Processing 4 with industry-standard IDE behavior.
  • Improve user workflow by allowing faster navigation and editing of code.
  • Increase overall usability for those used to working with shortcuts as well as people who are still learning shortcuts.

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.


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions