This might be in the running for Most Obscure Problem ever reported. I have a JTextPane;
Java inserts line breaks in ALMOST all of the right places. It correctly does NOT insert a line break on a flat apostrophe (the character ') but it DOES insert a line break after a curly apostrophe, which I cannot insert with this editor. Thus, the
word we'll with a flat apostrophe is not broken, but the version with the curly apostrophe is broken so that it looks like this: we'
ll
Obviously, this is unacceptable. I have searched the web and been hobbled by a huge number of hits on discussions of how to turn word breaking on and off. There's a topic here
https://coderanch.com/t/380931/java/java/Parse-Smart-Quotes-regular-quotes from seven years ago about using smart quotes (curly double quotes), but it wasn't about line breaks.
There is something called DefaultEditorKit.insertBreakAction, but that does not seem to address this problem.
Here are the possibilities I am considering:
1. Hope, hope, hope, that there's a method along the lines of JTextPane.setWordBreakOnCurlyApostrophe(boolean). (Yeah, right.)
2. Replace all curly apostrophes with flat apostrophes (ugly!)
3. Accept the rare case of the improperly broken word (it's rather jarring).
4. Write special code that fakes Java into doing the right thing (probably a lot of work).
5. Find another Swing object that can do this correctly. So far, no luck.
Does anybody have any better ideas?