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

Clickable URLs #968

Merged
merged 30 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
c0a06ab
pkg/oniguruma: basic build
mitchellh Nov 25, 2023
4d3c721
pkg/oniguruma: init regex object
mitchellh Nov 25, 2023
3640209
pkg/oniguruma: search
mitchellh Nov 25, 2023
27585ae
pkg/oniguruma: better regex api
mitchellh Nov 25, 2023
b85174c
build: add oniguruma
mitchellh Nov 25, 2023
af04d89
build: dynamically link oniguruma
mitchellh Nov 25, 2023
7fc9569
terminal: basic lineIterator on screen
mitchellh Nov 25, 2023
0487dbf
terminal: selectionString uses arraylist to build results
mitchellh Nov 26, 2023
3aba42c
terminal: stringmaps
mitchellh Nov 26, 2023
c7ccded
terminal: Screen.getLine
mitchellh Nov 26, 2023
5db002c
renderer/metal: underline urls
mitchellh Nov 26, 2023
be05c3a
input: add Link
mitchellh Nov 27, 2023
aa86031
terminal: move line searching here, unit test
mitchellh Nov 28, 2023
20cc369
core: detect link click
mitchellh Nov 28, 2023
172a91e
core: change mouse cursor over link
mitchellh Nov 28, 2023
5a7596e
renderer: link set for more efficient matching
mitchellh Nov 29, 2023
b94c607
renderer: matchset tests
mitchellh Nov 29, 2023
3a599ec
renderer: link sets handle hover links
mitchellh Nov 29, 2023
8fcf3f0
core: send mouse hover point
mitchellh Nov 29, 2023
dcbe0b8
core: only update mouse hover point when no other mouse action
mitchellh Nov 29, 2023
995e4e3
os: open
mitchellh Nov 29, 2023
056e967
core: don't crash if link processing fails
mitchellh Nov 29, 2023
0938a0d
core: handle URL clicking properly with shift-escaping mouse events
mitchellh Nov 29, 2023
c66273e
input: better docs on links
mitchellh Nov 29, 2023
bb60d2c
renderer/opengl: urls
mitchellh Nov 29, 2023
9326e21
nix: update cache hash
mitchellh Nov 29, 2023
be1be2c
core: only process link detection on cursor pos if cell changes
mitchellh Nov 29, 2023
e6f7fb7
config: ability to disable URL matching
mitchellh Nov 30, 2023
2d24953
core: on mod change, rerun cursor pos callback
mitchellh Nov 30, 2023
eac1731
apprt/gtk: translate modifier-only presses to proper modifier state
mitchellh Nov 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,10 @@ fn addDeps(
.target = step.target,
.optimize = step.optimize,
});
const oniguruma_dep = b.dependency("oniguruma", .{
.target = step.target,
.optimize = step.optimize,
});
const opengl_dep = b.dependency("opengl", .{});
const pixman_dep = b.dependency("pixman", .{
.target = step.target,
Expand Down Expand Up @@ -749,6 +753,7 @@ fn addDeps(
"fontconfig",
fontconfig_dep.module("fontconfig"),
);
step.addModule("oniguruma", oniguruma_dep.module("oniguruma"));
step.addModule("freetype", freetype_dep.module("freetype"));
step.addModule("glslang", glslang_dep.module("glslang"));
step.addModule("spirv_cross", spirv_cross_dep.module("spirv_cross"));
Expand Down Expand Up @@ -793,6 +798,7 @@ fn addDeps(
step.linkSystemLibrary2("freetype2", dynamic_link_opts);
step.linkSystemLibrary2("harfbuzz", dynamic_link_opts);
step.linkSystemLibrary2("libpng", dynamic_link_opts);
step.linkSystemLibrary2("oniguruma", dynamic_link_opts);
step.linkSystemLibrary2("pixman-1", dynamic_link_opts);
step.linkSystemLibrary2("zlib", dynamic_link_opts);

Expand All @@ -803,6 +809,9 @@ fn addDeps(

// Other dependencies, we may dynamically link
if (static) {
step.linkLibrary(oniguruma_dep.artifact("oniguruma"));
try static_libs.append(oniguruma_dep.artifact("oniguruma").getEmittedBin());

step.linkLibrary(zlib_dep.artifact("z"));
try static_libs.append(zlib_dep.artifact("z").getEmittedBin());

Expand Down
1 change: 1 addition & 0 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
.harfbuzz = .{ .path = "./pkg/harfbuzz" },
.libpng = .{ .path = "./pkg/libpng" },
.macos = .{ .path = "./pkg/macos" },
.oniguruma = .{ .path = "./pkg/oniguruma" },
.opengl = .{ .path = "./pkg/opengl" },
.pixman = .{ .path = "./pkg/pixman" },
.tracy = .{ .path = "./pkg/tracy" },
Expand Down
3 changes: 3 additions & 0 deletions nix/devshell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
, ncurses
, nodejs
, nodePackages
, oniguruma
, parallel
, pkg-config
, python3
Expand Down Expand Up @@ -52,6 +53,7 @@ let
freetype
harfbuzz
libpng
oniguruma
pixman
zlib

Expand Down Expand Up @@ -111,6 +113,7 @@ in mkShell rec {
freetype
harfbuzz
libpng
oniguruma
pixman
zlib

Expand Down
2 changes: 1 addition & 1 deletion nix/zig_cache_hash.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# This file is auto-generated! check build-support/check-zig-cache-hash.sh for
# more details.
"sha256-KMv4j1/UxsrRPkr+Fy9BjtzwFZquiLfJCLMP28oVZiU="
"sha256-bQ81e0vJBSLkVJ3a3nLraVc/JeG77xGckuARmu81DqI="
130 changes: 130 additions & 0 deletions pkg/oniguruma/build.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
const std = @import("std");
const NativeTargetInfo = std.zig.system.NativeTargetInfo;

pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});

_ = b.addModule("oniguruma", .{ .source_file = .{ .path = "main.zig" } });

const upstream = b.dependency("oniguruma", .{});
const lib = try buildOniguruma(b, upstream, target, optimize);
b.installArtifact(lib);

{
const test_exe = b.addTest(.{
.name = "test",
.root_source_file = .{ .path = "main.zig" },
.target = target,
.optimize = optimize,
});
test_exe.linkLibrary(lib);
const tests_run = b.addRunArtifact(test_exe);
const test_step = b.step("test", "Run tests");
test_step.dependOn(&tests_run.step);

// Uncomment this if we're debugging tests
b.installArtifact(test_exe);
}
}

fn buildOniguruma(
b: *std.Build,
upstream: *std.Build.Dependency,
target: std.zig.CrossTarget,
optimize: std.builtin.OptimizeMode,
) !*std.Build.Step.Compile {
const lib = b.addStaticLibrary(.{
.name = "oniguruma",
.target = target,
.optimize = optimize,
});
const t = lib.target_info.target;
lib.linkLibC();
lib.addIncludePath(upstream.path("src"));

lib.addConfigHeader(b.addConfigHeader(.{
.style = .{ .cmake = upstream.path("src/config.h.cmake.in") },
}, .{
.PACKAGE = "oniguruma",
.PACKAGE_VERSION = "6.9.9",
.VERSION = "6.9.9",
.HAVE_STDINT_H = true,
.HAVE_SYS_TIMES_H = true,
.HAVE_SYS_TIME_H = true,
.HAVE_SYS_TYPES_H = true,
.HAVE_UNISTD_H = true,
.HAVE_INTTYPES_H = true,
.SIZEOF_INT = t.c_type_byte_size(.int),
.SIZEOF_LONG = t.c_type_byte_size(.long),
.SIZEOF_LONG_LONG = t.c_type_byte_size(.longlong),
.SIZEOF_VOIDP = t.ptrBitWidth() / t.c_type_bit_size(.char),
}));

var flags = std.ArrayList([]const u8).init(b.allocator);
defer flags.deinit();
try flags.appendSlice(&.{});
lib.addCSourceFiles(.{
.dependency = upstream,
.flags = flags.items,
.files = &.{
"src/regerror.c",
"src/regparse.c",
"src/regext.c",
"src/regcomp.c",
"src/regexec.c",
"src/reggnu.c",
"src/regenc.c",
"src/regsyntax.c",
"src/regtrav.c",
"src/regversion.c",
"src/st.c",
"src/onig_init.c",
"src/unicode.c",
"src/ascii.c",
"src/utf8.c",
"src/utf16_be.c",
"src/utf16_le.c",
"src/utf32_be.c",
"src/utf32_le.c",
"src/euc_jp.c",
"src/sjis.c",
"src/iso8859_1.c",
"src/iso8859_2.c",
"src/iso8859_3.c",
"src/iso8859_4.c",
"src/iso8859_5.c",
"src/iso8859_6.c",
"src/iso8859_7.c",
"src/iso8859_8.c",
"src/iso8859_9.c",
"src/iso8859_10.c",
"src/iso8859_11.c",
"src/iso8859_13.c",
"src/iso8859_14.c",
"src/iso8859_15.c",
"src/iso8859_16.c",
"src/euc_tw.c",
"src/euc_kr.c",
"src/big5.c",
"src/gb18030.c",
"src/koi8_r.c",
"src/cp1251.c",
"src/euc_jp_prop.c",
"src/sjis_prop.c",
"src/unicode_unfold_key.c",
"src/unicode_fold1_key.c",
"src/unicode_fold2_key.c",
"src/unicode_fold3_key.c",
},
});

lib.installHeadersDirectoryOptions(.{
.source_dir = upstream.path("src"),
.install_dir = .header,
.install_subdir = "",
.include_extensions = &.{".h"},
});

return lib;
}
11 changes: 11 additions & 0 deletions pkg/oniguruma/build.zig.zon
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.{
.name = "oniguruma",
.version = "6.9.9",
.paths = .{""},
.dependencies = .{
.oniguruma = .{
.url = "https://github.com/kkos/oniguruma/archive/refs/tags/v6.9.9.tar.gz",
.hash = "1220c15e72eadd0d9085a8af134904d9a0f5dfcbed5f606ad60edc60ebeccd9706bb",
},
},
}
3 changes: 3 additions & 0 deletions pkg/oniguruma/c.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub usingnamespace @cImport({
@cInclude("oniguruma.h");
});
Loading