feat: add smart_delete_backward command for improved smart pair handling

This commit is contained in:
CJ van den Berg 2025-03-04 19:51:31 +01:00
parent e34aed4a95
commit c984f3c392
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
3 changed files with 63 additions and 1 deletions

View file

@ -38,6 +38,25 @@ pub fn control_code_to_unicode(code: u8) [:0]const u8 {
};
}
pub const char_pairs = [_]struct { []const u8, []const u8 }{
.{ "\"", "\"" },
.{ "'", "'" },
.{ "(", ")" },
.{ "(", ")" },
.{ "[", "]" },
.{ "[", "]" },
.{ "{", "}" },
.{ "{", "}" },
.{ "", "" },
.{ "", "" },
.{ "", "" },
.{ "", "" },
.{ "", "" },
.{ "", "" },
.{ "«", "»" },
.{ "«", "»" },
};
fn raw_byte_to_utf8(cp: u8, buf: []u8) ![]const u8 {
var utf16le: [1]u16 = undefined;
const utf16le_as_bytes = std.mem.sliceAsBytes(utf16le[0..]);