RSyntaxTextArea icon indicating copy to clipboard operation
RSyntaxTextArea copied to clipboard

Comma or other punctuation mark at beginning of line

Open ghost opened this issue 1 year ago • 2 comments

Description When you edit a txt file and line wrap is enabled, it can happen in an unfavorable case that a comma or other punctuation mark is at the beginning of a line. Similarly, it can happen that an opening parenthesis or a quotation mark is at the end of a line.

Steps to Reproduce see screenshot below for an example

Expected behavior For txt files, there should be no line break between a word and a directly following comma, period, semicolon, colon, hyphen etc. Also, there should be no line break between an opening parenthesis and a word.

Actual behavior see above

Screenshots Lorem ipsum

Parentheses

Quotation Marks

Java version Runtime version: 23-internal VM name: OpenJDK 64-Bit Server VM VM version: 23-internal-ahadas-0081ac197a656cdc0d88d5a5e2a0f399ee023654 VM vendor: Oracle Corporation

Additional context I'm a muCommander user and have originally reported this issue here: https://github.com/mucommander/mucommander/issues/1197

Operating System type and version: Name: Mac OS X Version: 14.5 Architecture: aarch64

ghost avatar May 27 '24 17:05 ghost

muC currently still uses RSyntaxTextArea v3.3.4. But, I've checked muC build with v3.4.0 and the problem is still there.

pskowronek avatar May 27 '24 17:05 pskowronek

RSTA's line wrap is per-token, per the TokenMaker, and not per typical lexical rules. I think the way to do this "the right way" would be to change the PlainTextTokenMaker to use BreakIterator to break text on word instances.

I'm not sure it's worth changing the behavior in programming languages where line wrap is less common, and folks are probably more forgiving of code being wrapped baed on how the language is lexed.

bobbylight avatar Jul 06 '24 19:07 bobbylight