Patch 8.2.3243
Problem:    MS-Windows: the "edit with multiple Vim" choice is not that
            useful.
Solution:   Change it to "Edit with multiple tabs". (Michael Soyka,
            closes #8645)
Files:      src/GvimExt/gvimext.cpp, src/GvimExt/gvimext.h


*** ../vim-8.2.3242/src/GvimExt/gvimext.cpp     2020-11-18 15:30:04.856375372 
+0100
--- src/GvimExt/gvimext.cpp     2021-07-29 19:15:03.919623288 +0200
***************
*** 35,40 ****
--- 35,49 ----
   * enough */
  #define BUFSIZE 1100
  
+ // The "Edit with Vim" shell extension provides these choices when
+ // a new instance of Gvim is selected:
+ //   - use tabpages
+ //   - enable diff mode
+ //   - none of the above
+ #define EDIT_WITH_VIM_USE_TABPAGES (2)
+ #define EDIT_WITH_VIM_IN_DIFF_MODE (1)
+ #define EDIT_WITH_VIM_NO_OPTIONS   (0)
+ 
  //
  // Get the name of the Gvim executable to use, with the path.
  // When "runtime" is non-zero, we were called to find the runtime directory.
***************
*** 613,619 ****
      if (cbFiles > 1)
      {
        mii.wID = idCmd++;
!       mii.dwTypeData = _("Edit with &multiple Vims");
        mii.cch = lstrlen(mii.dwTypeData);
        InsertMenuItem(hMenu, indexMenu++, TRUE, &mii);
  
--- 622,628 ----
      if (cbFiles > 1)
      {
        mii.wID = idCmd++;
!       mii.dwTypeData = _("Edit with Vim using &tabpages");
        mii.cch = lstrlen(mii.dwTypeData);
        InsertMenuItem(hMenu, indexMenu++, TRUE, &mii);
  
***************
*** 726,731 ****
--- 735,741 ----
  STDMETHODIMP CShellExt::InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi)
  {
      HRESULT hr = E_INVALIDARG;
+     int gvimExtraOptions;
  
      // If HIWORD(lpcmi->lpVerb) then we have been called programmatically
      // and lpVerb is a command that should be invoked.  Otherwise, the shell
***************
*** 750,778 ****
            switch (idCmd)
            {
                case 0:
!                   hr = InvokeGvim(lpcmi->hwnd,
!                           lpcmi->lpDirectory,
!                           lpcmi->lpVerb,
!                           lpcmi->lpParameters,
!                           lpcmi->nShow);
                    break;
                case 1:
!                   hr = InvokeSingleGvim(lpcmi->hwnd,
!                           lpcmi->lpDirectory,
!                           lpcmi->lpVerb,
!                           lpcmi->lpParameters,
!                           lpcmi->nShow,
!                           0);
                    break;
                case 2:
!                   hr = InvokeSingleGvim(lpcmi->hwnd,
!                           lpcmi->lpDirectory,
!                           lpcmi->lpVerb,
!                           lpcmi->lpParameters,
!                           lpcmi->nShow,
!                           1);
                    break;
            }
        }
      }
      return hr;
--- 760,787 ----
            switch (idCmd)
            {
                case 0:
!                   gvimExtraOptions = EDIT_WITH_VIM_USE_TABPAGES;
                    break;
                case 1:
!                   gvimExtraOptions = EDIT_WITH_VIM_NO_OPTIONS;
                    break;
                case 2:
!                   gvimExtraOptions = EDIT_WITH_VIM_IN_DIFF_MODE;
                    break;
+               default:
+                   // If execution reaches this point we likely have an
+                   // inconsistency between the code that setup the menus
+                   // and this code that determines what the user
+                   // selected.  This should be detected and fixed during 
+                   // development.
+                   return E_FAIL;
            }
+           hr = InvokeSingleGvim(lpcmi->hwnd,
+                   lpcmi->lpDirectory,
+                   lpcmi->lpVerb,
+                   lpcmi->lpParameters,
+                   lpcmi->nShow,
+                   gvimExtraOptions);
        }
      }
      return hr;
***************
*** 873,954 ****
      return (char *)"";
  }
  
- STDMETHODIMP CShellExt::InvokeGvim(HWND hParent,
-                                  LPCSTR  /* pszWorkingDir */,
-                                  LPCSTR  /* pszCmd */,
-                                  LPCSTR  /* pszParam */,
-                                  int  /* iShowCmd */)
- {
-     wchar_t m_szFileUserClickedOn[BUFSIZE];
-     wchar_t cmdStrW[BUFSIZE];
-     UINT i;
- 
-     for (i = 0; i < cbFiles; i++)
-     {
-       DragQueryFileW((HDROP)medium.hGlobal,
-               i,
-               m_szFileUserClickedOn,
-               sizeof(m_szFileUserClickedOn));
- 
-       getGvimInvocationW(cmdStrW);
-       wcscat(cmdStrW, L" \"");
- 
-       if ((wcslen(cmdStrW) + wcslen(m_szFileUserClickedOn) + 2) < BUFSIZE)
-       {
-           wcscat(cmdStrW, m_szFileUserClickedOn);
-           wcscat(cmdStrW, L"\"");
- 
-           STARTUPINFOW si;
-           PROCESS_INFORMATION pi;
- 
-           ZeroMemory(&si, sizeof(si));
-           si.cb = sizeof(si);
- 
-           // Start the child process.
-           if (!CreateProcessW(NULL,   // No module name (use command line).
-                       cmdStrW,        // Command line.
-                       NULL,           // Process handle not inheritable.
-                       NULL,           // Thread handle not inheritable.
-                       FALSE,          // Set handle inheritance to FALSE.
-                       0,              // No creation flags.
-                       NULL,           // Use parent's environment block.
-                       NULL,           // Use parent's starting directory.
-                       &si,            // Pointer to STARTUPINFO structure.
-                       &pi)            // Pointer to PROCESS_INFORMATION 
structure.
-              )
-           {
-               MessageBox(
-                   hParent,
-                   _("Error creating process: Check if gvim is in your path!"),
-                   _("gvimext.dll error"),
-                   MB_OK);
-           }
-           else
-           {
-               CloseHandle( pi.hProcess );
-               CloseHandle( pi.hThread );
-           }
-       }
-       else
-       {
-           MessageBox(
-               hParent,
-               _("Path length too long!"),
-               _("gvimext.dll error"),
-               MB_OK);
-       }
-     }
- 
-     return NOERROR;
- }
- 
  
  STDMETHODIMP CShellExt::InvokeSingleGvim(HWND hParent,
                                   LPCSTR  /* pszWorkingDir */,
                                   LPCSTR  /* pszCmd */,
                                   LPCSTR  /* pszParam */,
                                   int  /* iShowCmd */,
!                                  int useDiff)
  {
      wchar_t   m_szFileUserClickedOn[BUFSIZE];
      wchar_t   *cmdStrW;
--- 882,894 ----
      return (char *)"";
  }
  
  
  STDMETHODIMP CShellExt::InvokeSingleGvim(HWND hParent,
                                   LPCSTR  /* pszWorkingDir */,
                                   LPCSTR  /* pszCmd */,
                                   LPCSTR  /* pszParam */,
                                   int  /* iShowCmd */,
!                                  int gvimExtraOptions)
  {
      wchar_t   m_szFileUserClickedOn[BUFSIZE];
      wchar_t   *cmdStrW;
***************
*** 962,969 ****
        return E_FAIL;
      getGvimInvocationW(cmdStrW);
  
!     if (useDiff)
        wcscat(cmdStrW, L" -d");
      for (i = 0; i < cbFiles; i++)
      {
        DragQueryFileW((HDROP)medium.hGlobal,
--- 902,911 ----
        return E_FAIL;
      getGvimInvocationW(cmdStrW);
  
!     if (gvimExtraOptions == EDIT_WITH_VIM_IN_DIFF_MODE)
        wcscat(cmdStrW, L" -d");
+     else if (gvimExtraOptions == EDIT_WITH_VIM_USE_TABPAGES)
+       wcscat(cmdStrW, L" -p");
      for (i = 0; i < cbFiles; i++)
      {
        DragQueryFileW((HDROP)medium.hGlobal,
*** ../vim-8.2.3242/src/GvimExt/gvimext.h       2019-09-13 22:01:33.000000000 
+0200
--- src/GvimExt/gvimext.h       2021-07-29 19:15:03.919623288 +0200
***************
*** 129,146 ****
            int iShowCmd,
            int idHWnd);
  
-     STDMETHODIMP InvokeGvim(HWND hParent,
-           LPCSTR pszWorkingDir,
-           LPCSTR pszCmd,
-           LPCSTR pszParam,
-           int iShowCmd);
- 
      STDMETHODIMP InvokeSingleGvim(HWND hParent,
            LPCSTR pszWorkingDir,
            LPCSTR pszCmd,
            LPCSTR pszParam,
            int iShowCmd,
!           int useDiff);
  
  public:
      int                m_cntOfHWnd;
--- 129,140 ----
            int iShowCmd,
            int idHWnd);
  
      STDMETHODIMP InvokeSingleGvim(HWND hParent,
            LPCSTR pszWorkingDir,
            LPCSTR pszCmd,
            LPCSTR pszParam,
            int iShowCmd,
!           int gvimExtraOptions);
  
  public:
      int                m_cntOfHWnd;
*** ../vim-8.2.3242/src/version.c       2021-07-28 22:44:05.121584173 +0200
--- src/version.c       2021-07-29 19:17:06.031366081 +0200
***************
*** 757,758 ****
--- 757,760 ----
  {   /* Add new patch number below this line */
+ /**/
+     3243,
  /**/

-- 
       In war we're tough and able.
       Quite indefatigable
       Between our quests
       We sequin vests
       And impersonate Clark Gable
       It's a busy life in Camelot.
       I have to push the pram a lot.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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/202107291719.16THJ0Ma2196887%40masaka.moolenaar.net.

Raspunde prin e-mail lui