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

Disable/control blank lines in the beginning of the console #911

Open
Junology opened this issue Jan 11, 2025 · 3 comments
Open

Disable/control blank lines in the beginning of the console #911

Junology opened this issue Jan 11, 2025 · 3 comments
Labels
enhancement New feature or request

Comments

@Junology
Copy link
Contributor

Most relevant area for this enhancement?

Accessibility

Feature to enhance

Processing prints 10 blank lines when it runs PDE

Desired enhancement

In Linux, Processing IDE is launched by java command with & in the tail, so the blank lines just mess up the terminal; e.g.

[email protected]$ ./processing
[email protected]$ 









echo "This is the next command"
This is the next command
[email protected]$ 

I just want to disable the feature, but regarding backward compatibility, let me suggest three options:

  1. Just stop printing blank lines. The simplest solution, but this can break backward compatibility.
  2. Add configurable option to defaults.txt or preferences.txt like console.blanklines with default value 10 which controls the number of blank lines. A user can set it to 0 to disable the printing. Also, it would not affect existing projects unless they depend on defaults.txt itself.
  3. Do nothing. Maximal backward compatibility.

Potential benefits

The enhancement may also benefit GUI users since the blank lines are also printed to IDE's "console" area.
For those users, the blank lines make little sense.
editor-blankline

Possible drawbacks

According to the comment in the source code, the blank lines are for Windows console (see below).
However, the line was added in Processing 2 era, so things may have changed.
Backward compatibility can also be a problem.

Additional context

The blank lines come from Editor.prepareRun() method in the line 2297 in processing.app.ui.Editor.

  public void prepareRun() {
    internalCloseRunner();
    statusEmpty();

    // do this to advance/clear the terminal window / dos prompt / etc
    for (int i = 0; i < 10; i++) System.out.println();

Would you like to work on the issue?

Once the direction becomes clear, I think I can do it by myself.

@Junology Junology added the enhancement New feature or request label Jan 11, 2025
@Stefterv
Copy link
Collaborator

Any idea why the terminal window needs to be cleared a bit in the first place?

@Stefterv
Copy link
Collaborator

I'm also happy if it gets moved down a little bit:

for (int i = 0; i < 10; i++) System.out.println();
// clear the console on each run, unless the user doesn't want to
if (Preferences.getBoolean("console.auto_clear")) {
console.clear();
}

@Junology
Copy link
Contributor Author

I have no idea why this clearance is needed in "the terminal windows / dos prompt / etc", at least in the current environment around Processing.
According to git log, these lines were introduced in 2011, but I don't know about the situation in that time since I am pretty new here.
Anyway, even if it needs to clear the terminal, spamming with blank lines doesn't seems to be a right way.
When it is executed as a background process with & in the launch command, it should never output anything to stdout.

As for console.auto_clear, I understand it erases the outputs in the previous Run.

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

No branches or pull requests

2 participants