Closed
Description
Description
When setClearWhitespaceLinesEnabled
is enabled and setAutoIndentEnabled
is disabled then spaces are not being cleared when Enter is hit.
Steps to Reproduce
- Modify src/main/java/org/fife/ui/rsyntaxtextarea/demo/DemoRootPane.java in the following way:
--- a/RSyntaxTextAreaDemo/src/main/java/org/fife/ui/rsyntaxtextarea/demo/DemoRootPane.java
+++ b/RSyntaxTextAreaDemo/src/main/java/org/fife/ui/rsyntaxtextarea/demo/DemoRootPane.java
@@ -210,7 +210,10 @@ public class DemoRootPane extends JRootPane implements HyperlinkListener,
textArea.requestFocusInWindow();
textArea.setMarkOccurrences(true);
textArea.setCodeFoldingEnabled(true);
- textArea.setClearWhitespaceLinesEnabled(false);
+ textArea.setWhitespaceVisible(true);
+ textArea.setClearWhitespaceLinesEnabled(true);
+ textArea.setTabsEmulated(true);
+ textArea.setAutoIndentEnabled(false);
InputMap im = textArea.getInputMap();
ActionMap am = textArea.getActionMap();
- run
./gradlew RSyntaxTextAreaDemo:run
- go to empty line, add some spaces and hit enter
Expected behavior
The spaces are cleared when enter is hit.
Actual behavior
The spaces are left uncleared.
Java version
java 14.0.2 2020-07-14
Java(TM) SE Runtime Environment (build 14.0.2+12-46)
Java HotSpot(TM) 64-Bit Server VM (build 14.0.2+12-46, mixed mode, sharing)
OS
macOS 10.15.7
Additional context
Additional remarks:
- when auto-indent is on, the line is cleared and spaces are being 'moved' to new line - probably this is expected behavior? Or not?
- is there any option btw to remove trailing spaces?
Metadata
Metadata
Assignees
Projects
Relationships
Development
No branches or pull requests
Activity
[-]setClearWhitespaceLinesEnabled doesn't work auto-ident is disabled[/-][+]setClearWhitespaceLinesEnabled doesn't work if auto-ident is disabled[/+][-]setClearWhitespaceLinesEnabled doesn't work if auto-ident is disabled[/-][+]setClearWhitespaceLinesEnabled doesn't work if auto-indent is disabled[/+]bobbylight commentedon Dec 1, 2022
Thanks for reporting this! To answer your questions:
Yes, the idea with that combination is the indent of the prior line (being cleared) is the indent that should be used for subsequent lines, so it is essentially moved to the new line.
Not currently, but feel free to open a new feature request if you'd be interested in this. Would you expect something to happen with each Enter press, or some sort of action that could be executed on say file save (or any arbitrary event)_?