Declarative Text Kit: Word Ranges
I figured out a way to consistently change a NSRange
, e.g. of a selection of text or the insertion point in a text view, to select surrounding words in DeclarativeTextKit
. But first off: Dear heavens! This wasn’t easy. I’m still not happy with the solution. While there are three to four hundred test cases (the vast majority is generated) that helped me narrow things down, I can tell you up front that I’m not proud of the resulting 160 lines of code.