This patch implements more soft wraps not only at
whitespaces (as it is now), but also at breaks
determined by java.text.BreakIterator as suggested in
bug #574189.
https://sourceforge.net/support/tracker.php?aid=574189
Without some change like this patch, the soft wrap
feature is not so useful for languages which don't use
spaces as word breaks (ex. Chinese, Japanese, ...).
By using BreakIterator, some basic rules of line
wrapping are applied. But they are for natural
languages (and locale dependant), not for programming
languages. I'm worried about that this can cause some
unexpected behavior.
Please test. If no one objects, I'll apply this patch
on trunk after some more testing period (possibly a
week or so).
If it does not affect programming mode langauges, but only natural languages, I have no problem with you committing this patch.
Unfortunately, this doesn affect programming mode, too. For example,
"x.foo()" could be broken at the next of the period.
I'm seeking some solution to select, or unify the two algorithms to
find line breaks; the one now jEdit does, and the one BreakIterator
does.
If I am not using a language which uses spaces, how can i test it? Does this mean only people who are using those languages will notice any difference at all?
Thank you for looking into the patch. Now I remembered that I have a
revised patch which includes a possible solution for the problem I
mentioned in the last comment. The revised patch is attached.
But I already noticed that the patch is still unacceptable, because the
patch doesn't work well for multiple token types, which had not been
tested at the time I created the 2 patches.
Except that, you can test the patch to check if it doesn't makes any
other unintended side effects. The difference should be noticeable only
for people who are using those languages.
Should this be closed then?
Setting to "remind" which means this patch is awaiting further testing by other developers.
While testing, I noticed it does not resolve issue# https://sourceforge.net/tracker/?func=detail&aid=1624755&group_id=588&atid=350588
Is there a way I can see it wrap long lines that have no spaces without switching to japanese?
svn diff for jEdit/trunk r21102
Another revised patch is attached. Now it passes all my manual tests
including about performance.
It contains so many logical units of change that shouldn't be in a
single revision. I'll start committing separate revisions for each
logical unit in the patch.
About the linked FR #1624755, it is not in scope of this patch. However,
it will be far easier to implement after this patch. The detection of
line breaks is completely decoupled from syntax token boundaries, and
encapsulated in a simple class; LineBreakIterator which implements
java.text.BreakIterator.
Testing without Asian text are also welcome to detect unwanted side
effects.
svn diff for jEdit/trunk r21106
If I have a very long line like aaaa/bbbb/cccc... it doesn't break at all in jedit now. Will this patch enable it? In text mode? In xml and other modes?
No. That's FR #1624755. It is said that this patch would satisfy the FR,
but it was said for the first version of this patch, which broke
"x.foo()" at the next of period. The current version doesn't break it.
Please see DisplayTokenHandler.LineBreakIterator.isAcceptableBreak() for
the actual condition.
Re-reading FR #1624755, I got lost about what kind of line breaks the FR
(and you) want for non-Asian text. I think it's better to create a fresh
FR with more specific description about what text should be broken,
under what condition.
The core change in the patch is committed in r21116. Closing this item
as accepted (by myself).
Remaining changes in the patch are not so important. They will be
committed later as my low priority tasks.