From 41dd733ca7123c9ac4bfc6c781697a660e95b052 Mon Sep 17 00:00:00 2001 From: Can Celik Date: Sat, 4 Apr 2026 19:22:04 +0300 Subject: feat: finish ghostty pane backend integration --- vendor/libghostty-vt/src/config/url.zig | 523 ++++++++++++++++++++++++++++++++ 1 file changed, 523 insertions(+) create mode 100644 vendor/libghostty-vt/src/config/url.zig (limited to 'vendor/libghostty-vt/src/config/url.zig') diff --git a/vendor/libghostty-vt/src/config/url.zig b/vendor/libghostty-vt/src/config/url.zig new file mode 100644 index 00000000..2621898e --- /dev/null +++ b/vendor/libghostty-vt/src/config/url.zig @@ -0,0 +1,523 @@ +const std = @import("std"); +const oni = @import("oniguruma"); + +/// Default URL/path regex. This is used to detect URLs and file paths in +/// terminal output. +/// +/// This is here in the config package because one day the matchers will be +/// configurable and this will be a default. +/// +/// For scheme URLs, this regex is liberal in what it accepts after the scheme, +/// with exceptions for URLs ending with . or ). Although such URLs are +/// perfectly valid, it is common for text to contain URLs surrounded by +/// parentheses (such as in Markdown links) or at the end of sentences. +/// Therefore, this regex excludes them as follows: +/// +/// 1. Do not match regexes ending with . +/// 2. Do not match regexes ending with ), except for ones which contain a ( +/// without a subsequent ) +/// +/// Rule 2 means that we handle the following two cases: +/// +/// "https://en.wikipedia.org/wiki/Rust_(video_game)" (include parens) +/// "(https://example.com)" (do not include the parens) +/// +/// There are many complicated cases where these heuristics break down, but +/// handling them well requires a non-regex approach. +const url_schemes = + \\https?://|mailto:|ftp://|file:|ssh:|git://|ssh://|tel:|magnet:|ipfs://|ipns://|gemini://|gopher://|news: +; + +const ipv6_url_pattern = + \\(?:\[[:0-9a-fA-F]+(?:[:0-9a-fA-F]*)+\](?::[0-9]+)?) +; + +const scheme_url_chars = + \\[\w\-.~:/?#@!$&*+,;=%] +; + +const path_chars = + \\[\w\-.~:\/?#@!$&*+;=%] +; + +const optional_bracketed_word_suffix = + \\(?:[\(\[]\w*[\)\]])? +; + +const no_trailing_punctuation = + \\(?