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
Copy link
Copy Markdown

@bemyak bemyak commented Feb 24, 2026

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
Copy link
Copy Markdown
Author

bemyak commented Feb 24, 2026

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
Copy link
Copy Markdown
Owner

Wilfred commented Feb 24, 2026

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
Copy link
Copy Markdown
Author

bemyak commented Feb 24, 2026

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
Copy link
Copy Markdown
Owner

Wilfred commented Feb 24, 2026

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

@Wilfred
Copy link
Copy Markdown
Owner

Wilfred commented Feb 24, 2026

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

Do you mean that links are clickable?

@bemyak
Copy link
Copy Markdown
Author

bemyak commented Feb 24, 2026

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
Copy link
Copy Markdown
Author

bemyak commented Feb 28, 2026

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