Patch 8.2.4824
Problem:    Expression is evaluated multiple times.
Solution:   Evaluate expression once and store the result. (closes #10278)
Files:      src/map.c


*** ../vim-8.2.4823/src/map.c   2022-04-24 18:40:20.791116268 +0100
--- src/map.c   2022-04-25 13:27:30.357053425 +0100
***************
*** 508,513 ****
--- 508,514 ----
      {
        int     did_it = FALSE;
        int     did_local = FALSE;
+       int     keyround1_simplfied = keyround == 1 && did_simplify;
        int     round;
        int     hash;
        int     new_hash;
***************
*** 725,732 ****
                                    mpp = &(mp->m_next);
                                    continue;
                                }
!                               if (did_simplify && keyround == 1
!                                                         && !mp->m_simplified)
                                    break;
                                // We reset the indicated mode bits. If nothing
                                // is left the entry is deleted below.
--- 726,732 ----
                                    mpp = &(mp->m_next);
                                    continue;
                                }
!                               if (keyround1_simplfied && !mp->m_simplified)
                                    break;
                                // We reset the indicated mode bits. If nothing
                                // is left the entry is deleted below.
***************
*** 779,786 ****
                                    mp->m_nowait = nowait;
                                    mp->m_silent = silent;
                                    mp->m_mode = mode;
!                                   mp->m_simplified =
!                                                did_simplify && keyround == 1;
  #ifdef FEAT_EVAL
                                    mp->m_expr = expr;
                                    mp->m_script_ctx = current_sctx;
--- 779,785 ----
                                    mp->m_nowait = nowait;
                                    mp->m_silent = silent;
                                    mp->m_mode = mode;
!                                   mp->m_simplified = keyround1_simplfied;
  #ifdef FEAT_EVAL
                                    mp->m_expr = expr;
                                    mp->m_script_ctx = current_sctx;
***************
*** 818,824 ****
            // delete entry
            if (!did_it)
            {
!               if (!did_simplify || keyround == 2)
                    retval = 2;         // no match
            }
            else if (*keys == Ctrl_C)
--- 817,823 ----
            // delete entry
            if (!did_it)
            {
!               if (!keyround1_simplfied)
                    retval = 2;         // no match
            }
            else if (*keys == Ctrl_C)
***************
*** 854,860 ****
  #ifdef FEAT_EVAL
                    expr, /* sid */ -1, /* scriptversion */ 0, /* lnum */ 0,
  #endif
!                   did_simplify && keyround == 1) == FAIL)
        {
            retval = 4;     // no mem
            goto theend;
--- 853,859 ----
  #ifdef FEAT_EVAL
                    expr, /* sid */ -1, /* scriptversion */ 0, /* lnum */ 0,
  #endif
!                   keyround1_simplfied) == FAIL)
        {
            retval = 4;     // no mem
            goto theend;
*** ../vim-8.2.4823/src/version.c       2022-04-25 12:43:15.179819208 +0100
--- src/version.c       2022-04-25 13:26:19.909107985 +0100
***************
*** 748,749 ****
--- 748,751 ----
  {   /* Add new patch number below this line */
+ /**/
+     4824,
  /**/

-- 
There is a difference between "should work" and "does work",
it's called testing.

 /// 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/20220425122855.73DC91C410D%40moolenaar.net.

Raspunde prin e-mail lui