Mercurial > vim
comparison src/testdir/test_digraph.vim @ 13359:81c348d40312 v8.0.1553
patch 8.0.1553: cannot see what digraph is used to insert a character
commit https://github.com/vim/vim/commit/5f73ef8d20070cd45c9aea4dc33c2e0657f5515c
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Feb 27 21:09:30 2018 +0100
patch 8.0.1553: cannot see what digraph is used to insert a character
Problem: Cannot see what digraph is used to insert a character.
Solution: Show the digraph with the "ga" command. (Christian Brabandt)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 27 Feb 2018 21:15:06 +0100 |
parents | 1fad9675d8fd |
children | 8a9a00357676 |
comparison
equal
deleted
inserted
replaced
13358:0a3d1708d414 | 13359:81c348d40312 |
---|---|
2 | 2 |
3 if !has("digraphs") || !has("multi_byte") | 3 if !has("digraphs") || !has("multi_byte") |
4 finish | 4 finish |
5 endif | 5 endif |
6 | 6 |
7 func! Put_Dig(chars) | 7 func Put_Dig(chars) |
8 exe "norm! o\<c-k>".a:chars | 8 exe "norm! o\<c-k>".a:chars |
9 endfu | 9 endfu |
10 | 10 |
11 func! Put_Dig_BS(char1, char2) | 11 func Put_Dig_BS(char1, char2) |
12 exe "norm! o".a:char1."\<bs>".a:char2 | 12 exe "norm! o".a:char1."\<bs>".a:char2 |
13 endfu | 13 endfu |
14 | 14 |
15 func! Test_digraphs() | 15 func Test_digraphs() |
16 new | 16 new |
17 call Put_Dig("00") | 17 call Put_Dig("00") |
18 call assert_equal("∞", getline('.')) | 18 call assert_equal("∞", getline('.')) |
19 " not a digraph | 19 " not a digraph |
20 call Put_Dig("el") | 20 call Put_Dig("el") |
212 call Put_Dig("el") | 212 call Put_Dig("el") |
213 call assert_equal(['␀', 'ü', '∞', 'l'], getline(line('.')-3,line('.'))) | 213 call assert_equal(['␀', 'ü', '∞', 'l'], getline(line('.')-3,line('.'))) |
214 bw! | 214 bw! |
215 endfunc | 215 endfunc |
216 | 216 |
217 func! Test_digraphs_option() | 217 func Test_digraphs_option() |
218 " reset whichwrap option, so that testing <esc><bs>A works, | 218 " reset whichwrap option, so that testing <esc><bs>A works, |
219 " without moving up a line | 219 " without moving up a line |
220 set digraph ww= | 220 set digraph ww= |
221 new | 221 new |
222 call Put_Dig_BS("0","0") | 222 call Put_Dig_BS("0","0") |
418 call assert_equal(['␀', 'ü', '∞', 'l'], getline(line('.')-3,line('.'))) | 418 call assert_equal(['␀', 'ü', '∞', 'l'], getline(line('.')-3,line('.'))) |
419 set nodigraph ww&vim | 419 set nodigraph ww&vim |
420 bw! | 420 bw! |
421 endfunc | 421 endfunc |
422 | 422 |
423 func! Test_digraphs_output() | 423 func Test_digraphs_output() |
424 new | 424 new |
425 let out = execute(':digraph') | 425 let out = execute(':digraph') |
426 call assert_equal('Eu € 8364', matchstr(out, '\C\<Eu\D*8364\>')) | 426 call assert_equal('Eu € 8364', matchstr(out, '\C\<Eu\D*8364\>')) |
427 call assert_equal('=e € 8364', matchstr(out, '\C=e\D*8364\>')) | 427 call assert_equal('=e € 8364', matchstr(out, '\C=e\D*8364\>')) |
428 call assert_equal('=R ₽ 8381', matchstr(out, '\C=R\D*8381\>')) | 428 call assert_equal('=R ₽ 8381', matchstr(out, '\C=R\D*8381\>')) |
434 call assert_equal('u- ū 363', matchstr(out, '\C\<u-\D*363\>')) | 434 call assert_equal('u- ū 363', matchstr(out, '\C\<u-\D*363\>')) |
435 call assert_equal('SH ^A 1', matchstr(out, '\C\<SH\D*1\>')) | 435 call assert_equal('SH ^A 1', matchstr(out, '\C\<SH\D*1\>')) |
436 bw! | 436 bw! |
437 endfunc | 437 endfunc |
438 | 438 |
439 func! Test_loadkeymap() | 439 func Test_loadkeymap() |
440 if !has('keymap') | 440 if !has('keymap') |
441 return | 441 return |
442 endif | 442 endif |
443 new | 443 new |
444 set keymap=czech | 444 set keymap=czech |
448 " reset keymap and encoding option | 448 " reset keymap and encoding option |
449 set keymap= | 449 set keymap= |
450 bw! | 450 bw! |
451 endfunc | 451 endfunc |
452 | 452 |
453 func! Test_digraph_cmndline() | 453 func Test_digraph_cmndline() |
454 " Create digraph on commandline | 454 " Create digraph on commandline |
455 " This is a hack, to let Vim create the digraph in commandline mode | 455 " This is a hack, to let Vim create the digraph in commandline mode |
456 let s = '' | 456 let s = '' |
457 exe "sil! norm! :let s.='\<c-k>Eu'\<cr>" | 457 exe "sil! norm! :let s.='\<c-k>Eu'\<cr>" |
458 call assert_equal("€", s) | 458 call assert_equal("€", s) |
459 endfunc | 459 endfunc |
460 | 460 |
461 func Test_show_digraph() | |
462 new | |
463 call Put_Dig("e=") | |
464 call assert_equal("\n<е> 1077, Hex 0435, Oct 2065, Digr e=", execute('ascii')) | |
465 bwipe! | |
466 endfunc | |
467 | |
461 " vim: shiftwidth=2 sts=2 expandtab | 468 " vim: shiftwidth=2 sts=2 expandtab |