Patch 8.2.0329
Problem: Popup filter converts 0x80 bytes.
Solution: Keep 0x80 bytes as-is. (Ozaki Kiichi, closes #5706)
Files: src/popupwin.c, src/testdir/test_popupwin.vim
*** ../vim-8.2.0328/src/popupwin.c 2020-02-28 22:19:38.314023342 +0100
--- src/popupwin.c 2020-02-28 22:39:31.770306734 +0100
***************
*** 2999,3005 ****
// Convert the number to a string, so that the function can use:
// if a:c == "\<F2>"
! buf[special_to_buf(c, mod_mask, TRUE, buf)] = NUL;
argv[1].v_type = VAR_STRING;
argv[1].vval.v_string = vim_strsave(buf);
--- 2999,3005 ----
// Convert the number to a string, so that the function can use:
// if a:c == "\<F2>"
! buf[special_to_buf(c, mod_mask, FALSE, buf)] = NUL;
argv[1].v_type = VAR_STRING;
argv[1].vval.v_string = vim_strsave(buf);
*** ../vim-8.2.0328/src/testdir/test_popupwin.vim 2020-02-11 21:44:08.248016555 +0100
--- src/testdir/test_popupwin.vim 2020-02-28 22:39:31.770306734 +0100
***************
*** 1409,1416 ****
call setline(1, 'some text')
func MyPopupFilter(winid, c)
! if a:c == 'e'
! let g:eaten = 'e'
return 1
endif
if a:c == '0'
--- 1409,1416 ----
call setline(1, 'some text')
func MyPopupFilter(winid, c)
! if a:c == 'e' || a:c == "\<F9>"
! let g:eaten = a:c
return 1
endif
if a:c == '0'
***************
*** 1430,1435 ****
--- 1430,1437 ----
" e is consumed by the filter
call feedkeys('e', 'xt')
call assert_equal('e', g:eaten)
+ call feedkeys("\<F9>", 'xt')
+ call assert_equal("\<F9>", g:eaten)
" 0 is ignored by the filter
normal $
***************
*** 1440,1446 ****
" x closes the popup
call feedkeys('x', 'xt')
! call assert_equal('e', g:eaten)
call assert_equal(-1, winbufnr(winid))
delfunc MyPopupFilter
--- 1442,1448 ----
" x closes the popup
call feedkeys('x', 'xt')
! call assert_equal("\<F9>", g:eaten)
call assert_equal(-1, winbufnr(winid))
delfunc MyPopupFilter
***************
*** 3271,3274 ****
--- 3273,3298 ----
bwipe!
endfunc
+ func Test_popupwin_filter_input_multibyte()
+ func MyPopupFilter(winid, c)
+ let g:bytes = range(a:c->strlen())->map({i -> char2nr(a:c[i])})
+ return 0
+ endfunc
+ let winid = popup_create('', #{mapping: 0, filter: 'MyPopupFilter'})
+
+ " UTF-8: E3 80 80, including K_SPECIAL(0x80)
+ call feedkeys("\u3000", 'xt')
+ call assert_equal([0xe3, 0x80, 0x80], g:bytes)
+
+ if has('gui')
+ " UTF-8: E3 80 9B, including CSI(0x9B)
+ call feedkeys("\u301b", 'xt')
+ call assert_equal([0xe3, 0x80, 0x9b], g:bytes)
+ endif
+
+ call popup_clear()
+ delfunc MyPopupFilter
+ unlet g:bytes
+ endfunc
+
" vim: shiftwidth=2 sts=2
*** ../vim-8.2.0328/src/version.c 2020-02-28 22:19:38.314023342 +0100
--- src/version.c 2020-02-28 22:44:28.093370032 +0100
***************
*** 740,741 ****
--- 740,743 ----
{ /* Add new patch number below this line */
+ /**/
+ 329,
/**/
--
hundred-and-one symptoms of being an internet addict:
131. You challenge authority and society by portnuking people
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language --
http://www.Zimbu.org ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///