From: <ker...@us...> - 2023-10-09 20:38:45
|
Revision: 25690 http://sourceforge.net/p/jedit/svn/25690 Author: kerik-sf Date: 2023-10-09 20:38:43 +0000 (Mon, 09 Oct 2023) Log Message: ----------- Fix bug #4125 delete at the end of the line does not delete newline on java 20, 21 previous commit already had the patch. Adding a comment and changelog entry. Modified Paths: -------------- jEdit/trunk/doc/CHANGES.txt jEdit/trunk/org/gjt/sp/jedit/textarea/TextArea.java Modified: jEdit/trunk/doc/CHANGES.txt =================================================================== --- jEdit/trunk/doc/CHANGES.txt 2023-10-03 11:13:02 UTC (rev 25689) +++ jEdit/trunk/doc/CHANGES.txt 2023-10-09 20:38:43 UTC (rev 25690) @@ -20,6 +20,9 @@ - Bug #4128 key handling in the Errors dialog uses current keymap. +- Bug #4125 Delete at the end of the line does not delete newline on java20, + java21 + }}} {{{ Miscellaneous Modified: jEdit/trunk/org/gjt/sp/jedit/textarea/TextArea.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/textarea/TextArea.java 2023-10-03 11:13:02 UTC (rev 25689) +++ jEdit/trunk/org/gjt/sp/jedit/textarea/TextArea.java 2023-10-09 20:38:43 UTC (rev 25690) @@ -6314,10 +6314,12 @@ { int following = charBreaker.following(offset - index0Offset); - if (following == BreakIterator.DONE || (Runtime.version().feature() >= 20 && following == offset - index0Offset)) + if (following == BreakIterator.DONE || (Runtime.version().feature() >= 20 && following == offset - index0Offset)) { - // This means a end of line. Then it is - // safe to assume 1 code unit is a character. + // When offset is before a line break, + // pre java20 BreakIterator.DONE is returned by RuleBasedBreakIterator + // after java20, offset - index0Offset is returned by GraphemeBreakIterator. + // In either case it is safe to assume 1 code unit is a character. // This may return an offset beyond the // length of buffer. But it is a callers // responsibility. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |