[WASTE-list] Re: Non-continuous selection

Marco Piovanelli marco.piovanelli at pobox.com
Tue May 9 04:54:40 EDT 2006


On Mon, 8 May 2006 12:32:08 -0400,
James Lee (jim at tropic4.com) wrote:



>This note from MacIntouch today mentions use of the command key by TextEdit

>and some other applications for non-continuous selection:

>http://www.macintouch.com/readerreports/macosx10_4_6/index.html#may08


This is not specific to Mac OS X 10.4.6 -- it's one of several new NSTextView
features introduced with Tiger. See the AppKit release notes, particularly
the section titled "NSTextView Multiple Selection":

<http://developer.apple.com/releasenotes/Cocoa/AppKit.html>


>Are you aware of any WASTE based application doing this


No, I'm not.


>and if so is there any recommendation on how to approach it?


Off the top of my head:

In WASTE 3.0, you would first have to modify the WE3_TextController
class so that its selection member is a list of WE3_TextRange objects,
rather than a single range. When applying or inspecting attributes
over a discontiguous selection, you would have to walk the list,
processing each contiguous subrange separately. On the other hand,
when replacing a discontiguous selection with new text, if you want
to mimic what TextEdit does, you would have to replace the "primary"
subrange only, and just deselect the "secondary" subranges.
You would also need to decide what to do about existing public APIs
that assume contiguous selections -- they would probably act on the
primary subrange, too.

I'm sure there would be several gotchas to watch out for, but I think
discontiguous selection is feasible in WASTE 3.0. I'm not sure about
its actual usefulness. Support for multiple discontiguous ranges is
probably less useful per se than as a basis for implementing *rectangular*
selections (that's option+click in TextEdit, in case you wonder).


-- marco

--
It's not the data universe only, it's human conversation.
They want to turn it into a one-way flow that they have entirely
monetized. I look at the collective human mind as a kind of
ecosystem. They want to clear cut it. They want to go into the
rainforest of human thought and mow the thing down.



More information about the WASTE-list mailing list