Skip to content
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

[Feature Request] Multi-Cursor Support #17788

Open
Gabriel-Darbord opened this issue Feb 6, 2025 · 2 comments
Open

[Feature Request] Multi-Cursor Support #17788

Gabriel-Darbord opened this issue Feb 6, 2025 · 2 comments

Comments

@Gabriel-Darbord
Copy link
Contributor

Currently, the Pharo code editor lacks multi-cursor support, a feature available in most modern editors such as VSCode. This limitation makes it cumbersome to perform bulk edits, such as renaming multiple occurrences of a variable, inserting text at multiple locations, or modifying code structure across lines.

The goal is to implement multi-cursor editing in the Pharo code editor, allowing users to edit multiple locations simultaneously. Ideally, the implementation should match the functionality of VSCode, with the following features:

  1. Adding and Managing Cursors
  • Manually place multiple cursors (e.g., Cmd+Click to insert additional cursors).
  • Select next occurrence of a word (Cmd+D) to quickly add a cursor at the next instance of the selected text.
  • Select all occurrences (Cmd+Shift+L) to apply changes to every instance in the current scope.
  • Remove the last added cursor (Cmd+U) to revert accidental selections.
  1. Editing with Multiple Cursors
  • Type, delete, copy, and paste at all cursors simultaneously.
  • Navigate and move all cursors together.
  • Undo/redo all actions as a group while preserving multi-cursor state.
  • Multi-line insertion (e.g., Cmd+Alt+Arrow Up/Down to insert a new cursor on the next line).
  1. [Optional] Column Selection Mode (Block Selection)
  • Create a vertical selection of text (e.g., Alt+Drag or Cmd+Shift+Alt+Arrow).

Expected development cost

Implementing multi-cursor editing will require:

  • Enhancements to the text editor's input handling.
  • UI feedback for multiple cursors (e.g., blinking cursors, selection highlighting).
  • Adjustments to the editing model to support simultaneous changes.
  • Handling of undo/redo operations in multi-cursor mode.

Additional context

Here are references to how other editors handle multi-cursor support:

@Rinzwind
Copy link
Contributor

Brick has some multi-cursor support. Using Command-click to add cursors would conflict with existing functionality. See: GToolkit issue #3937.

@Gabriel-Darbord
Copy link
Contributor Author

Note: this issue is linked to a GSoC 2025 proposal, so let's try to keep it active for now (i.e., do not close it).

I didn't know about Brick, it would be interesting to see how it's done as a reference for Rubric (the current editor for Pharo).

The shortcuts from the OP are directly from VSCode to let readers try them out easily, they are not indicative of the shortcuts that would be used in Pharo.

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

No branches or pull requests

2 participants