Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setClearWhitespaceLinesEnabled doesn't work if auto-indent is disabled #469

Closed
pskowronek opened this issue Nov 30, 2022 · 1 comment
Closed
Assignees
Labels
Milestone

Comments

@pskowronek
Copy link

pskowronek commented Nov 30, 2022

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.

Screenshots
obraz

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?
@pskowronek pskowronek added the bug label Nov 30, 2022
@pskowronek pskowronek changed the title setClearWhitespaceLinesEnabled doesn't work auto-ident is disabled setClearWhitespaceLinesEnabled doesn't work if auto-ident is disabled Nov 30, 2022
@pskowronek pskowronek changed the title setClearWhitespaceLinesEnabled doesn't work if auto-ident is disabled setClearWhitespaceLinesEnabled doesn't work if auto-indent is disabled Nov 30, 2022
@bobbylight bobbylight self-assigned this Dec 1, 2022
@bobbylight bobbylight added this to the 3.3.1 milestone Dec 1, 2022
@bobbylight
Copy link
Owner

Thanks for reporting this! To answer your questions:

when auto-indent is on, the line is cleared and spaces are being 'moved' to new line - probably this is expected behavior? Or not?

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.

is there any option btw to remove trailing spaces?

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)_?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants