Yes I did. You can actually set newRange to the selected word with the following code:
set wrValue to current application's NSValue's valueWithRange_(wordRange)
set newRange to current application's NSArray's arrayWithObject_(wrValue)
Then it will actually select the word, but if you try to type while the word is selected you get crazy results which eventually cause the app to crash (I don’t know if you would ever try to type while the word was selected, but a user might try that and get into trouble). So, I think it’s best to return newRange unaltered.
The reason you have to use valueWithRange, is that despite what the docs say, the return value of textView_willChangeSelectionFromCharacterRanges_toCharacterRanges_ is actually an array of NSConcreteValues not NSRanges – I’m not sure why that is, but if you log newRange’s objectAtIndex_(0)'s |class|() you get NSConcreteValue. That’s why if you try to use “newRange’s |location|” you get an error. By using rangeValue(), it turns the NSConcreteValue into a range (which is a C-struct).
Ric