To: vim-dev@vim.org Subject: Patch 6.1.149 (extra) Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1.149 (extra) Problem: MS-Windows: Can't use diff mode from the file explorer. Solution: Add a "diff with Vim" context menu entry. (Dan Sharp) Files: GvimExt/gvimext.cpp, GvimExt/gvimext.h *** ../vim61.148/GvimExt/gvimext.cpp Thu Mar 14 19:26:04 2002 --- GvimExt/gvimext.cpp Sun Aug 4 21:23:55 2002 *************** *** 591,598 **** idCmd++, _("Edit with single &Vim")); ! // set flag ! m_multiFiles = TRUE; } else --- 591,608 ---- idCmd++, _("Edit with single &Vim")); ! if (cbFiles <= 4) ! { ! // Can edit up to 4 files in diff mode ! InsertMenu(hMenu, ! indexMenu++, ! MF_STRING|MF_BYPOSITION, ! idCmd++, ! _("&Diff with Vim")); ! m_edit_existing_off = 3; ! } ! else ! m_edit_existing_off = 2; } else *************** *** 602,610 **** MF_STRING|MF_BYPOSITION, idCmd++, _("Edit with &Vim")); ! ! // set flag ! m_multiFiles = FALSE; } // Now display all the vim instances --- 612,618 ---- MF_STRING|MF_BYPOSITION, idCmd++, _("Edit with &Vim")); ! m_edit_existing_off = 1; } // Now display all the vim instances *************** *** 666,672 **** { UINT idCmd = LOWORD(lpcmi->lpVerb); ! if (m_multiFiles == TRUE) { switch (idCmd) { --- 674,690 ---- { UINT idCmd = LOWORD(lpcmi->lpVerb); ! if (idCmd >= m_edit_existing_off) ! { ! // Existing with vim instance ! hr = PushToWindow(lpcmi->hwnd, ! lpcmi->lpDirectory, ! lpcmi->lpVerb, ! lpcmi->lpParameters, ! lpcmi->nShow, ! idCmd - m_edit_existing_off); ! } ! else { switch (idCmd) { *************** *** 682,718 **** lpcmi->lpDirectory, lpcmi->lpVerb, lpcmi->lpParameters, - lpcmi->nShow); - break; - default: - // Existing vim instance - hr = PushToWindow(lpcmi->hwnd, - lpcmi->lpDirectory, - lpcmi->lpVerb, - lpcmi->lpParameters, lpcmi->nShow, ! idCmd - 2); ! break; ! } ! } ! else{ ! switch (idCmd) ! { ! case 0: ! hr = InvokeGvim(lpcmi->hwnd, ! lpcmi->lpDirectory, ! lpcmi->lpVerb, ! lpcmi->lpParameters, ! lpcmi->nShow); break; ! default: ! // Existing vim instance ! hr = PushToWindow(lpcmi->hwnd, lpcmi->lpDirectory, lpcmi->lpVerb, lpcmi->lpParameters, lpcmi->nShow, ! idCmd - 1); break; } } --- 700,715 ---- lpcmi->lpDirectory, lpcmi->lpVerb, lpcmi->lpParameters, lpcmi->nShow, ! false); break; ! case 2: ! hr = InvokeSingleGvim(lpcmi->hwnd, lpcmi->lpDirectory, lpcmi->lpVerb, lpcmi->lpParameters, lpcmi->nShow, ! true); break; } } *************** *** 916,922 **** LPCSTR pszWorkingDir, LPCSTR pszCmd, LPCSTR pszParam, ! int iShowCmd) { char m_szFileUserClickedOn[MAX_PATH]; char *cmdStr; --- 913,920 ---- LPCSTR pszWorkingDir, LPCSTR pszCmd, LPCSTR pszParam, ! int iShowCmd, ! bool useDiff) { char m_szFileUserClickedOn[MAX_PATH]; char *cmdStr; *************** *** 927,932 **** --- 925,932 ---- cmdlen = MAX_PATH; cmdStr = (char *)malloc(cmdlen); getGvimName(cmdStr, 0); + if (useDiff) + strcat(cmdStr, " -d"); for (i = 0; i < cbFiles; i++) { DragQueryFile((HDROP)medium.hGlobal, *** ../vim61.148/GvimExt/gvimext.h Sat Aug 19 12:30:34 2000 --- GvimExt/gvimext.h Sun Aug 4 21:28:22 2002 *************** *** 101,107 **** protected: ULONG m_cRef; LPDATAOBJECT m_pDataObj; ! BOOLEAN m_multiFiles; // For some reason, this callback must be static static BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam); --- 101,107 ---- protected: ULONG m_cRef; LPDATAOBJECT m_pDataObj; ! UINT m_edit_existing_off; // For some reason, this callback must be static static BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam); *************** *** 123,129 **** LPCSTR pszWorkingDir, LPCSTR pszCmd, LPCSTR pszParam, ! int iShowCmd); public: int m_cntOfHWnd; --- 123,130 ---- LPCSTR pszWorkingDir, LPCSTR pszCmd, LPCSTR pszParam, ! int iShowCmd, ! bool useDiff); public: int m_cntOfHWnd; *** ../vim61.148/src/version.c Sun Aug 4 21:03:47 2002 --- src/version.c Sun Aug 4 21:36:52 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 149, /**/ -- From "know your smileys": :-* A big kiss! /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ /// Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim \\\ \\\ Project leader for A-A-P -- http://www.a-a-p.org /// \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///