Mercurial > vim
comparison src/testdir/test_popupwin.vim @ 19544:167181848770 v8.2.0329
patch 8.2.0329: popup filter converts 0x80 bytes
Commit: https://github.com/vim/vim/commit/ec084d3356cc2a23f2f44707810c38ab590d2e66
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Feb 28 22:44:47 2020 +0100
patch 8.2.0329: popup filter converts 0x80 bytes
Problem: Popup filter converts 0x80 bytes.
Solution: Keep 0x80 bytes as-is. (Ozaki Kiichi, closes https://github.com/vim/vim/issues/5706)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 28 Feb 2020 22:45:08 +0100 |
parents | fcd5a2acbb3d |
children | 5eb0ead1415f |
comparison
equal
deleted
inserted
replaced
19543:86f834bd45fc | 19544:167181848770 |
---|---|
1407 func Test_popup_filter() | 1407 func Test_popup_filter() |
1408 new | 1408 new |
1409 call setline(1, 'some text') | 1409 call setline(1, 'some text') |
1410 | 1410 |
1411 func MyPopupFilter(winid, c) | 1411 func MyPopupFilter(winid, c) |
1412 if a:c == 'e' | 1412 if a:c == 'e' || a:c == "\<F9>" |
1413 let g:eaten = 'e' | 1413 let g:eaten = a:c |
1414 return 1 | 1414 return 1 |
1415 endif | 1415 endif |
1416 if a:c == '0' | 1416 if a:c == '0' |
1417 let g:ignored = '0' | 1417 let g:ignored = '0' |
1418 return 0 | 1418 return 0 |
1428 redraw | 1428 redraw |
1429 | 1429 |
1430 " e is consumed by the filter | 1430 " e is consumed by the filter |
1431 call feedkeys('e', 'xt') | 1431 call feedkeys('e', 'xt') |
1432 call assert_equal('e', g:eaten) | 1432 call assert_equal('e', g:eaten) |
1433 call feedkeys("\<F9>", 'xt') | |
1434 call assert_equal("\<F9>", g:eaten) | |
1433 | 1435 |
1434 " 0 is ignored by the filter | 1436 " 0 is ignored by the filter |
1435 normal $ | 1437 normal $ |
1436 call assert_equal(9, getcurpos()[2]) | 1438 call assert_equal(9, getcurpos()[2]) |
1437 call feedkeys('0', 'xt') | 1439 call feedkeys('0', 'xt') |
1438 call assert_equal('0', g:ignored) | 1440 call assert_equal('0', g:ignored) |
1439 call assert_equal(1, getcurpos()[2]) | 1441 call assert_equal(1, getcurpos()[2]) |
1440 | 1442 |
1441 " x closes the popup | 1443 " x closes the popup |
1442 call feedkeys('x', 'xt') | 1444 call feedkeys('x', 'xt') |
1443 call assert_equal('e', g:eaten) | 1445 call assert_equal("\<F9>", g:eaten) |
1444 call assert_equal(-1, winbufnr(winid)) | 1446 call assert_equal(-1, winbufnr(winid)) |
1445 | 1447 |
1446 delfunc MyPopupFilter | 1448 delfunc MyPopupFilter |
1447 call popup_clear() | 1449 call popup_clear() |
1448 endfunc | 1450 endfunc |
3269 | 3271 |
3270 call popup_clear() | 3272 call popup_clear() |
3271 bwipe! | 3273 bwipe! |
3272 endfunc | 3274 endfunc |
3273 | 3275 |
3276 func Test_popupwin_filter_input_multibyte() | |
3277 func MyPopupFilter(winid, c) | |
3278 let g:bytes = range(a:c->strlen())->map({i -> char2nr(a:c[i])}) | |
3279 return 0 | |
3280 endfunc | |
3281 let winid = popup_create('', #{mapping: 0, filter: 'MyPopupFilter'}) | |
3282 | |
3283 " UTF-8: E3 80 80, including K_SPECIAL(0x80) | |
3284 call feedkeys("\u3000", 'xt') | |
3285 call assert_equal([0xe3, 0x80, 0x80], g:bytes) | |
3286 | |
3287 if has('gui') | |
3288 " UTF-8: E3 80 9B, including CSI(0x9B) | |
3289 call feedkeys("\u301b", 'xt') | |
3290 call assert_equal([0xe3, 0x80, 0x9b], g:bytes) | |
3291 endif | |
3292 | |
3293 call popup_clear() | |
3294 delfunc MyPopupFilter | |
3295 unlet g:bytes | |
3296 endfunc | |
3297 | |
3274 " vim: shiftwidth=2 sts=2 | 3298 " vim: shiftwidth=2 sts=2 |