Skip to content

Add OSC 8 link support to filepath in headers#954

Open
bemyak wants to merge 2 commits into
Wilfred:masterfrom
bemyak:osc-8
Open

Add OSC 8 link support to filepath in headers#954
bemyak wants to merge 2 commits into
Wilfred:masterfrom
bemyak:osc-8

Conversation

@bemyak

@bemyak bemyak commented Feb 24, 2026

Copy link
Copy Markdown

This PR adds OSC 8 support to difftastic. In practice, it means that links in hunk headers are now "clickable" inside some editors (Zed, VSCode, etc), and bring the user to the correct line in file.

Additional links:

@bemyak bemyak marked this pull request as draft February 24, 2026 09:42
@bemyak

bemyak commented Feb 24, 2026

Copy link
Copy Markdown
Author

Hmm, not sure why the test is failing. I updated the samples file, it has no changes when I run ./sample_files/compare_all.sh locally 🤔

@bemyak bemyak marked this pull request as ready for review February 24, 2026 12:11
Comment thread src/display/side_by_side.rs
@Wilfred

Wilfred commented Feb 24, 2026

Copy link
Copy Markdown
Owner

Overall this looks great, and I'm not sure why the regression test is failing either.

I'm not sure whether the line number syntax is valid though. Testing on my personal linux laptop in the gnome terminal produces this when I click on a link:

Screenshot From 2026-02-24 07-57-19

Have you see this behaviour? I wonder how other tools with OSC URLs are handling this.

@bemyak

bemyak commented Feb 24, 2026

Copy link
Copy Markdown
Author

Yeah, unfortunately line numbers specification is not in the standard, so it depends on the terminal emulator and the OS. I will switch back to slightly less supported, but much more safe # separator.

@Wilfred

Wilfred commented Feb 24, 2026

Copy link
Copy Markdown
Owner

Testing in VS Code also seems to be looking for a file literally called foo.el:123 FWIW.

@Wilfred

Wilfred commented Feb 24, 2026

Copy link
Copy Markdown
Owner

In practice, it means that links in hunk headers are not "clickable"

Do you mean that links are clickable?

@bemyak

bemyak commented Feb 24, 2026

Copy link
Copy Markdown
Author

Testing in VS Code also seems to be looking for a file literally called foo.el:123 FWIW.

Could you pull the latest changes? It works for me:
Screencast_20260224_153947.webm

Do you mean that links are clickable?

I meant to spell "are now clickable", sorry.

@bemyak

bemyak commented Feb 28, 2026

Copy link
Copy Markdown
Author

Did you have a chance to test it?

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