Skip to content

Problem opening URL on errors #1167

Closed

Description

@SableRaf

Most appropriate sub-area of Processing 4?

Other (specify if possible), PDE

Processing version

4.4.4

Operating system

macOS 15.5 (24F74)

Bug description

Processing has a less documented feature to search for errors online. This seems no longer functional.

Steps to reproduce this

  1. Run a broken sketch to cause an error
  2. Press SHIFT then click the search 🔍 button
  3. Observe the error Problem Opening URL

snippet

none

Additional context

Image

Note: trying this on a sketch without an error, the output is as below.

Image

Would you like to work on the issue?

No, I’m just reporting the issue

Activity

  1. aj-m commented on Jul 10, 2025

    @aj-m
    Contributor

    I can partially reproduce this on Debian Unstable (DE: Plasma on Wayland).
    Attempting to use the browser search in a sketch with an error does correctly open the search page in my default browser.

    Image

    However, attempting the browser search without an error results in the search page opening with the ++++++++++... string as the search query.

    Image

    So the issue with the browser search not opening seems to be an issue with the MacOS implementation specifically, which I don't have the means to tackle, or at least not a Linux implementation issue. I have tracked down the + bug though.


    The +++++++... spam originates with Editor.statusEmpty(), which "clears" the EditorStatus message by setting it to Editor.EMPTY, which is actually about ~200 space characters. This spacer string gets URL-encoded into those ~200 + characters before going into Platform.openURL in the EditorStatus mouseReleased handler.

    static protected final String EMPTY =
    " " +
    " " +
    " ";

    /**
    * Clear the status area.
    */
    public void statusEmpty() {
    statusNotice(EMPTY);
    }

    } else if (mouseState == CLIPBOARD_PRESSED) {
    if (e.isShiftDown()) {
    // open the text in a browser window as a search
    final String fmt = Preferences.get("search.format");
    Platform.openURL(String.format(fmt, PApplet.urlEncode(message)));
    } else {
    // copy the text to the clipboard
    Clipboard clipboard = getToolkit().getSystemClipboard();
    clipboard.setContents(new StringSelection(message), null);
    System.out.println("Copied to the clipboard. " +
    "Use shift-click to search the web instead.");
    }

    EditorStatus has an empty() method which seems to properly clear the status message to an actual empty string. Replacing statusNotice(EMPTY) with this status.empty() in Editor.statusEmpty() seems to be the correct way to fix this, and has the additional effect of causing the copy-status-to-clipboard/search-for-error button to be hidden when there's no errors in the sketch, which seems to be the intended behavior.

    public void empty() {
    mode = NOTICE;
    message = "";
    url = null;
    repaint();
    }

    } else if (message != null && !message.isEmpty()) {
    ImageIcon glyph;
    float alpha;
    if (shiftDown) {
    glyph = searchIcon[mode];
    } else {
    glyph = clipboardIcon[mode];
    }

    Here's a side-by-side of the current statusNotice(EMPTY) behavior on the left and the status.empty() behavior on the right - Sorry for the horrendous quality, KolourPaint is apparently terrible for cropping screenshots. The console text on the right is just some trace output.

    Image
  2. SableRaf commented on Jul 10, 2025

    @SableRaf
    CollaboratorAuthor

    Thanks so much for taking the time to investigate this and share such a clear and detailed explanation. I really appreciate it.

    I tried out your suggested fix, and it does seem to solve the +++++++... issue on macOS as well.

    If you're up for it, I’d be glad to see you open a PR with the fix. Thanks @aj-m ✨

  3. added a commit that references this issue on Jul 10, 2025
    7103856
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions