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

Change order for processing links in mouse events #2640

Closed

Conversation

antoniomika
Copy link

@antoniomika antoniomika commented Nov 9, 2024

As discussed on Discord, there's some funkiness when holding super and hovering over links while a mouse is captured.

Here's a gif showing this issue:
broken

I was able to track this to here, which results in us never escaping this block and therefore mouseRefreshLinks never runs. Through discussion on discord, the "current best" solution was changing the processing order around to always process links even if events are captured (at least until mouse logic is rewritten). This PR includes that change and some documentation around why that was moved with my understanding, please let me know if that is flawed. Here's the functionality now:
fixed

As part of this discovery, I was able to also get debugging working within VSCode. Here's a gif of that:
debug

If that is useful, I can create a separate PR with those changes. For now, I'll link the instructions here.

Debug

  1. Create a .vscode/ directory with the following files:

extensions.json:

{
        // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
        // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp

        // List of extensions which should be recommended for users of this workspace.
        "recommendations": [
                "ziglang.vscode-zig",
                "llvm-vs-code-extensions.lldb-dap",
                "ms-vscode.cpptools-extension-pack"
        ],
        // List of extensions recommended by VS Code that should not be recommended for users of this workspace.
        "unwantedRecommendations": [

        ]
}

tasks.json:

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "ghostty build",
            "type": "shell",
            "command": "zig",
            "args": ["build", "-Dapp-runtime=glfw"]
        }
    ]
}

launch.json:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "ghostty debug",
            "type": "lldb-dap",
            "request": "launch",
            "program": "${workspaceFolder}/zig-out/bin/ghostty",
            "args": [],
            "cwd": "${workspaceFolder}",
            "preLaunchTask": "ghostty build"
        }
    ]
}
  1. Install the recommended extensions from extensions.json. Either search for them or install them from the extensions view and filter by recommended
  2. Ensure your lldp-dap binary is set properly in your path or configure it in VSCode preferences. If you're on macOS, this is installed with Xcode and the path can be found by running: xcrun -f lldb-dap. You can set this in your path or set the path to the binary in VSCode preferences.

@mitchellh
Copy link
Contributor

Thanks. As part of this PR, can you confirm you give permission for me to relicense your work to MIT when we publicly release Ghostty?

As for the PR itself, unfortunately due to the spaghetti nature of the mouse handling code, I can't confidently say this is safe. As I noted in Discord, I want to refactor this code to be able to better unit test everything but it's just not that way now.

I'm willing to merge this and just see what happens for now and hopefully try to prioritize that refactor at some point...

@antoniomika
Copy link
Author

That sounds good to me. Any preferences for the VSCode changes?

I also confirm that this code is good to be licensed as MIT when it comes time to release.

@mitchellh
Copy link
Contributor

I believe this was resolved in 1.0.1. Please advise if not.

@mitchellh mitchellh closed this Jan 2, 2025
@antoniomika
Copy link
Author

Tested both 1.0.1 as well as the current beta on my computer (89e0e7e6, build 8809) and seems to work properly (cmd + hover when mouse isn't captured and shift + cmd + hover when mouse is captured)!

I tested this using tmux with set mouse on/off

Thanks again for looking into this! Were you interested in any of the vscode changes (debugger, launch targets, recommended extensions)? Happy to put that in a separate PR but only if you think it's worthwhile.

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

Successfully merging this pull request may close these issues.

2 participants