robert-strandh / Second-Climacs

Version 2 of the Climacs text editor.
BSD 2-Clause "Simplified" License
275 stars 19 forks source link

Support multiple cursors properly #1

Closed mathrick closed 7 months ago

mathrick commented 10 years ago

There should be solid support for multi-cursor operation, both at the algorithm level and the UI level.

For the Emacs UI substrate, this includes at least the following:

Run for all and run once commands could presumably be handled largely transparently by having appropriate mix-ins in the class hierarchy.

mathrick commented 10 years ago

Multiple cursors introduce certain complications for efficient editing. Splay trees are a good self-adjusting data structure where the current locus naturally becomes fast, but it requires there to be a locus. Whereas with multiple cursors, there are many, and it's not unreasonable to want thousands of cursors at once (many log file-like editing tasks are trivially expressed in terms of UI-level editing operation, but very cumbersome to program as regex replacements or even more complex manipulation tasks).

It might well be fast enough on a modern machine, especially as it's a splay tree of lines, not characters, but it needs keeping in mind. I feel that it's sensible to expect it to support up to 10k cursors without undue slowdown (multiple-cursor.el currently breaks down at 500-700, depending on the length of the lines being edited).

scymtym commented 7 months ago

Much of the proposed functionality is available as of 55b41331f82ad963c0916dbce0dc3ac6e7321c8e. Suggestions for additional functionality or algorithmic improvements can be discussed in separate issues.