[Biococoa-dev] strider and gck format

Alexander Griekspoor mek at mekentosj.com
Sat Mar 25 06:22:06 EST 2006

I don't think that is a bug. I guess that is a personal taste. I see  
the columns purely as a visual aid, but think a sequence is a  
continues stretch of characters, hence not separated by spaces. I  
think the whitespace approach is a hack, and this is more elegant but  
that's a personal opinion. It would definitely complicates working  
with the sequence a lot if you continuously have to take the spaces  
into account.
The "1st 10 char selection" bug must be one that is to fix, and if we  
indeed want the word selection that is something that should be able  
to be relatively easily implemented using: - (NSRange) 
selectionRangeForProposedRange:(NSRange)proposedCharRange granularity: 
(which we override anyway already). The granularity normal returns  
one (selectByCharacter), but two upon doubleclick (selectByWord) or  
three upon tripple click (by paragraph).

..and then I decided to just do it ;-)

Here's the specific method, and now it selects the 10 nucleotides on  
which you doubleclick ;-)

- (NSRange)selectionRangeForProposedRange:(NSRange)proposedCharRange  
	NSRange newCharRange;
	if(granularity == NSSelectByWord){
		newCharRange.location = (proposedCharRange.location / 10) * 10;
		newCharRange.length = ((proposedCharRange.location +  
proposedCharRange.length) / 10 + 1) * 10 - newCharRange.location;
		// sanity checks
		if(newCharRange.location < 0){
			newCharRange.length -= -newCharRange.location;
			newCharRange.location = 0;
		if(newCharRange.location + newCharRange.length > [[self textStorage] 
			newCharRange.length -= (newCharRange.location +  
newCharRange.length)  - [[self textStorage]length];
	else {
		newCharRange = [super  
	//NSLog(@"%d -> old: %@ new: %@", granularity, NSStringFromRange 
(proposedCharRange), NSStringFromRange(newCharRange));

	id <KDTextViewDelegate> delegate = [self delegate];
     if ([delegate respondsToSelector:@selector 
		[delegate didDragSelectionInTextView: self range: newCharRange];

	[self setNeedsDisplay: YES];
	return newCharRange;

Now please please let's stay away from the whitespace hack, at least  
I will ;-)
Only this one stupid bug to fix... I'll post that one on cocoa-dev.

On 25-mrt-2006, at 11:48, Koen van der Drift wrote:

> On Mar 19, 2006, at 11:08 AM, Alexander Griekspoor wrote:
>> One other thing, there seems to be a bug in the textview that if  
>> you have less than one row of text, you can't select any of the  
>> first 10 characters
> There is another bug probably related to this. If I doubleclick in  
> a column, I expect only those 10 symbols to be selected (just as if  
> it is a word in a sentence). However, the whole sequence gets  
> selected. I am wondering if we should go back to inserting the  
> whitespace approach.
> cheers,
> - Koen.

                     ** Alexander Griekspoor **
               The Netherlands Cancer Institute
               Department of Tumorbiology (H4)
          Plesmanlaan 121, 1066 CX, Amsterdam
                    Tel:  + 31 20 - 512 2023
                   Fax:  + 31 20 - 512 2029
                   AIM: mekentosj at mac.com
                  E-mail: a.griekspoor at nki.nl
               Web: http://www.mekentosj.com

               4Peaks - For Peaks, Four Peaks.
        2004 Winner of the Apple Design Awards
                Best Mac OS X Student Product


More information about the Biococoa-dev mailing list