Patch 9.0.1333
Problem:    When redo'ing twice <ScriptCmd> may not get the script ID.
Solution:   When "last_used_map" map is not set use "last_used_sid".
            (closes #11930)
Files:      src/getchar.c


*** ../vim-9.0.1332/src/getchar.c       2023-02-05 18:00:38.353400148 +0000
--- src/getchar.c       2023-02-20 18:44:23.402928070 +0000
***************
*** 3974,3996 ****
  
  #if defined(FEAT_EVAL) || defined(PROTO)
  /*
!  * If there was a mapping put info about it in the redo buffer, so that "."
!  * will use the same script context.  We only need the SID.
   */
      void
  may_add_last_used_map_to_redobuff(void)
  {
!     char_u buf[3 + 20];
  
!     if (last_used_map == NULL || last_used_map->m_script_ctx.sc_sid < 0)
        return;
  
      // <K_SID>{nr};
      buf[0] = K_SPECIAL;
      buf[1] = KS_EXTRA;
      buf[2] = KE_SID;
!     vim_snprintf((char *)buf + 3, 20, "%d;",
!                                          last_used_map->m_script_ctx.sc_sid);
      add_buff(&redobuff, buf, -1L);
  }
  #endif
--- 3974,4003 ----
  
  #if defined(FEAT_EVAL) || defined(PROTO)
  /*
!  * If there was a mapping we get its SID.  Otherwise, use "last_used_sid", it
!  * is set when redo'ing.
!  * Put this SID in the redo buffer, so that "." will use the same script
!  * context.
   */
      void
  may_add_last_used_map_to_redobuff(void)
  {
!     char_u  buf[3 + 20];
!     int           sid = -1;
  
!     if (last_used_map != NULL)
!       sid = last_used_map->m_script_ctx.sc_sid;
!     if (sid < 0)
!       sid = last_used_sid;
! 
!     if (sid < 0)
        return;
  
      // <K_SID>{nr};
      buf[0] = K_SPECIAL;
      buf[1] = KS_EXTRA;
      buf[2] = KE_SID;
!     vim_snprintf((char *)buf + 3, 20, "%d;", sid);
      add_buff(&redobuff, buf, -1L);
  }
  #endif
*** ../vim-9.0.1332/src/version.c       2023-02-20 15:25:09.868734406 +0000
--- src/version.c       2023-02-20 18:38:14.492284652 +0000
***************
*** 697,698 ****
--- 697,700 ----
  {   /* Add new patch number below this line */
+ /**/
+     1333,
  /**/

-- 
Two sheep in a meadow.  One says "baaah".  The other says "exactly!".

 /// 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/20230220184459.677641C07A0%40moolenaar.net.

Raspunde prin e-mail lui