case folding
parent
f5a036a6a0
commit
341137ce2e
|
|
@ -42,8 +42,8 @@
|
|||
.lazy = true,
|
||||
},
|
||||
.uucode = .{
|
||||
.url = "https://github.com/jacobsandlund/uucode/archive/96dd05cb9df893293fffe35321eb0aeb36379b48.tar.gz",
|
||||
.hash = "uucode-0.0.0-ZZjBPuZ1PAB3TAPIR1yzwyGZbAZ4AqYEtfQ81lsdBL67",
|
||||
.url = "https://github.com/jacobsandlund/uucode/archive/c7421d97dbdaa8aa176a87eb6dd7dcc3baab12d1.tar.gz",
|
||||
.hash = "uucode-0.0.0-ZZjBPkh9PAAR34asa24LSw5i5TNKE1B3hohDkZL5iT8J",
|
||||
},
|
||||
.uucode_x = .{
|
||||
.url = "https://github.com/jacobsandlund/uucode.x/archive/ca9a9a4560307a30319d206b1ac68a7fc2f2fce9.tar.gz",
|
||||
|
|
|
|||
|
|
@ -9,8 +9,11 @@ pub const tables = [_]config.Table{
|
|||
.fields = &.{
|
||||
wcwidth.field("wcwidth"),
|
||||
d.field("general_category"),
|
||||
d.field("has_emoji_presentation"),
|
||||
d.field("block"),
|
||||
d.field("has_emoji_presentation"),
|
||||
d.field("case_folding_full"),
|
||||
// Alternative:
|
||||
// d.field("case_folding_simple"),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ const std = @import("std");
|
|||
const Allocator = std.mem.Allocator;
|
||||
const assert = std.debug.assert;
|
||||
const build_config = @import("../build_config.zig");
|
||||
const ziglyph = @import("ziglyph");
|
||||
const uucode = @import("uucode");
|
||||
const key = @import("key.zig");
|
||||
const KeyEvent = key.KeyEvent;
|
||||
|
|
@ -1566,6 +1565,8 @@ pub const Trigger = struct {
|
|||
.unicode => |cp| std.hash.autoHash(
|
||||
hasher,
|
||||
foldedCodepoint(cp),
|
||||
// Alternative, just use simple case folding:
|
||||
// uucode.get(.case_folding_simple, cp),
|
||||
),
|
||||
}
|
||||
std.hash.autoHash(hasher, self.mods.binding());
|
||||
|
|
@ -1576,14 +1577,16 @@ pub const Trigger = struct {
|
|||
fn foldedCodepoint(cp: u21) [3]u21 {
|
||||
// ASCII fast path
|
||||
if (uucode.ascii.isAlphabetic(cp)) {
|
||||
return .{ ziglyph.letter.toLower(cp), 0, 0 };
|
||||
return .{ uucode.ascii.toLower(cp), 0, 0 };
|
||||
}
|
||||
|
||||
// Unicode slow path. Case folding can resultin more codepoints.
|
||||
// Unicode slow path. Case folding can result in more codepoints.
|
||||
// If more codepoints are produced then we return the codepoint
|
||||
// as-is which isn't correct but until we have a failing test
|
||||
// then I don't want to handle this.
|
||||
return ziglyph.letter.toCaseFold(cp);
|
||||
var folded: [3]u21 = .{ 0, 0, 0 };
|
||||
_ = uucode.get(.case_folding_full, cp).copy(&folded, cp);
|
||||
return folded;
|
||||
}
|
||||
|
||||
/// Convert the trigger to a C API compatible trigger.
|
||||
|
|
|
|||
Loading…
Reference in New Issue