summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-10-25 11:25:53 +0200
committerBram Moolenaar <Bram@vim.org>2018-10-25 11:25:53 +0200
commitbf9679ae4684cb0c4e6ef2c24da0f83955d53e57 (patch)
tree76298f0fa0c5318308079179792c96952e68d004
parent0fd6be77de6c1570bd320fc89ba82b7018ac29ae (diff)
downloadvim-git-8.1.0492.tar.gz
patch 8.1.0492: "Edit with existing Vim" list can get longv8.1.0492
Problem: "Edit with existing Vim" list can get long. Solution: Move the list to a submenu. (Ken Takata, closes #3561)
-rw-r--r--src/GvimExt/gvimext.cpp36
-rw-r--r--src/version.c2
2 files changed, 35 insertions, 3 deletions
diff --git a/src/GvimExt/gvimext.cpp b/src/GvimExt/gvimext.cpp
index 2b9f1ad8f..64c5d1339 100644
--- a/src/GvimExt/gvimext.cpp
+++ b/src/GvimExt/gvimext.cpp
@@ -708,11 +708,26 @@ STDMETHODIMP CShellExt::QueryContextMenu(HMENU hMenu,
m_edit_existing_off = 1;
}
+ HMENU hSubMenu = NULL;
+ if (m_cntOfHWnd > 1)
+ {
+ hSubMenu = CreatePopupMenu();
+ mii.fMask |= MIIM_SUBMENU;
+ mii.wID = idCmd;
+ mii.dwTypeData = _("Edit with existing Vim");
+ mii.cch = lstrlen(mii.dwTypeData);
+ mii.hSubMenu = hSubMenu;
+ InsertMenuItem(hMenu, indexMenu++, TRUE, &mii);
+ mii.fMask = mii.fMask & ~MIIM_SUBMENU;
+ mii.hSubMenu = NULL;
+ }
// Now display all the vim instances
for (int i = 0; i < m_cntOfHWnd; i++)
{
char title[BUFSIZE];
char temp[BUFSIZE];
+ int index;
+ HMENU hmenu;
// Obtain window title, continue if can not
if (GetWindowText(m_hWnd[i], title, BUFSIZE - 1) == 0)
@@ -726,15 +741,30 @@ STDMETHODIMP CShellExt::QueryContextMenu(HMENU hMenu,
*pos = 0;
}
// Now concatenate
- strncpy(temp, _("Edit with existing Vim - "), BUFSIZE - 1);
- temp[BUFSIZE - 1] = '\0';
+ if (m_cntOfHWnd > 1)
+ temp[0] = '\0';
+ else
+ {
+ strncpy(temp, _("Edit with existing Vim - "), BUFSIZE - 1);
+ temp[BUFSIZE - 1] = '\0';
+ }
strncat(temp, title, BUFSIZE - 1 - strlen(temp));
temp[BUFSIZE - 1] = '\0';
mii.wID = idCmd++;
mii.dwTypeData = temp;
mii.cch = lstrlen(mii.dwTypeData);
- InsertMenuItem(hMenu, indexMenu++, TRUE, &mii);
+ if (m_cntOfHWnd > 1)
+ {
+ hmenu = hSubMenu;
+ index = i;
+ }
+ else
+ {
+ hmenu = hMenu;
+ index = indexMenu++;
+ }
+ InsertMenuItem(hmenu, index, TRUE, &mii);
}
// InsertMenu(hMenu, indexMenu++, MF_SEPARATOR|MF_BYPOSITION, 0, NULL);
diff --git a/src/version.c b/src/version.c
index ad9b575d0..9283cc2fd 100644
--- a/src/version.c
+++ b/src/version.c
@@ -793,6 +793,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 492,
+/**/
491,
/**/
490,