Skip to content

Add Ghostty terminal hyperlink support#3

Open
the-spectator wants to merge 2 commits intopiotrmurach:masterfrom
the-spectator:feat/ghostty
Open

Add Ghostty terminal hyperlink support#3
the-spectator wants to merge 2 commits intopiotrmurach:masterfrom
the-spectator:feat/ghostty

Conversation

@the-spectator
Copy link

Closes #2

Describe the change

Add Ghostty terminal hyperlink support

Why are we doing this?

To extend the supported terminal list.

Requirements

  • Tests written & passing locally?
  • Code style checked?
  • Rebased with master branch?
  • Documentation updated?
  • Changelog updated?

Copy link
Owner

@piotrmurach piotrmurach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Akshay,

Thank you for submitting this PR. 🙏

I'm all in favour of adding Ghostty support. I left a couple of comments, though. In particular, I'm curious about the version check. Would you have time to investigate?

@the-spectator
Copy link
Author

Thanks for the review @piotrmurach ! I have updated the code as per review comments.

Copy link
Owner

@piotrmurach piotrmurach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for making the changes. We are nearly there.

@the-spectator the-spectator force-pushed the feat/ghostty branch 2 times, most recently from 5f9fbed to f7ab9bb Compare December 16, 2025 08:45
@the-spectator
Copy link
Author

Friendly bump for review.

Copy link
Owner

@piotrmurach piotrmurach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@the-spectator Sorry for the delay in my review.

I went through all the changes. Most comments relate to tests to ensure consistency in formatting and ordering. I included an extra test to match the other terminal tests.

Once this is merged, I plan to make a couple more changes to link rendering before making a new release.

@@ -0,0 +1,67 @@
# frozen_string_literal: true

RSpec.describe TTY::Link::Terminals::Ghostty, "#link?" do
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for messing you around with this. I looked at other terminal tests. Let's keep the order consistent. So the naming and order should be:

  • "doesn't support links without the term program..."
  • "doesn't support links without a terminal program name"
  • "doesn't support links with a non-Ghostty program name"
  • "supports links above the 2.0.0 version" NEW test with 2.3.4 version.
  • "supports links above the 1.0.0 version"
  • "supports links on the 1.0.0 version"
  • "supports links on the 1.0.0 version with a mixed-case program name"
  • "doesn't support links below the 1.0.0 version"
  • "doesn't support links without a version"
  • "doesn't support links without the term program version env variable"

end

it "doesn't support links with a non-Ghostty program name" do
env = {"TERM_PROGRAM" => "other-terminal", "TERM_PROGRAM_VERSION" => "1.0.0"}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
env = {"TERM_PROGRAM" => "other-terminal", "TERM_PROGRAM_VERSION" => "1.0.0"}
env = {"TERM_PROGRAM" => "other-terminal"}

expect(ghostty.link?).to eq(false)
end

it "supports links with the Ghostty program name" do
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
it "supports links with the Ghostty program name" do
it "supports links on the 1.0.0 version" do

expect(ghostty.link?).to eq(true)
end

it "supports links with the Ghostty program name in mixed case" do
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
it "supports links with the Ghostty program name in mixed case" do
it "supports links on the 1.0.0 version with a mixed-case program name" do

expect(ghostty.link?).to eq(true)
end

it "doesn't supports links without the term program version env variable" do
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
it "doesn't supports links without the term program version env variable" do
it "doesn't support links without the term program version env variable" do

end

it "doesn't supports links below version 1.0.0" do
env = env_with_name.merge({"TERM_PROGRAM_VERSION" => "0.9.0"})
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
env = env_with_name.merge({"TERM_PROGRAM_VERSION" => "0.9.0"})
env = env_with_name.merge({"TERM_PROGRAM_VERSION" => "0.9.2"})

end

it "supports links above the 1.0.0 version" do
env = env_with_name.merge({"TERM_PROGRAM_VERSION" => "1.1.0"})
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
env = env_with_name.merge({"TERM_PROGRAM_VERSION" => "1.1.0"})
env = env_with_name.merge({"TERM_PROGRAM_VERSION" => "1.0.1"})


context "when Ghostty" do
it "supports links above the 1.0.0 version" do
env = {"TERM_PROGRAM" => "ghostty", "TERM_PROGRAM_VERSION" => "1.0.1"}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
env = {"TERM_PROGRAM" => "ghostty", "TERM_PROGRAM_VERSION" => "1.0.1"}
env = {
"TERM_PROGRAM" => "ghostty",
"TERM_PROGRAM_VERSION" => "1.0.1"
}

CHANGELOG.md Outdated
Comment on lines +7 to +8
* Add hyperlink support detection in Ghostty terminal
by Akshay Birajdar (@the-spectator).
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Add hyperlink support detection in Ghostty terminal
by Akshay Birajdar (@the-spectator).
* Add hyperlink support detection for the Ghostty terminal
by Akshay Birajdar (@the-spectator).

!(term_program =~ GHOSTTY).nil?
end

# Detect any Ghostty terminal version to support terminal hyperlinks
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer true. Let's change to:

Suggested change
# Detect any Ghostty terminal version to support terminal hyperlinks
# Detect whether the Ghostty version supports terminal hyperlinks

@the-spectator
Copy link
Author

Thanks for the review @piotrmurach ! I have addressed the review comments.

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.

Supporting Ghostty Terminal

2 participants