One approach to find any change: copy-paste the text in question into a blank text frame and export as snippet. Open the snippet in a text editor - there should be an easily recognizable break between the text style ranges - any kind of XML element representing the local formatting. The attributes there and on the preceding text style range will likely tell the difference.
It's an idea. What I've done meanwhile to keep things simple is to
duplicate() the text to a new textFrame and simply find and replace,
removing a space. That way I have a story with longer textStyleRanges
and a 1-to-1 paragraph correspondance with the original story.
I still don't understand why textStyleRange stops at a word space!
I don't see this problem at all.
I took a document with a single text frame in it, and filled it with placeholder text.
Then I run "app.activeDocument.textFrames.paragraphs.textStyleRanges.select()" and the entire 30-word paragraph is selected. So I think there is somethign else going on here.
Try exporting your paragraph to InDesign Tagged Text and see if that shows you something you did not see before.
I checked and for some reason all the spaces between words to indeed
have a "keyboard direction" override. Quite strange. I'm not sure where
that came from.
Disable keyboard overrides in your preferences!!!
That feature should be banned from InDesign forever!