Patch 8.2.3462
Problem: The ModeChanged event only uses one character for the new_mode and
old_mode values.
Solution: Pass one as first argument to mode(). (issue #8856)
Files: src/misc1.c, src/testdir/test_edit.vim
*** ../vim-8.2.3461/src/misc1.c 2021-10-02 16:34:51.110830402 +0100
--- src/misc1.c 2021-10-02 16:40:49.528995965 +0100
***************
*** 2657,2663 ****
#if defined(FEAT_EVAL) || defined(PROTO)
dict_T *v_event;
typval_T rettv;
! typval_T tv;
char_u *pat_pre;
char_u *pat;
--- 2657,2663 ----
#if defined(FEAT_EVAL) || defined(PROTO)
dict_T *v_event;
typval_T rettv;
! typval_T tv[2];
char_u *pat_pre;
char_u *pat;
***************
*** 2666,2673 ****
v_event = get_vim_var_dict(VV_EVENT);
! tv.v_type = VAR_UNKNOWN;
! f_mode(&tv, &rettv);
(void)dict_add_string(v_event, "new_mode", rettv.vval.v_string);
(void)dict_add_string(v_event, "old_mode", last_mode);
dict_set_items_ro(v_event);
--- 2666,2675 ----
v_event = get_vim_var_dict(VV_EVENT);
! tv[0].v_type = VAR_NUMBER;
! tv[0].vval.v_number = 1; // get full mode
! tv[1].v_type = VAR_UNKNOWN;
! f_mode(tv, &rettv);
(void)dict_add_string(v_event, "new_mode", rettv.vval.v_string);
(void)dict_add_string(v_event, "old_mode", last_mode);
dict_set_items_ro(v_event);
*** ../vim-8.2.3461/src/testdir/test_edit.vim 2021-09-12 12:39:04.323467415
+0100
--- src/testdir/test_edit.vim 2021-10-02 16:54:44.240270873 +0100
***************
*** 1918,1924 ****
func! TestMode()
call assert_equal(g:mode_seq[g:index], get(v:event, "old_mode"))
call assert_equal(g:mode_seq[g:index + 1], get(v:event, "new_mode"))
! call assert_equal(mode(), get(v:event, "new_mode"))
let g:index += 1
endfunc
--- 1918,1924 ----
func! TestMode()
call assert_equal(g:mode_seq[g:index], get(v:event, "old_mode"))
call assert_equal(g:mode_seq[g:index + 1], get(v:event, "new_mode"))
! call assert_equal(mode(1), get(v:event, "new_mode"))
let g:index += 1
endfunc
***************
*** 1930,1936 ****
--- 1930,1940 ----
au ModeChanged V:v :call DoIt()
call feedkeys("Vv\<esc>", 'tnix')
call assert_equal(4, g:count)
+ call assert_equal(len(g:mode_seq) - 1, g:index)
+ let g:index = 0
+ let g:mode_seq = ['n', 'i', 'niI', 'i', 'n']
+ call feedkeys("a\<C-O>l\<esc>", 'tnix')
call assert_equal(len(g:mode_seq) - 1, g:index)
au! ModeChanged
*** ../vim-8.2.3461/src/version.c 2021-10-02 16:34:51.114830494 +0100
--- src/version.c 2021-10-02 16:55:09.024915240 +0100
***************
*** 759,760 ****
--- 759,762 ----
{ /* Add new patch number below this line */
+ /**/
+ 3462,
/**/
--
Do not trust atoms, they make up everything.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20211002160618.B45DCC80053%40pakwach.