discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Word selection and cursor placement


From: Andreas Höschler
Subject: Re: Word selection and cursor placement
Date: Sat, 18 Nov 2006 00:05:02 +0100

Dear Matt,

thanks for your hints.

while trying to use GNUstep (NSTextView) for real
coding - we are
migrating from Macs to Solaris/GNUstep machines - I
encountered the
following problems:

• Double clicking on a word line _Timber_Stock
should select the whole
word not only Timber or Stock. At least that's how
it's done on the Mac
and how it makes sense IMHO. On the other hand
doubleclicking on
<mytag> should only select mytag and not <mytag>.
Any idea where this
can be corrected?

i believe -selectionRangeForProposedRange:granularity:

Here is my fix for this problem:

NSAttributedString
We fix selecting words by doubleclicking with teh mouse as follows:

static void cache_init_real(void)
{
...
/* Initializes wordBreakCSet */
m = [NSMutableCharacterSet new];
cset = [NSCharacterSet whitespaceAndNewlineCharacterSet];
[m formUnionWithCharacterSet: cset];
cset = [NSCharacterSet punctuationCharacterSet];
[m formUnionWithCharacterSet: cset];
cset = [NSCharacterSet controlCharacterSet];
[m formUnionWithCharacterSet: cset];
cset = [NSCharacterSet illegalCharacterSet];
[m formUnionWithCharacterSet: cset];
// [m removeCharactersInString: @"-"]; // <---
[m addCharactersInString: @"<>"]; // <---
[m removeCharactersInString: @"_"]; // <---
wordBreakCSet = [m copy];
RELEASE (m);
...
}

• Selecting 'valueForKey' in

[self valueForKey:@"hostname"];

and the pressing cursor left puts the cursor
directly to the right of
self which is wrong. The cursor should be placed
between the space and
valueForKey. The behaviour is even worse when
leaving a selction to the
right side. When self was selected this places the
cursor between 's'
and 'elf' which is totally wrong.

NSTextView_actions.m: -moveLeft:

Hints where in the GNustep tree this can be
corrected are greatly
appreciated! Thanks!

I belive the malfuntion actually is in NSLayoutManager

-(unsigned int) characterIndexMoving: (GSInsertionPointMovementDirection)direction
fromCharacterIndex: (unsigned int)from
originalCharacterIndex: (unsigned int)original
distance: (float)distance

but I unfortunately don't understand this method. Anybody worked on thi sand has a clue?

Regards,

Andreas

reply via email to

[Prev in Thread] Current Thread [Next in Thread]