From 5f1a5d264aac36d3b943956de8033ef7abc2e14c Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 8 Sep 2018 21:28:22 -0400 Subject: vim-patch:8.0.0749: some unicode digraphs are hard to remember Problem: Some unicode digraphs are hard to remember. Solution: Add alternatives with a backtick. (Chris Harding, closes vim/vim#1861) https://github.com/vim/vim/commit/816e7660e1efb918ad85b5c78d21b957d1bcad17 --- src/nvim/digraph.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/nvim/digraph.c b/src/nvim/digraph.c index c0915224e5..aa533edf6c 100644 --- a/src/nvim/digraph.c +++ b/src/nvim/digraph.c @@ -1359,6 +1359,12 @@ static digr_T digraphdefault[] = { 'f', 't', 0xfb05 }, { 's', 't', 0xfb06 }, + // extra alternatives, easier to remember + { 'W', '`', 0x1e80 }, + { 'w', '`', 0x1e81 }, + { 'Y', '`', 0x1ef2 }, + { 'y', '`', 0x1ef3 }, + // Vim 5.x compatible digraphs that don't conflict with the above { '~', '!', 161 }, // { 'c', '|', 162 }, // -- cgit From 95608136d54bf6d7e4fd660745f7004936262693 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 8 Sep 2018 22:28:31 -0400 Subject: tests: update expected output of :digraph command --- test/functional/ex_cmds/digraphs_spec.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/functional/ex_cmds/digraphs_spec.lua b/test/functional/ex_cmds/digraphs_spec.lua index f2d0b76739..37d3814136 100644 --- a/test/functional/ex_cmds/digraphs_spec.lua +++ b/test/functional/ex_cmds/digraphs_spec.lua @@ -23,13 +23,13 @@ describe(':digraphs', function() it('displays digraphs', function() feed(':digraphs') screen:expect([[ - A@ {6:Å} 197 E` {6:È} 200 E^ {6:Ê} 202 E" {6:Ë} 203 I` {6:Ì} 204 | - I^ {6:Î} 206 I" {6:Ï} 207 N~ {6:Ñ} 209 O` {6:Ò} 210 O^ {6:Ô} 212 | - O~ {6:Õ} 213 /\ {6:×} 215 U` {6:Ù} 217 U^ {6:Û} 219 Ip {6:Þ} 222 | - a` {6:à} 224 a^ {6:â} 226 a~ {6:ã} 227 a" {6:ä} 228 a@ {6:å} 229 | - e` {6:è} 232 e^ {6:ê} 234 e" {6:ë} 235 i` {6:ì} 236 i^ {6:î} 238 | - n~ {6:ñ} 241 o` {6:ò} 242 o^ {6:ô} 244 o~ {6:õ} 245 u` {6:ù} 249 | - u^ {6:û} 251 y" {6:ÿ} 255 | + E` {6:È} 200 E^ {6:Ê} 202 E" {6:Ë} 203 I` {6:Ì} 204 I^ {6:Î} 206 | + I" {6:Ï} 207 N~ {6:Ñ} 209 O` {6:Ò} 210 O^ {6:Ô} 212 O~ {6:Õ} 213 | + /\ {6:×} 215 U` {6:Ù} 217 U^ {6:Û} 219 Ip {6:Þ} 222 a` {6:à} 224 | + a^ {6:â} 226 a~ {6:ã} 227 a" {6:ä} 228 a@ {6:å} 229 e` {6:è} 232 | + e^ {6:ê} 234 e" {6:ë} 235 i` {6:ì} 236 i^ {6:î} 238 n~ {6:ñ} 241 | + o` {6:ò} 242 o^ {6:ô} 244 o~ {6:õ} 245 u` {6:ù} 249 u^ {6:û} 251 | + y" {6:ÿ} 255 | {3:Press ENTER or type command to continue}^ | ]]) end) -- cgit From 03bcfb54dbdcb90087c020b5d1256f2d6c2df14c Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 8 Sep 2018 23:32:33 -0400 Subject: digraph: refactor code that checks has_mbyte has_mbyte is always true in nvim. --- src/nvim/digraph.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/nvim/digraph.c b/src/nvim/digraph.c index aa533edf6c..7adb54cb6a 100644 --- a/src/nvim/digraph.c +++ b/src/nvim/digraph.c @@ -1549,11 +1549,6 @@ static int getexactdigraph(int char1, int char2, int meta_char) } } - // Ignore multi-byte characters when not in multi-byte mode. - if (!has_mbyte && (retval > 0xff)) { - retval = 0; - } - if (retval == 0) { // digraph deleted or not found if ((char1 == ' ') && meta_char) { @@ -1660,8 +1655,7 @@ void listdigraphs(void) tmp.result = getexactdigraph(tmp.char1, tmp.char2, FALSE); if ((tmp.result != 0) - && (tmp.result != tmp.char2) - && (has_mbyte || (tmp.result <= 255))) { + && (tmp.result != tmp.char2)) { printdigraph(&tmp); } dp++; -- cgit From 49647ae973dfc0b3448ee1e841d9bfd4af363873 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 8 Sep 2018 23:38:17 -0400 Subject: digraph: delete code that checks enc_utf8 enc_utf8 is always true in nvim. --- src/nvim/digraph.c | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/src/nvim/digraph.c b/src/nvim/digraph.c index 7adb54cb6a..8f7487262e 100644 --- a/src/nvim/digraph.c +++ b/src/nvim/digraph.c @@ -1526,29 +1526,6 @@ static int getexactdigraph(int char1, int char2, int meta_char) } } - if ((retval != 0) && !enc_utf8) { - char_u buf[6], *to; - vimconv_T vc; - - // Convert the Unicode digraph to 'encoding'. - int i = utf_char2bytes(retval, buf); - retval = 0; - vc.vc_type = CONV_NONE; - - if (convert_setup(&vc, (char_u *)"utf-8", p_enc) == OK) { - vc.vc_fail = true; - assert(i >= 0); - size_t len = (size_t)i; - to = string_convert(&vc, buf, &len); - - if (to != NULL) { - retval = utf_ptr2char(to); - xfree(to); - } - (void)convert_setup(&vc, NULL, NULL); - } - } - if (retval == 0) { // digraph deleted or not found if ((char1 == ' ') && meta_char) { -- cgit