refactor: additional characters for smart_insert

This commit is contained in:
Igor Támara 2025-11-17 23:09:40 -05:00 committed by CJ van den Berg
parent fd3401748e
commit b4b44ec906
2 changed files with 8 additions and 1 deletions

View file

@ -41,13 +41,15 @@ pub fn control_code_to_unicode(code: u8) [:0]const u8 {
pub const char_pairs = [_]struct { []const u8, []const u8 }{ pub const char_pairs = [_]struct { []const u8, []const u8 }{
.{ "\"", "\"" }, .{ "\"", "\"" },
.{ "'", "'" }, .{ "'", "'" },
.{ "`", "`" },
.{ "(", ")" }, .{ "(", ")" },
.{ "[", "]" }, .{ "[", "]" },
.{ "{", "}" }, .{ "{", "}" },
.{ "", "" }, .{ "", "" },
.{ "", "" }, .{ "", "" },
.{ "", "" },
.{ "«", "»" }, .{ "«", "»" },
.{ "¿", "?" },
.{ "¡", "!" },
}; };
pub const open_close_pairs = [_]struct { []const u8, []const u8 }{ pub const open_close_pairs = [_]struct { []const u8, []const u8 }{
@ -57,6 +59,8 @@ pub const open_close_pairs = [_]struct { []const u8, []const u8 }{
.{ "", "" }, .{ "", "" },
.{ "", "" }, .{ "", "" },
.{ "«", "»" }, .{ "«", "»" },
.{ "¿", "?" },
.{ "¡", "!" },
}; };
fn raw_byte_to_utf8(cp: u8, buf: []u8) ![]const u8 { fn raw_byte_to_utf8(cp: u8, buf: []u8) ![]const u8 {

View file

@ -255,6 +255,7 @@
["\"", "smart_insert_pair", "\"", "\""], ["\"", "smart_insert_pair", "\"", "\""],
["'", "smart_insert_pair", "'", "'"], ["'", "smart_insert_pair", "'", "'"],
["`", "smart_insert_pair", "`", "`"],
["(", "smart_insert_pair", "(", ")"], ["(", "smart_insert_pair", "(", ")"],
[")", "smart_insert_pair_close", "(", ")"], [")", "smart_insert_pair_close", "(", ")"],
["[", "smart_insert_pair", "[", "]"], ["[", "smart_insert_pair", "[", "]"],
@ -269,6 +270,8 @@
["", "smart_insert_pair_close", "", ""], ["", "smart_insert_pair_close", "", ""],
["«", "smart_insert_pair", "«", "»"], ["«", "smart_insert_pair", "«", "»"],
["»", "smart_insert_pair_close", "«", "»"], ["»", "smart_insert_pair_close", "«", "»"],
["¿", "smart_insert_pair", "¿", "?"],
["¡", "smart_insert_pair", "¡", "!"],
["alt+0", "add_integer_argument_digit", 0], ["alt+0", "add_integer_argument_digit", 0],
["alt+1", "add_integer_argument_digit", 1], ["alt+1", "add_integer_argument_digit", 1],