“Block Selection” branch added to RSyntaxTextArea SVN

An oft-requested feature is block selection.  Unfortunately, this is pretty difficult to implement in Swing, for a couple of reasons.

  1. Swing’s text package keeps a lot of handy implementation hooks private and package-private.
  2. Swing’s text package’s idea of “selection” is pretty much hard-coded to mean “a contiguous range of text.”

In Java 6, #1 above has been (mostly) remedied, making it a good deal easier to implement this feature completely if your text component only supports Java 6+.  Unfortunately for us, RSyntaxTextArea supports from 1.4 up!

Because of this, adding block selection to RSTA will be tricky.  Fortunately, I’ve been motivated to finally put forth some effort to make this a reality.  I’ve added a branch in SVN specifically for exploring block selection, and already, a little progress has been made:

Block Selection

Block Selection

Obvious issues include:

  • Cut doesn’t work properly (though Copy does)
  • Drag-and-drop of a block selection doesn’t work (not sure this is possible, at least with pre-1.6)
  • Typing over a block selection doesn’t have the “expected” behavior of typing on all block-selected lines

Hopefully more progress will be made soon!

Comments are closed.