Skip to content

Add new preference option 'console.head_padding' #919

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

Merged
merged 3 commits into from
Jan 17, 2025

Conversation

Junology
Copy link
Contributor

The PR adds console.head_padding preference option to configure blank lines printed in terminal/console in each time a sketch is run.

The background is found in #911.

Making the change, I originally planned to only add an option for backward compatibility.
However, I finally decided to rewrite the code for "padding by blank lines" using EditConsole.message instead of System.out.println to stop printing them in the terminal.
The reasons why I think this is safe are as follows:

  1. First of all, the change only affects the IDE (i.e. processing) and not command-line mode (i.e. processing-java).
    Hence, it would not affect the final products of any projects using Processing either.
  2. Windows: after investigation, I realized that the blank lines does not affect Windows terminals (i.e. command prompt or PowerShell) probably because of launch4j.
    So, maybe it would not seriously break backward compatibility in Windows if the blank lines are removed.
  3. Linux: processing is run as a background process, so any outputs can mess up the terminal.
    Moreover, since the blank lines are likely the only outputs from IDE (NOTE: print/println does not print to terminal from IDE), so I think nobody rely on the behavior.

Unfortunately, I have not tested on MacOS and cannot since I don't have any machines.
It would be great if someone tests the change of behavior on MacOS and gives comments.

I also note that, in spite of my comments in #911, the head padding may be useful when console.auto_clear option is set to false.
For example, the following code prints HelloHelloHello without line breaks if you run it three times with console.auto_clear = false and console.head_padding = 0 on your preferences.txt:

print("Hello");

I wonder if console.auto_clear and the new option console.head_padding are worth putting in the preference dialog.
In some situations, keeping console outputs may help debugging, but currently nobody knows the option.

Copy link
Collaborator

@Stefterv Stefterv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution @Junology! I'm happy to add it and thank you for documenting your work thoroughly!

If you have a bit more time, please check the try catch otherwise this is good to go!

@Stefterv Stefterv merged commit cb1d425 into processing:main Jan 17, 2025
6 checks passed
@Junology Junology deleted the printclean branch January 17, 2025 12:32
@Stefterv Stefterv added the enhancement New feature or request label Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants