Patch 8.1.2082
Problem: Some files have a weird name to fit in 8.3 characters.
Solution: Use a nicer names.
Files: Filelist, Makefile, src/popupmnu.c, src/popupmenu.c,
src/proto/popupmnu.pro, src/proto/popupmenu.pro,
src/Make_cyg_ming.mak, src/Make_morph.mak, src/Make_mvc.mak,
src/Make_vms.mms, src/Makefile, src/proto.h, src/README.md,
src/uninstal.c, src/uninstall.c, uninstal.txt, uninstall.txt,
nsis/gvim.nsi, src/INSTALLpc.txt, src/dosinst.c, src/dosinst.h
*** ../vim-8.1.2081/Filelist 2019-09-27 12:41:35.007573135 +0200
--- Filelist 2019-09-27 12:56:36.105532072 +0200
***************
*** 92,98 ****
src/option.h \
src/optiondefs.h \
src/optionstr.c \
! src/popupmnu.c \
src/popupwin.c \
src/profiler.c \
src/quickfix.c \
--- 92,98 ----
src/option.h \
src/optiondefs.h \
src/optionstr.c \
! src/popupmenu.c \
src/popupwin.c \
src/profiler.c \
src/quickfix.c \
***************
*** 241,247 ****
src/proto/ops.pro \
src/proto/option.pro \
src/proto/optionstr.pro \
! src/proto/popupmnu.pro \
src/proto/popupwin.pro \
src/proto/profiler.pro \
src/proto/quickfix.pro \
--- 241,247 ----
src/proto/ops.pro \
src/proto/option.pro \
src/proto/optionstr.pro \
! src/proto/popupmenu.pro \
src/proto/popupwin.pro \
src/proto/profiler.pro \
src/proto/quickfix.pro \
***************
*** 517,523 ****
src/testdir/Make_dos.mak \
src/testdir/Make_ming.mak \
src/testdir/dos.vim \
! src/uninstal.c \
src/vim.def \
src/vim.rc \
src/vimio.h \
--- 517,523 ----
src/testdir/Make_dos.mak \
src/testdir/Make_ming.mak \
src/testdir/dos.vim \
! src/uninstall.c \
src/vim.def \
src/vim.rc \
src/vimio.h \
***************
*** 532,538 ****
nsis/gvim_version.nsh \
nsis/README.txt \
nsis/lang/*.nsi \
! uninstal.txt \
src/VisVim/Commands.cpp \
src/VisVim/Commands.h \
src/VisVim/DSAddIn.cpp \
--- 532,538 ----
nsis/gvim_version.nsh \
nsis/README.txt \
nsis/lang/*.nsi \
! uninstall.txt \
src/VisVim/Commands.cpp \
src/VisVim/Commands.h \
src/VisVim/DSAddIn.cpp \
***************
*** 852,858 ****
# files for DOS binary (also in extra archive)
BIN_DOS = \
README_bindos.txt \
! uninstal.txt \
# files for Win32 OLE binary (also in extra archive)
BIN_OLE = \
--- 852,858 ----
# files for DOS binary (also in extra archive)
BIN_DOS = \
README_bindos.txt \
! uninstall.txt \
# files for Win32 OLE binary (also in extra archive)
BIN_OLE = \
*** ../vim-8.1.2081/Makefile 2019-04-27 17:57:28.079905467 +0200
--- Makefile 2019-09-27 12:59:32.192548655 +0200
***************
*** 165,171 ****
# xxd/xxd.exe to xxdw32.exe
# vim.pdb to vimw32.pdb
# install.exe to installw32.exe
! # uninstal.exe to uninstalw32.exe
# Win32 GUI version build:
# - > cd src
# > nmake -f Make_mvc.mak GUI=yes
--- 165,171 ----
# xxd/xxd.exe to xxdw32.exe
# vim.pdb to vimw32.pdb
# install.exe to installw32.exe
! # uninstall.exe to uninstallw32.exe
# Win32 GUI version build:
# - > cd src
# > nmake -f Make_mvc.mak GUI=yes
***************
*** 175,181 ****
# - move "gvim.exe" to here (otherwise the OLE version will overwrite it).
# - Move gvim.pdb to here.
# - Copy "GvimExt/gvimext.dll" to here.
! # - Delete vimrun.exe, install.exe and uninstal.exe.
# Win32 GUI version with OLE, PERL, Ruby, TCL, PYTHON and dynamic IME:
# - Install the interfaces you want, see src/INSTALLpc.txt
# Adjust bigvim.bat to match the version of each interface you want.
--- 175,181 ----
# - move "gvim.exe" to here (otherwise the OLE version will overwrite it).
# - Move gvim.pdb to here.
# - Copy "GvimExt/gvimext.dll" to here.
! # - Delete vimrun.exe, install.exe and uninstall.exe.
# Win32 GUI version with OLE, PERL, Ruby, TCL, PYTHON and dynamic IME:
# - Install the interfaces you want, see src/INSTALLpc.txt
# Adjust bigvim.bat to match the version of each interface you want.
***************
*** 188,194 ****
# - check the output.
# - Rename "gvim.exe" to "gvim_ole.exe".
# - Rename gvim.pdb to "gvim_ole.pdb".
! # - Delete install.exe and uninstal.exe.
# Create the archives:
# - Copy all the "*.exe" files to where this Makefile is.
# - Copy all the "*.pdb" files to where this Makefile is.
--- 188,194 ----
# - check the output.
# - Rename "gvim.exe" to "gvim_ole.exe".
# - Rename gvim.pdb to "gvim_ole.pdb".
! # - Delete install.exe and uninstall.exe.
# Create the archives:
# - Copy all the "*.exe" files to where this Makefile is.
# - Copy all the "*.pdb" files to where this Makefile is.
***************
*** 197,203 ****
# NSIS self installing exe:
# - To get NSIS see http://nsis.sourceforge.net
# - Make sure gvim_ole.exe, vimw32.exe, installw32.exe,
! # uninstalw32.exe, teew32.exe and xxdw32.exe have been build as mentioned
# above.
# - copy these files (get them from a binary archive or build them):
# gvimext.dll in src/GvimExt
--- 197,203 ----
# NSIS self installing exe:
# - To get NSIS see http://nsis.sourceforge.net
# - Make sure gvim_ole.exe, vimw32.exe, installw32.exe,
! # uninstallw32.exe, teew32.exe and xxdw32.exe have been build as mentioned
# above.
# - copy these files (get them from a binary archive or build them):
# gvimext.dll in src/GvimExt
***************
*** 518,524 ****
cp xxdw32.exe dist/vim/$(VIMRTDIR)/xxd.exe
cp vimrun.exe dist/vim/$(VIMRTDIR)/vimrun.exe
cp installw32.exe dist/vim/$(VIMRTDIR)/install.exe
! cp uninstalw32.exe dist/vim/$(VIMRTDIR)/uninstal.exe
mkdir dist/vim/$(VIMRTDIR)/GvimExt32
cp gvimext.dll dist/vim/$(VIMRTDIR)/GvimExt32/gvimext.dll
mkdir dist/vim/$(VIMRTDIR)/GvimExt64
--- 518,524 ----
cp xxdw32.exe dist/vim/$(VIMRTDIR)/xxd.exe
cp vimrun.exe dist/vim/$(VIMRTDIR)/vimrun.exe
cp installw32.exe dist/vim/$(VIMRTDIR)/install.exe
! cp uninstallw32.exe dist/vim/$(VIMRTDIR)/uninstall.exe
mkdir dist/vim/$(VIMRTDIR)/GvimExt32
cp gvimext.dll dist/vim/$(VIMRTDIR)/GvimExt32/gvimext.dll
mkdir dist/vim/$(VIMRTDIR)/GvimExt64
***************
*** 539,545 ****
cp teew32.exe dist/vim/$(VIMRTDIR)/tee.exe
cp xxdw32.exe dist/vim/$(VIMRTDIR)/xxd.exe
cp installw32.exe dist/vim/$(VIMRTDIR)/install.exe
! cp uninstalw32.exe dist/vim/$(VIMRTDIR)/uninstal.exe
cd dist && zip -9 -rD -z vim$(VERSION)w32.zip vim <$(COMMENT_W32)
cp vimw32.pdb dist/vim$(VERSION)w32.pdb
--- 539,545 ----
cp teew32.exe dist/vim/$(VIMRTDIR)/tee.exe
cp xxdw32.exe dist/vim/$(VIMRTDIR)/xxd.exe
cp installw32.exe dist/vim/$(VIMRTDIR)/install.exe
! cp uninstallw32.exe dist/vim/$(VIMRTDIR)/uninstall.exe
cd dist && zip -9 -rD -z vim$(VERSION)w32.zip vim <$(COMMENT_W32)
cp vimw32.pdb dist/vim$(VERSION)w32.pdb
***************
*** 557,563 ****
cp xxdw32.exe dist/vim/$(VIMRTDIR)/xxd.exe
cp vimrun.exe dist/vim/$(VIMRTDIR)/vimrun.exe
cp installw32.exe dist/vim/$(VIMRTDIR)/install.exe
! cp uninstalw32.exe dist/vim/$(VIMRTDIR)/uninstal.exe
cp gvimext.dll dist/vim/$(VIMRTDIR)/gvimext.dll
cp README_ole.txt dist/vim/$(VIMRTDIR)
cp src/VisVim/VisVim.dll dist/vim/$(VIMRTDIR)/VisVim.dll
--- 557,563 ----
cp xxdw32.exe dist/vim/$(VIMRTDIR)/xxd.exe
cp vimrun.exe dist/vim/$(VIMRTDIR)/vimrun.exe
cp installw32.exe dist/vim/$(VIMRTDIR)/install.exe
! cp uninstallw32.exe dist/vim/$(VIMRTDIR)/uninstall.exe
cp gvimext.dll dist/vim/$(VIMRTDIR)/gvimext.dll
cp README_ole.txt dist/vim/$(VIMRTDIR)
cp src/VisVim/VisVim.dll dist/vim/$(VIMRTDIR)/VisVim.dll
*** ../vim-8.1.2081/src/popupmnu.c 2019-09-03 23:20:00.929446231 +0200
--- src/popupmnu.c 1970-01-01 01:00:00.000000000 +0100
***************
*** 1,1489 ****
- /* vi:set ts=8 sts=4 sw=4 noet:
- *
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.txt for an overview of the Vim source code.
- */
-
- /*
- * popupmnu.c: Popup menu (PUM)
- */
- #include "vim.h"
-
- static pumitem_T *pum_array = NULL; /* items of displayed pum */
- static int pum_size; /* nr of items in "pum_array" */
- static int pum_selected; /* index of selected item or -1 */
- static int pum_first = 0; /* index of top item */
-
- static int call_update_screen = FALSE;
-
- static int pum_height; /* nr of displayed pum items */
- static int pum_width; /* width of displayed pum items */
- static int pum_base_width; /* width of pum items base */
- static int pum_kind_width; /* width of pum items kind column */
- static int pum_extra_width; /* width of extra stuff */
- static int pum_scrollbar; /* TRUE when scrollbar present */
-
- static int pum_row; /* top row of pum */
- static int pum_col; /* left column of pum */
-
- static win_T *pum_window = NULL;
- static int pum_win_row;
- static int pum_win_height;
- static int pum_win_col;
- static int pum_win_wcol;
- static int pum_win_width;
-
- static int pum_do_redraw = FALSE; // do redraw anyway
- static int pum_skip_redraw = FALSE; // skip redraw
-
- static int pum_set_selected(int n, int repeat);
-
- #define PUM_DEF_HEIGHT 10
-
- static void
- pum_compute_size(void)
- {
- int i;
- int w;
-
- /* Compute the width of the widest match and the widest extra. */
- pum_base_width = 0;
- pum_kind_width = 0;
- pum_extra_width = 0;
- for (i = 0; i < pum_size; ++i)
- {
- w = vim_strsize(pum_array[i].pum_text);
- if (pum_base_width < w)
- pum_base_width = w;
- if (pum_array[i].pum_kind != NULL)
- {
- w = vim_strsize(pum_array[i].pum_kind) + 1;
- if (pum_kind_width < w)
- pum_kind_width = w;
- }
- if (pum_array[i].pum_extra != NULL)
- {
- w = vim_strsize(pum_array[i].pum_extra) + 1;
- if (pum_extra_width < w)
- pum_extra_width = w;
- }
- }
- }
-
- /*
- * Show the popup menu with items "array[size]".
- * "array" must remain valid until pum_undisplay() is called!
- * When possible the leftmost character is aligned with cursor column.
- * The menu appears above the screen line "row" or at "row" + "height" - 1.
- */
- void
- pum_display(
- pumitem_T *array,
- int size,
- int selected) /* index of initially selected item,
none if
- out of range */
- {
- int def_width;
- int max_width;
- int context_lines;
- int cursor_col;
- int above_row;
- int below_row;
- int redo_count = 0;
- #if defined(FEAT_QUICKFIX)
- win_T *pvwin;
- #endif
-
- do
- {
- def_width = p_pw;
- above_row = 0;
- below_row = cmdline_row;
-
- /* Pretend the pum is already there to avoid that must_redraw is set
- * when 'cuc' is on. */
- pum_array = (pumitem_T *)1;
- validate_cursor_col();
- pum_array = NULL;
-
- // Remember the essential parts of the window position and size, so we
- // can decide when to reposition the popup menu.
- pum_window = curwin;
- pum_win_row = curwin->w_wrow + W_WINROW(curwin);
- pum_win_height = curwin->w_height;
- pum_win_col = curwin->w_wincol;
- pum_win_wcol = curwin->w_wcol;
- pum_win_width = curwin->w_width;
-
- #if defined(FEAT_QUICKFIX)
- FOR_ALL_WINDOWS(pvwin)
- if (pvwin->w_p_pvw)
- break;
- if (pvwin != NULL)
- {
- if (W_WINROW(pvwin) < W_WINROW(curwin))
- above_row = W_WINROW(pvwin) + pvwin->w_height;
- else if (W_WINROW(pvwin) > W_WINROW(curwin) + curwin->w_height)
- below_row = W_WINROW(pvwin);
- }
- #endif
-
- /*
- * Figure out the size and position of the pum.
- */
- if (size < PUM_DEF_HEIGHT)
- pum_height = size;
- else
- pum_height = PUM_DEF_HEIGHT;
- if (p_ph > 0 && pum_height > p_ph)
- pum_height = p_ph;
-
- /* Put the pum below "pum_win_row" if possible. If there are few lines
- * decide on where there is more room. */
- if (pum_win_row + 2 >= below_row - pum_height
- && pum_win_row - above_row > (below_row - above_row) / 2)
- {
- /* pum above "pum_win_row" */
-
- /* Leave two lines of context if possible */
- if (curwin->w_wrow - curwin->w_cline_row >= 2)
- context_lines = 2;
- else
- context_lines = curwin->w_wrow - curwin->w_cline_row;
-
- if (pum_win_row >= size + context_lines)
- {
- pum_row = pum_win_row - size - context_lines;
- pum_height = size;
- }
- else
- {
- pum_row = 0;
- pum_height = pum_win_row - context_lines;
- }
- if (p_ph > 0 && pum_height > p_ph)
- {
- pum_row += pum_height - p_ph;
- pum_height = p_ph;
- }
- }
- else
- {
- /* pum below "pum_win_row" */
-
- /* Leave two lines of context if possible */
- if (curwin->w_cline_row
- + curwin->w_cline_height - curwin->w_wrow >= 3)
- context_lines = 3;
- else
- context_lines = curwin->w_cline_row
- + curwin->w_cline_height - curwin->w_wrow;
-
- pum_row = pum_win_row + context_lines;
- if (size > below_row - pum_row)
- pum_height = below_row - pum_row;
- else
- pum_height = size;
- if (p_ph > 0 && pum_height > p_ph)
- pum_height = p_ph;
- }
-
- /* don't display when we only have room for one line */
- if (pum_height < 1 || (pum_height == 1 && size > 1))
- return;
-
- #if defined(FEAT_QUICKFIX)
- // If there is a preview window above avoid drawing over it.
- if (pvwin != NULL && pum_row < above_row && pum_height > above_row)
- {
- pum_row = above_row;
- pum_height = pum_win_row - above_row;
- }
- #endif
-
- pum_array = array;
- pum_size = size;
- pum_compute_size();
- max_width = pum_base_width;
-
- /* Calculate column */
- #ifdef FEAT_RIGHTLEFT
- if (curwin->w_p_rl)
- cursor_col = curwin->w_wincol + curwin->w_width
- - curwin->w_wcol - 1;
- else
- #endif
- cursor_col = curwin->w_wincol + curwin->w_wcol;
-
- /* if there are more items than room we need a scrollbar */
- if (pum_height < size)
- {
- pum_scrollbar = 1;
- ++max_width;
- }
- else
- pum_scrollbar = 0;
-
- if (def_width < max_width)
- def_width = max_width;
-
- if (((cursor_col < Columns - p_pw
- || cursor_col < Columns - max_width)
- #ifdef FEAT_RIGHTLEFT
- && !curwin->w_p_rl)
- || (curwin->w_p_rl
- && (cursor_col > p_pw || cursor_col > max_width)
- #endif
- ))
- {
- /* align pum with "cursor_col" */
- pum_col = cursor_col;
-
- /* start with the maximum space available */
- #ifdef FEAT_RIGHTLEFT
- if (curwin->w_p_rl)
- pum_width = pum_col - pum_scrollbar + 1;
- else
- #endif
- pum_width = Columns - pum_col - pum_scrollbar;
-
- if (pum_width > max_width + pum_kind_width + pum_extra_width + 1
- && pum_width > p_pw)
- {
- /* the width is more than needed for the items, make it
- * narrower */
- pum_width = max_width + pum_kind_width + pum_extra_width + 1;
- if (pum_width < p_pw)
- pum_width = p_pw;
- }
- else if (((cursor_col > p_pw || cursor_col > max_width)
- #ifdef FEAT_RIGHTLEFT
- && !curwin->w_p_rl)
- || (curwin->w_p_rl && (cursor_col < Columns - p_pw
- || cursor_col < Columns - max_width)
- #endif
- ))
- {
- /* align pum edge with "cursor_col" */
- #ifdef FEAT_RIGHTLEFT
- if (curwin->w_p_rl
- && W_ENDCOL(curwin) < max_width + pum_scrollbar + 1)
- {
- pum_col = cursor_col + max_width + pum_scrollbar + 1;
- if (pum_col >= Columns)
- pum_col = Columns - 1;
- }
- else if (!curwin->w_p_rl)
- #endif
- {
- if (curwin->w_wincol > Columns - max_width - pum_scrollbar
- && max_width <= p_pw)
- {
- /* use full width to end of the screen */
- pum_col = Columns - max_width - pum_scrollbar;
- if (pum_col < 0)
- pum_col = 0;
- }
- }
-
- #ifdef FEAT_RIGHTLEFT
- if (curwin->w_p_rl)
- pum_width = pum_col - pum_scrollbar + 1;
- else
- #endif
- pum_width = Columns - pum_col - pum_scrollbar;
-
- if (pum_width < p_pw)
- {
- pum_width = p_pw;
- #ifdef FEAT_RIGHTLEFT
- if (curwin->w_p_rl)
- {
- if (pum_width > pum_col)
- pum_width = pum_col;
- }
- else
- #endif
- {
- if (pum_width >= Columns - pum_col)
- pum_width = Columns - pum_col - 1;
- }
- }
- else if (pum_width > max_width + pum_kind_width
- + pum_extra_width + 1
- && pum_width > p_pw)
- {
- pum_width = max_width + pum_kind_width
- + pum_extra_width + 1;
- if (pum_width < p_pw)
- pum_width = p_pw;
- }
- }
-
- }
- else if (Columns < def_width)
- {
- /* not enough room, will use what we have */
- #ifdef FEAT_RIGHTLEFT
- if (curwin->w_p_rl)
- pum_col = Columns - 1;
- else
- #endif
- pum_col = 0;
- pum_width = Columns - 1;
- }
- else
- {
- if (max_width > p_pw)
- max_width = p_pw; /* truncate */
- #ifdef FEAT_RIGHTLEFT
- if (curwin->w_p_rl)
- pum_col = max_width - 1;
- else
- #endif
- pum_col = Columns - max_width;
- pum_width = max_width - pum_scrollbar;
- }
-
- /* Set selected item and redraw. If the window size changed need to
- * redo the positioning. Limit this to two times, when there is not
- * much room the window size will keep changing. */
- } while (pum_set_selected(selected, redo_count) && ++redo_count <= 2);
- }
-
- /*
- * Set a flag that when pum_redraw() is called it first calls update_screen().
- * This will avoid clearing and redrawing the popup menu, prevent flicker.
- */
- void
- pum_call_update_screen()
- {
- call_update_screen = TRUE;
-
- // Update the cursor position to be able to compute the popup menu
- // position. The cursor line length may have changed because of the
- // inserted completion.
- curwin->w_valid &= ~(VALID_CROW|VALID_CHEIGHT);
- validate_cursor();
- }
-
- /*
- * Return TRUE if we are going to redraw the popup menu and the screen
position
- * "row"/"col" is under the popup menu.
- */
- int
- pum_under_menu(int row, int col)
- {
- return pum_skip_redraw
- && row >= pum_row
- && row < pum_row + pum_height
- && col >= pum_col - 1
- && col < pum_col + pum_width;
- }
-
- /*
- * Redraw the popup menu, using "pum_first" and "pum_selected".
- */
- void
- pum_redraw(void)
- {
- int row = pum_row;
- int col;
- int attr_norm = highlight_attr[HLF_PNI];
- int attr_select = highlight_attr[HLF_PSI];
- int attr_scroll = highlight_attr[HLF_PSB];
- int attr_thumb = highlight_attr[HLF_PST];
- int attr;
- int i;
- int idx;
- char_u *s;
- char_u *p = NULL;
- int totwidth, width, w;
- int thumb_pos = 0;
- int thumb_height = 1;
- int round;
- int n;
-
- if (call_update_screen)
- {
- call_update_screen = FALSE;
- pum_skip_redraw = TRUE; // do not redraw in pum_may_redraw().
- update_screen(0);
- pum_skip_redraw = FALSE;
- }
-
- // never display more than we have
- if (pum_first > pum_size - pum_height)
- pum_first = pum_size - pum_height;
-
- if (pum_scrollbar)
- {
- thumb_height = pum_height * pum_height / pum_size;
- if (thumb_height == 0)
- thumb_height = 1;
- thumb_pos = (pum_first * (pum_height - thumb_height)
- + (pum_size - pum_height) / 2)
- / (pum_size - pum_height);
- }
-
- #ifdef FEAT_TEXT_PROP
- // The popup menu is drawn over popup menus with zindex under
- // POPUPMENU_ZINDEX.
- screen_zindex = POPUPMENU_ZINDEX;
- #endif
-
- for (i = 0; i < pum_height; ++i)
- {
- idx = i + pum_first;
- attr = (idx == pum_selected) ? attr_select : attr_norm;
-
- /* prepend a space if there is room */
- #ifdef FEAT_RIGHTLEFT
- if (curwin->w_p_rl)
- {
- if (pum_col < curwin->w_wincol + curwin->w_width - 1)
- screen_putchar(' ', row, pum_col + 1, attr);
- }
- else
- #endif
- if (pum_col > 0)
- screen_putchar(' ', row, pum_col - 1, attr);
-
- /* Display each entry, use two spaces for a Tab.
- * Do this 3 times: For the main text, kind and extra info */
- col = pum_col;
- totwidth = 0;
- for (round = 1; round <= 3; ++round)
- {
- width = 0;
- s = NULL;
- switch (round)
- {
- case 1: p = pum_array[idx].pum_text; break;
- case 2: p = pum_array[idx].pum_kind; break;
- case 3: p = pum_array[idx].pum_extra; break;
- }
- if (p != NULL)
- for ( ; ; MB_PTR_ADV(p))
- {
- if (s == NULL)
- s = p;
- w = ptr2cells(p);
- if (*p == NUL || *p == TAB || totwidth + w > pum_width)
- {
- /* Display the text that fits or comes before a Tab.
- * First convert it to printable characters. */
- char_u *st;
- int saved = *p;
-
- if (saved != NUL)
- *p = NUL;
- st = transstr(s);
- if (saved != NUL)
- *p = saved;
- #ifdef FEAT_RIGHTLEFT
- if (curwin->w_p_rl)
- {
- if (st != NULL)
- {
- char_u *rt = reverse_text(st);
-
- if (rt != NULL)
- {
- char_u *rt_start = rt;
- int size;
-
- size = vim_strsize(rt);
- if (size > pum_width)
- {
- do
- {
- size -= has_mbyte
- ? (*mb_ptr2cells)(rt) : 1;
- MB_PTR_ADV(rt);
- } while (size > pum_width);
-
- if (size < pum_width)
- {
- /* Most left character requires
- * 2-cells but only 1 cell is
- * available on screen. Put a
- * '<' on the left of the pum
- * item */
- *(--rt) = '<';
- size++;
- }
- }
- screen_puts_len(rt, (int)STRLEN(rt),
- row, col - size + 1, attr);
- vim_free(rt_start);
- }
- vim_free(st);
- }
- col -= width;
- }
- else
- #endif
- {
- if (st != NULL)
- {
- screen_puts_len(st, (int)STRLEN(st), row, col,
- attr);
- vim_free(st);
- }
- col += width;
- }
-
- if (*p != TAB)
- break;
-
- /* Display two spaces for a Tab. */
- #ifdef FEAT_RIGHTLEFT
- if (curwin->w_p_rl)
- {
- screen_puts_len((char_u *)" ", 2, row, col - 1,
- attr);
- col -= 2;
- }
- else
- #endif
- {
- screen_puts_len((char_u *)" ", 2, row, col, attr);
- col += 2;
- }
- totwidth += 2;
- s = NULL; /* start text at next char */
- width = 0;
- }
- else
- width += w;
- }
-
- if (round > 1)
- n = pum_kind_width + 1;
- else
- n = 1;
-
- /* Stop when there is nothing more to display. */
- if (round == 3
- || (round == 2 && pum_array[idx].pum_extra == NULL)
- || (round == 1 && pum_array[idx].pum_kind == NULL
- && pum_array[idx].pum_extra == NULL)
- || pum_base_width + n >= pum_width)
- break;
- #ifdef FEAT_RIGHTLEFT
- if (curwin->w_p_rl)
- {
- screen_fill(row, row + 1, pum_col - pum_base_width - n + 1,
- col + 1, ' ', ' ', attr);
- col = pum_col - pum_base_width - n + 1;
- }
- else
- #endif
- {
- screen_fill(row, row + 1, col, pum_col + pum_base_width + n,
- ' ', ' ', attr);
- col = pum_col + pum_base_width + n;
- }
- totwidth = pum_base_width + n;
- }
-
- #ifdef FEAT_RIGHTLEFT
- if (curwin->w_p_rl)
- screen_fill(row, row + 1, pum_col - pum_width + 1, col + 1, ' ',
- ' ', attr);
- else
- #endif
- screen_fill(row, row + 1, col, pum_col + pum_width, ' ', ' ',
- attr);
- if (pum_scrollbar > 0)
- {
- #ifdef FEAT_RIGHTLEFT
- if (curwin->w_p_rl)
- screen_putchar(' ', row, pum_col - pum_width,
- i >= thumb_pos && i < thumb_pos + thumb_height
- ? attr_thumb : attr_scroll);
- else
- #endif
- screen_putchar(' ', row, pum_col + pum_width,
- i >= thumb_pos && i < thumb_pos + thumb_height
- ? attr_thumb : attr_scroll);
- }
-
- ++row;
- }
-
- #ifdef FEAT_TEXT_PROP
- screen_zindex = 0;
- #endif
- }
-
- #if defined(FEAT_TEXT_PROP) && defined(FEAT_QUICKFIX)
- static void
- pum_position_info_popup(void)
- {
- int col = pum_col + pum_width + 1;
- int row = pum_row;
- int botpos = POPPOS_BOTLEFT;
-
- curwin->w_popup_pos = POPPOS_TOPLEFT;
- if (Columns - col < 20 && Columns - col < pum_col)
- {
- col = pum_col - 1;
- curwin->w_popup_pos = POPPOS_TOPRIGHT;
- botpos = POPPOS_BOTRIGHT;
- curwin->w_maxwidth = pum_col - 1;
- }
- else
- curwin->w_maxwidth = Columns - col + 1;
- curwin->w_maxwidth -= popup_extra_width(curwin);
-
- row -= popup_top_extra(curwin);
- if (curwin->w_popup_flags & POPF_INFO_MENU)
- {
- if (pum_row < pum_win_row)
- {
- // menu above cursor line, align with bottom
- row += pum_height;
- curwin->w_popup_pos = botpos;
- }
- else
- // menu below cursor line, align with top
- row += 1;
- }
- else
- // align with the selected item
- row += pum_selected - pum_first + 1;
-
- popup_set_wantpos_rowcol(curwin, row, col);
- }
- #endif
-
- /*
- * Set the index of the currently selected item. The menu will scroll when
- * necessary. When "n" is out of range don't scroll.
- * This may be repeated when the preview window is used:
- * "repeat" == 0: open preview window normally
- * "repeat" == 1: open preview window but don't set the size
- * "repeat" == 2: don't open preview window
- * Returns TRUE when the window was resized and the location of the popup menu
- * must be recomputed.
- */
- static int
- pum_set_selected(int n, int repeat UNUSED)
- {
- int resized = FALSE;
- int context = pum_height / 2;
- #ifdef FEAT_QUICKFIX
- int prev_selected = pum_selected;
- #endif
- #ifdef FEAT_TEXT_PROP
- int has_info = FALSE;
- #endif
-
- pum_selected = n;
-
- if (pum_selected >= 0 && pum_selected < pum_size)
- {
- if (pum_first > pum_selected - 4)
- {
- /* scroll down; when we did a jump it's probably a PageUp then
- * scroll a whole page */
- if (pum_first > pum_selected - 2)
- {
- pum_first -= pum_height - 2;
- if (pum_first < 0)
- pum_first = 0;
- else if (pum_first > pum_selected)
- pum_first = pum_selected;
- }
- else
- pum_first = pum_selected;
- }
- else if (pum_first < pum_selected - pum_height + 5)
- {
- /* scroll up; when we did a jump it's probably a PageDown then
- * scroll a whole page */
- if (pum_first < pum_selected - pum_height + 1 + 2)
- {
- pum_first += pum_height - 2;
- if (pum_first < pum_selected - pum_height + 1)
- pum_first = pum_selected - pum_height + 1;
- }
- else
- pum_first = pum_selected - pum_height + 1;
- }
-
- /* Give a few lines of context when possible. */
- if (context > 3)
- context = 3;
- if (pum_height > 2)
- {
- if (pum_first > pum_selected - context)
- {
- /* scroll down */
- pum_first = pum_selected - context;
- if (pum_first < 0)
- pum_first = 0;
- }
- else if (pum_first < pum_selected + context - pum_height + 1)
- {
- /* scroll up */
- pum_first = pum_selected + context - pum_height + 1;
- }
- }
- // adjust for the number of lines displayed
- if (pum_first > pum_size - pum_height)
- pum_first = pum_size - pum_height;
-
- #if defined(FEAT_QUICKFIX)
- /*
- * Show extra info in the preview window if there is something and
- * 'completeopt' contains "preview" or "popup".
- * Skip this when tried twice already.
- * Skip this also when there is not much room.
- * NOTE: Be very careful not to sync undo!
- */
- if (pum_array[pum_selected].pum_info != NULL
- && Rows > 10
- && repeat <= 1
- && vim_strchr(p_cot, 'p') != NULL)
- {
- win_T *curwin_save = curwin;
- tabpage_T *curtab_save = curtab;
- int res = OK;
- # ifdef FEAT_TEXT_PROP
- int use_popup = strstr((char *)p_cot, "popup") != NULL;
- # else
- # define use_popup 0
- # endif
- # ifdef FEAT_TEXT_PROP
- has_info = TRUE;
- # endif
- // Open a preview window. 3 lines by default. Prefer
- // 'previewheight' if set and smaller.
- g_do_tagpreview = 3;
- if (p_pvh > 0 && p_pvh < g_do_tagpreview)
- g_do_tagpreview = p_pvh;
- ++RedrawingDisabled;
- // Prevent undo sync here, if an autocommand syncs undo weird
- // things can happen to the undo tree.
- ++no_u_sync;
- resized = prepare_tagpreview(FALSE, FALSE, use_popup);
- --no_u_sync;
- --RedrawingDisabled;
- g_do_tagpreview = 0;
-
- if (curwin->w_p_pvw
- # ifdef FEAT_TEXT_PROP
- || (curwin->w_popup_flags & POPF_INFO)
- # endif
- )
- {
- if (!resized
- && curbuf->b_nwindows == 1
- && curbuf->b_fname == NULL
- && bt_nofile(curbuf)
- && curbuf->b_p_bh[0] == 'w')
- {
- // Already a "wipeout" buffer, make it empty.
- while (!BUFEMPTY())
- ml_delete((linenr_T)1, FALSE);
- }
- else
- {
- // Don't want to sync undo in the current buffer.
- ++no_u_sync;
- res = do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, 0, NULL);
- --no_u_sync;
- if (res == OK)
- {
- // Edit a new, empty buffer. Set options for a "wipeout"
- // buffer.
- set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL);
- set_option_value((char_u *)"bt", 0L,
- (char_u *)"nofile", OPT_LOCAL);
- set_option_value((char_u *)"bh", 0L,
- (char_u *)"wipe", OPT_LOCAL);
- set_option_value((char_u *)"diff", 0L,
- NULL, OPT_LOCAL);
- }
- }
- if (res == OK)
- {
- char_u *p, *e;
- linenr_T lnum = 0;
-
- for (p = pum_array[pum_selected].pum_info; *p != NUL; )
- {
- e = vim_strchr(p, '\n');
- if (e == NULL)
- {
- ml_append(lnum++, p, 0, FALSE);
- break;
- }
- else
- {
- *e = NUL;
- ml_append(lnum++, p, (int)(e - p + 1), FALSE);
- *e = '\n';
- p = e + 1;
- }
- }
- // delete the empty last line
- ml_delete(curbuf->b_ml.ml_line_count, FALSE);
-
- /* Increase the height of the preview window to show the
- * text, but no more than 'previewheight' lines. */
- if (repeat == 0 && !use_popup)
- {
- if (lnum > p_pvh)
- lnum = p_pvh;
- if (curwin->w_height < lnum)
- {
- win_setheight((int)lnum);
- resized = TRUE;
- }
- }
-
- curbuf->b_changed = 0;
- curbuf->b_p_ma = FALSE;
- if (pum_selected != prev_selected)
- {
- # ifdef FEAT_TEXT_PROP
- curwin->w_firstline = 1;
- # endif
- curwin->w_topline = 1;
- }
- else if (curwin->w_topline > curbuf->b_ml.ml_line_count)
- curwin->w_topline = curbuf->b_ml.ml_line_count;
- curwin->w_cursor.lnum = curwin->w_topline;
- curwin->w_cursor.col = 0;
- # ifdef FEAT_TEXT_PROP
- if (use_popup)
- {
- pum_position_info_popup();
- if (win_valid(curwin_save))
- redraw_win_later(curwin_save, SOME_VALID);
- }
- # endif
- if ((curwin != curwin_save && win_valid(curwin_save))
- || (curtab != curtab_save
- && valid_tabpage(curtab_save)))
- {
- if (curtab != curtab_save && valid_tabpage(curtab_save))
- goto_tabpage_tp(curtab_save, FALSE, FALSE);
-
- /* When the first completion is done and the preview
- * window is not resized, skip the preview window's
- * status line redrawing. */
- if (ins_compl_active() && !resized)
- curwin->w_redr_status = FALSE;
-
- /* Return cursor to where we were */
- validate_cursor();
- redraw_later(SOME_VALID);
-
- /* When the preview window was resized we need to
- * update the view on the buffer. Only go back to
- * the window when needed, otherwise it will always be
- * redraw. */
- if (resized && win_valid(curwin_save))
- {
- ++no_u_sync;
- win_enter(curwin_save, TRUE);
- --no_u_sync;
- update_topline();
- }
-
- /* Update the screen before drawing the popup menu.
- * Enable updating the status lines. */
- pum_do_redraw = TRUE;
- update_screen(0);
- pum_do_redraw = FALSE;
-
- if (!resized && win_valid(curwin_save))
- {
- ++no_u_sync;
- win_enter(curwin_save, TRUE);
- --no_u_sync;
- }
-
- /* May need to update the screen again when there are
- * autocommands involved. */
- pum_do_redraw = TRUE;
- update_screen(0);
- pum_do_redraw = FALSE;
- call_update_screen = FALSE;
- }
- }
- }
- # if defined(FEAT_TEXT_PROP) && defined(FEAT_QUICKFIX)
- if (WIN_IS_POPUP(curwin))
- // can't keep focus in a popup window
- win_enter(firstwin, TRUE);
- # endif
- }
- #endif
- }
- #if defined(FEAT_TEXT_PROP) && defined(FEAT_QUICKFIX)
- if (!has_info)
- // hide any popup info window
- popup_hide_info();
- #endif
-
- if (!resized)
- pum_redraw();
-
- return resized;
- }
-
- /*
- * Undisplay the popup menu (later).
- */
- void
- pum_undisplay(void)
- {
- pum_array = NULL;
- redraw_all_later(NOT_VALID);
- redraw_tabline = TRUE;
- status_redraw_all();
- #if defined(FEAT_TEXT_PROP) && defined(FEAT_QUICKFIX)
- // hide any popup info window
- popup_hide_info();
- #endif
- }
-
- /*
- * Clear the popup menu. Currently only resets the offset to the first
- * displayed item.
- */
- void
- pum_clear(void)
- {
- pum_first = 0;
- }
-
- /*
- * Return TRUE if the popup menu is displayed.
- * Overruled when "pum_do_redraw" is set, used to redraw the status lines.
- */
- int
- pum_visible(void)
- {
- return !pum_do_redraw && pum_array != NULL;
- }
-
- /*
- * Reposition the popup menu to adjust for window layout changes.
- */
- void
- pum_may_redraw(void)
- {
- pumitem_T *array = pum_array;
- int len = pum_size;
- int selected = pum_selected;
-
- if (!pum_visible() || pum_skip_redraw)
- return; // nothing to do
-
- if (pum_window != curwin
- || (pum_win_row == curwin->w_wrow + W_WINROW(curwin)
- && pum_win_height == curwin->w_height
- && pum_win_col == curwin->w_wincol
- && pum_win_width == curwin->w_width))
- {
- // window position didn't change, redraw in the same position
- pum_redraw();
- }
- else
- {
- int wcol = curwin->w_wcol;
-
- // Window layout changed, recompute the position.
- // Use the remembered w_wcol value, the cursor may have moved when a
- // completion was inserted, but we want the menu in the same position.
- pum_undisplay();
- curwin->w_wcol = pum_win_wcol;
- curwin->w_valid |= VALID_WCOL;
- pum_display(array, len, selected);
- curwin->w_wcol = wcol;
- }
- }
-
- /*
- * Return the height of the popup menu, the number of entries visible.
- * Only valid when pum_visible() returns TRUE!
- */
- int
- pum_get_height(void)
- {
- return pum_height;
- }
-
- #if defined(FEAT_EVAL) || defined(PROTO)
- /*
- * Add size information about the pum to "dict".
- */
- void
- pum_set_event_info(dict_T *dict)
- {
- if (!pum_visible())
- return;
- dict_add_number(dict, "height", pum_height);
- dict_add_number(dict, "width", pum_width);
- dict_add_number(dict, "row", pum_row);
- dict_add_number(dict, "col", pum_col);
- dict_add_number(dict, "size", pum_size);
- dict_add_special(dict, "scrollbar", pum_scrollbar ? VVAL_TRUE :
VVAL_FALSE);
- }
- #endif
-
- #if defined(FEAT_BEVAL_TERM) || defined(FEAT_TERM_POPUP_MENU) ||
defined(PROTO)
- static void
- pum_position_at_mouse(int min_width)
- {
- if (Rows - mouse_row > pum_size)
- {
- /* Enough space below the mouse row. */
- pum_row = mouse_row + 1;
- if (pum_height > Rows - pum_row)
- pum_height = Rows - pum_row;
- }
- else
- {
- /* Show above the mouse row, reduce height if it does not fit. */
- pum_row = mouse_row - pum_size;
- if (pum_row < 0)
- {
- pum_height += pum_row;
- pum_row = 0;
- }
- }
- if (Columns - mouse_col >= pum_base_width
- || Columns - mouse_col > min_width)
- /* Enough space to show at mouse column. */
- pum_col = mouse_col;
- else
- /* Not enough space, right align with window. */
- pum_col = Columns - (pum_base_width > min_width
- ? min_width : pum_base_width);
-
- pum_width = Columns - pum_col;
- if (pum_width > pum_base_width + 1)
- pum_width = pum_base_width + 1;
-
- // Do not redraw at cursor position.
- pum_window = NULL;
- }
-
- #endif
-
- #if defined(FEAT_BEVAL_TERM) || defined(PROTO)
- static pumitem_T *balloon_array = NULL;
- static int balloon_arraysize;
-
- # define BALLOON_MIN_WIDTH 50
- # define BALLOON_MIN_HEIGHT 10
-
- typedef struct {
- char_u *start;
- int bytelen;
- int cells;
- int indent;
- } balpart_T;
-
- /*
- * Split a string into parts to display in the balloon.
- * Aimed at output from gdb. Attempts to split at white space, preserve
quoted
- * strings and make a struct look good.
- * Resulting array is stored in "array" and returns the size of the array.
- */
- int
- split_message(char_u *mesg, pumitem_T **array)
- {
- garray_T ga;
- char_u *p;
- balpart_T *item;
- int quoted = FALSE;
- int height;
- int line;
- int item_idx;
- int indent = 0;
- int max_cells = 0;
- int max_height = Rows / 2 - 2;
- int long_item_count = 0;
- int split_long_items = FALSE;
-
- ga_init2(&ga, sizeof(balpart_T), 20);
- p = mesg;
-
- while (*p != NUL)
- {
- if (ga_grow(&ga, 1) == FAIL)
- goto failed;
- item = ((balpart_T *)ga.ga_data) + ga.ga_len;
- item->start = p;
- item->indent = indent;
- item->cells = indent * 2;
- ++ga.ga_len;
- while (*p != NUL)
- {
- if (*p == '"')
- quoted = !quoted;
- else if (*p == '\\' && p[1] != NUL)
- ++p;
- else if (!quoted)
- {
- if ((*p == ',' && p[1] == ' ') || *p == '{' || *p == '}')
- {
- /* Looks like a good point to break. */
- if (*p == '{')
- ++indent;
- else if (*p == '}' && indent > 0)
- --indent;
- ++item->cells;
- p = skipwhite(p + 1);
- break;
- }
- }
- item->cells += ptr2cells(p);
- p += MB_PTR2LEN(p);
- }
- item->bytelen = p - item->start;
- if (item->cells > max_cells)
- max_cells = item->cells;
- long_item_count += (item->cells - 1) / BALLOON_MIN_WIDTH;
- }
-
- height = 2 + ga.ga_len;
-
- /* If there are long items and the height is below the limit: split lines
*/
- if (long_item_count > 0 && height + long_item_count <= max_height)
- {
- split_long_items = TRUE;
- height += long_item_count;
- }
-
- /* Limit to half the window height, it has to fit above or below the mouse
- * position. */
- if (height > max_height)
- height = max_height;
- *array = ALLOC_CLEAR_MULT(pumitem_T, height);
- if (*array == NULL)
- goto failed;
-
- /* Add an empty line above and below, looks better. */
- (*array)->pum_text = vim_strsave((char_u *)"");
- (*array + height - 1)->pum_text = vim_strsave((char_u *)"");
-
- for (line = 1, item_idx = 0; line < height - 1; ++item_idx)
- {
- int skip;
- int thislen;
- int copylen;
- int ind;
- int cells;
-
- item = ((balpart_T *)ga.ga_data) + item_idx;
- for (skip = 0; skip < item->bytelen; skip += thislen)
- {
- if (split_long_items && item->cells >= BALLOON_MIN_WIDTH)
- {
- cells = item->indent * 2;
- for (p = item->start + skip; p < item->start + item->bytelen;
- p += MB_PTR2LEN(p))
- if ((cells += ptr2cells(p)) > BALLOON_MIN_WIDTH)
- break;
- thislen = p - (item->start + skip);
- }
- else
- thislen = item->bytelen;
-
- // put indent at the start
- p = alloc(thislen + item->indent * 2 + 1);
- if (p == NULL)
- {
- for (line = 0; line <= height - 1; ++line)
- vim_free((*array)[line].pum_text);
- vim_free(*array);
- goto failed;
- }
- for (ind = 0; ind < item->indent * 2; ++ind)
- p[ind] = ' ';
-
- // exclude spaces at the end of the string
- for (copylen = thislen; copylen > 0; --copylen)
- if (item->start[skip + copylen - 1] != ' ')
- break;
-
- vim_strncpy(p + ind, item->start + skip, copylen);
- (*array)[line].pum_text = p;
- item->indent = 0; /* wrapped line has no indent */
- ++line;
- }
- }
- ga_clear(&ga);
- return height;
-
- failed:
- ga_clear(&ga);
- return 0;
- }
-
- void
- ui_remove_balloon(void)
- {
- if (balloon_array != NULL)
- {
- pum_undisplay();
- while (balloon_arraysize > 0)
- vim_free(balloon_array[--balloon_arraysize].pum_text);
- VIM_CLEAR(balloon_array);
- }
- }
-
- /*
- * Terminal version of a balloon, uses the popup menu code.
- */
- void
- ui_post_balloon(char_u *mesg, list_T *list)
- {
- ui_remove_balloon();
-
- if (mesg == NULL && list == NULL)
- {
- pum_undisplay();
- return;
- }
- if (list != NULL)
- {
- listitem_T *li;
- int idx;
-
- balloon_arraysize = list->lv_len;
- balloon_array = ALLOC_CLEAR_MULT(pumitem_T, list->lv_len);
- if (balloon_array == NULL)
- return;
- for (idx = 0, li = list->lv_first; li != NULL; li = li->li_next, ++idx)
- {
- char_u *text = tv_get_string_chk(&li->li_tv);
-
- balloon_array[idx].pum_text = vim_strsave(
- text == NULL ? (char_u *)"" : text);
- }
- }
- else
- balloon_arraysize = split_message(mesg, &balloon_array);
-
- if (balloon_arraysize > 0)
- {
- pum_array = balloon_array;
- pum_size = balloon_arraysize;
- pum_compute_size();
- pum_scrollbar = 0;
- pum_height = balloon_arraysize;
-
- pum_position_at_mouse(BALLOON_MIN_WIDTH);
- pum_selected = -1;
- pum_first = 0;
- pum_redraw();
- }
- }
-
- /*
- * Called when the mouse moved, may remove any displayed balloon.
- */
- void
- ui_may_remove_balloon(void)
- {
- // For now: remove the balloon whenever the mouse moves to another screen
- // cell.
- ui_remove_balloon();
- }
- #endif
-
- #if defined(FEAT_TERM_POPUP_MENU) || defined(PROTO)
- /*
- * Select the pum entry at the mouse position.
- */
- static void
- pum_select_mouse_pos(void)
- {
- int idx = mouse_row - pum_row;
-
- if (idx < 0 || idx >= pum_size)
- pum_selected = -1;
- else if (*pum_array[idx].pum_text != NUL)
- pum_selected = idx;
- }
-
- /*
- * Execute the currently selected popup menu item.
- */
- static void
- pum_execute_menu(vimmenu_T *menu, int mode)
- {
- vimmenu_T *mp;
- int idx = 0;
- exarg_T ea;
-
- for (mp = menu->children; mp != NULL; mp = mp->next)
- if ((mp->modes & mp->enabled & mode) && idx++ == pum_selected)
- {
- vim_memset(&ea, 0, sizeof(ea));
- execute_menu(&ea, mp, -1);
- break;
- }
- }
-
- /*
- * Open the terminal version of the popup menu and don't return until it is
- * closed.
- */
- void
- pum_show_popupmenu(vimmenu_T *menu)
- {
- vimmenu_T *mp;
- int idx = 0;
- pumitem_T *array;
- # ifdef FEAT_BEVAL_TERM
- int save_bevalterm = p_bevalterm;
- # endif
- int mode;
-
- pum_undisplay();
- pum_size = 0;
- mode = get_menu_mode_flag();
-
- for (mp = menu->children; mp != NULL; mp = mp->next)
- if (menu_is_separator(mp->dname)
- || (mp->modes & mp->enabled & mode))
- ++pum_size;
-
- // When there are only Terminal mode menus, using "popup Edit" results in
- // pum_size being zero.
- if (pum_size <= 0)
- {
- emsg(e_menuothermode);
- return;
- }
-
- array = ALLOC_CLEAR_MULT(pumitem_T, pum_size);
- if (array == NULL)
- return;
-
- for (mp = menu->children; mp != NULL; mp = mp->next)
- if (menu_is_separator(mp->dname))
- array[idx++].pum_text = (char_u *)"";
- else if (mp->modes & mp->enabled & mode)
- array[idx++].pum_text = mp->dname;
-
- pum_array = array;
- pum_compute_size();
- pum_scrollbar = 0;
- pum_height = pum_size;
- pum_position_at_mouse(20);
-
- pum_selected = -1;
- pum_first = 0;
- # ifdef FEAT_BEVAL_TERM
- p_bevalterm = TRUE; /* track mouse movement */
- mch_setmouse(TRUE);
- # endif
-
- for (;;)
- {
- int c;
-
- pum_redraw();
- setcursor_mayforce(TRUE);
- out_flush();
-
- c = vgetc();
-
- // Bail out when typing Esc, CTRL-C or some callback closed the popup
- // menu.
- if (c == ESC || c == Ctrl_C || pum_array == NULL)
- break;
- else if (c == CAR || c == NL)
- {
- /* enter: select current item, if any, and close */
- pum_execute_menu(menu, mode);
- break;
- }
- else if (c == 'k' || c == K_UP || c == K_MOUSEUP)
- {
- /* cursor up: select previous item */
- while (pum_selected > 0)
- {
- --pum_selected;
- if (*array[pum_selected].pum_text != NUL)
- break;
- }
- }
- else if (c == 'j' || c == K_DOWN || c == K_MOUSEDOWN)
- {
- /* cursor down: select next item */
- while (pum_selected < pum_size - 1)
- {
- ++pum_selected;
- if (*array[pum_selected].pum_text != NUL)
- break;
- }
- }
- else if (c == K_RIGHTMOUSE)
- {
- /* Right mouse down: reposition the menu. */
- vungetc(c);
- break;
- }
- else if (c == K_LEFTDRAG || c == K_RIGHTDRAG || c == K_MOUSEMOVE)
- {
- /* mouse moved: select item in the mouse row */
- pum_select_mouse_pos();
- }
- else if (c == K_LEFTMOUSE || c == K_LEFTMOUSE_NM || c == K_RIGHTRELEASE)
- {
- /* left mouse click: select clicked item, if any, and close;
- * right mouse release: select clicked item, close if any */
- pum_select_mouse_pos();
- if (pum_selected >= 0)
- {
- pum_execute_menu(menu, mode);
- break;
- }
- if (c == K_LEFTMOUSE || c == K_LEFTMOUSE_NM)
- break;
- }
- }
-
- vim_free(array);
- pum_undisplay();
- # ifdef FEAT_BEVAL_TERM
- p_bevalterm = save_bevalterm;
- mch_setmouse(TRUE);
- # endif
- }
-
- void
- pum_make_popup(char_u *path_name, int use_mouse_pos)
- {
- vimmenu_T *menu;
-
- if (!use_mouse_pos)
- {
- /* Hack: set mouse position at the cursor so that the menu pops up
- * around there. */
- mouse_row = curwin->w_winrow + curwin->w_wrow;
- mouse_col = curwin->w_wincol + curwin->w_wcol;
- }
-
- menu = gui_find_menu(path_name);
- if (menu != NULL)
- pum_show_popupmenu(menu);
- }
- #endif
--- 0 ----
*** ../vim-8.1.2081/src/popupmenu.c 2019-08-21 17:27:15.695325866 +0200
--- src/popupmenu.c 2019-09-27 12:46:26.941322642 +0200
***************
*** 0 ****
--- 1,1489 ----
+ /* vi:set ts=8 sts=4 sw=4 noet:
+ *
+ * VIM - Vi IMproved by Bram Moolenaar
+ *
+ * Do ":help uganda" in Vim to read copying and usage conditions.
+ * Do ":help credits" in Vim to see a list of people who contributed.
+ * See README.txt for an overview of the Vim source code.
+ */
+
+ /*
+ * popupmenu.c: Popup menu (PUM)
+ */
+ #include "vim.h"
+
+ static pumitem_T *pum_array = NULL; /* items of displayed pum */
+ static int pum_size; /* nr of items in "pum_array" */
+ static int pum_selected; /* index of selected item or -1 */
+ static int pum_first = 0; /* index of top item */
+
+ static int call_update_screen = FALSE;
+
+ static int pum_height; /* nr of displayed pum items */
+ static int pum_width; /* width of displayed pum items */
+ static int pum_base_width; /* width of pum items base */
+ static int pum_kind_width; /* width of pum items kind column */
+ static int pum_extra_width; /* width of extra stuff */
+ static int pum_scrollbar; /* TRUE when scrollbar present */
+
+ static int pum_row; /* top row of pum */
+ static int pum_col; /* left column of pum */
+
+ static win_T *pum_window = NULL;
+ static int pum_win_row;
+ static int pum_win_height;
+ static int pum_win_col;
+ static int pum_win_wcol;
+ static int pum_win_width;
+
+ static int pum_do_redraw = FALSE; // do redraw anyway
+ static int pum_skip_redraw = FALSE; // skip redraw
+
+ static int pum_set_selected(int n, int repeat);
+
+ #define PUM_DEF_HEIGHT 10
+
+ static void
+ pum_compute_size(void)
+ {
+ int i;
+ int w;
+
+ /* Compute the width of the widest match and the widest extra. */
+ pum_base_width = 0;
+ pum_kind_width = 0;
+ pum_extra_width = 0;
+ for (i = 0; i < pum_size; ++i)
+ {
+ w = vim_strsize(pum_array[i].pum_text);
+ if (pum_base_width < w)
+ pum_base_width = w;
+ if (pum_array[i].pum_kind != NULL)
+ {
+ w = vim_strsize(pum_array[i].pum_kind) + 1;
+ if (pum_kind_width < w)
+ pum_kind_width = w;
+ }
+ if (pum_array[i].pum_extra != NULL)
+ {
+ w = vim_strsize(pum_array[i].pum_extra) + 1;
+ if (pum_extra_width < w)
+ pum_extra_width = w;
+ }
+ }
+ }
+
+ /*
+ * Show the popup menu with items "array[size]".
+ * "array" must remain valid until pum_undisplay() is called!
+ * When possible the leftmost character is aligned with cursor column.
+ * The menu appears above the screen line "row" or at "row" + "height" - 1.
+ */
+ void
+ pum_display(
+ pumitem_T *array,
+ int size,
+ int selected) /* index of initially selected item,
none if
+ out of range */
+ {
+ int def_width;
+ int max_width;
+ int context_lines;
+ int cursor_col;
+ int above_row;
+ int below_row;
+ int redo_count = 0;
+ #if defined(FEAT_QUICKFIX)
+ win_T *pvwin;
+ #endif
+
+ do
+ {
+ def_width = p_pw;
+ above_row = 0;
+ below_row = cmdline_row;
+
+ /* Pretend the pum is already there to avoid that must_redraw is set
+ * when 'cuc' is on. */
+ pum_array = (pumitem_T *)1;
+ validate_cursor_col();
+ pum_array = NULL;
+
+ // Remember the essential parts of the window position and size, so we
+ // can decide when to reposition the popup menu.
+ pum_window = curwin;
+ pum_win_row = curwin->w_wrow + W_WINROW(curwin);
+ pum_win_height = curwin->w_height;
+ pum_win_col = curwin->w_wincol;
+ pum_win_wcol = curwin->w_wcol;
+ pum_win_width = curwin->w_width;
+
+ #if defined(FEAT_QUICKFIX)
+ FOR_ALL_WINDOWS(pvwin)
+ if (pvwin->w_p_pvw)
+ break;
+ if (pvwin != NULL)
+ {
+ if (W_WINROW(pvwin) < W_WINROW(curwin))
+ above_row = W_WINROW(pvwin) + pvwin->w_height;
+ else if (W_WINROW(pvwin) > W_WINROW(curwin) + curwin->w_height)
+ below_row = W_WINROW(pvwin);
+ }
+ #endif
+
+ /*
+ * Figure out the size and position of the pum.
+ */
+ if (size < PUM_DEF_HEIGHT)
+ pum_height = size;
+ else
+ pum_height = PUM_DEF_HEIGHT;
+ if (p_ph > 0 && pum_height > p_ph)
+ pum_height = p_ph;
+
+ /* Put the pum below "pum_win_row" if possible. If there are few lines
+ * decide on where there is more room. */
+ if (pum_win_row + 2 >= below_row - pum_height
+ && pum_win_row - above_row > (below_row - above_row) / 2)
+ {
+ /* pum above "pum_win_row" */
+
+ /* Leave two lines of context if possible */
+ if (curwin->w_wrow - curwin->w_cline_row >= 2)
+ context_lines = 2;
+ else
+ context_lines = curwin->w_wrow - curwin->w_cline_row;
+
+ if (pum_win_row >= size + context_lines)
+ {
+ pum_row = pum_win_row - size - context_lines;
+ pum_height = size;
+ }
+ else
+ {
+ pum_row = 0;
+ pum_height = pum_win_row - context_lines;
+ }
+ if (p_ph > 0 && pum_height > p_ph)
+ {
+ pum_row += pum_height - p_ph;
+ pum_height = p_ph;
+ }
+ }
+ else
+ {
+ /* pum below "pum_win_row" */
+
+ /* Leave two lines of context if possible */
+ if (curwin->w_cline_row
+ + curwin->w_cline_height - curwin->w_wrow >= 3)
+ context_lines = 3;
+ else
+ context_lines = curwin->w_cline_row
+ + curwin->w_cline_height - curwin->w_wrow;
+
+ pum_row = pum_win_row + context_lines;
+ if (size > below_row - pum_row)
+ pum_height = below_row - pum_row;
+ else
+ pum_height = size;
+ if (p_ph > 0 && pum_height > p_ph)
+ pum_height = p_ph;
+ }
+
+ /* don't display when we only have room for one line */
+ if (pum_height < 1 || (pum_height == 1 && size > 1))
+ return;
+
+ #if defined(FEAT_QUICKFIX)
+ // If there is a preview window above avoid drawing over it.
+ if (pvwin != NULL && pum_row < above_row && pum_height > above_row)
+ {
+ pum_row = above_row;
+ pum_height = pum_win_row - above_row;
+ }
+ #endif
+
+ pum_array = array;
+ pum_size = size;
+ pum_compute_size();
+ max_width = pum_base_width;
+
+ /* Calculate column */
+ #ifdef FEAT_RIGHTLEFT
+ if (curwin->w_p_rl)
+ cursor_col = curwin->w_wincol + curwin->w_width
+ - curwin->w_wcol - 1;
+ else
+ #endif
+ cursor_col = curwin->w_wincol + curwin->w_wcol;
+
+ /* if there are more items than room we need a scrollbar */
+ if (pum_height < size)
+ {
+ pum_scrollbar = 1;
+ ++max_width;
+ }
+ else
+ pum_scrollbar = 0;
+
+ if (def_width < max_width)
+ def_width = max_width;
+
+ if (((cursor_col < Columns - p_pw
+ || cursor_col < Columns - max_width)
+ #ifdef FEAT_RIGHTLEFT
+ && !curwin->w_p_rl)
+ || (curwin->w_p_rl
+ && (cursor_col > p_pw || cursor_col > max_width)
+ #endif
+ ))
+ {
+ /* align pum with "cursor_col" */
+ pum_col = cursor_col;
+
+ /* start with the maximum space available */
+ #ifdef FEAT_RIGHTLEFT
+ if (curwin->w_p_rl)
+ pum_width = pum_col - pum_scrollbar + 1;
+ else
+ #endif
+ pum_width = Columns - pum_col - pum_scrollbar;
+
+ if (pum_width > max_width + pum_kind_width + pum_extra_width + 1
+ && pum_width > p_pw)
+ {
+ /* the width is more than needed for the items, make it
+ * narrower */
+ pum_width = max_width + pum_kind_width + pum_extra_width + 1;
+ if (pum_width < p_pw)
+ pum_width = p_pw;
+ }
+ else if (((cursor_col > p_pw || cursor_col > max_width)
+ #ifdef FEAT_RIGHTLEFT
+ && !curwin->w_p_rl)
+ || (curwin->w_p_rl && (cursor_col < Columns - p_pw
+ || cursor_col < Columns - max_width)
+ #endif
+ ))
+ {
+ /* align pum edge with "cursor_col" */
+ #ifdef FEAT_RIGHTLEFT
+ if (curwin->w_p_rl
+ && W_ENDCOL(curwin) < max_width + pum_scrollbar + 1)
+ {
+ pum_col = cursor_col + max_width + pum_scrollbar + 1;
+ if (pum_col >= Columns)
+ pum_col = Columns - 1;
+ }
+ else if (!curwin->w_p_rl)
+ #endif
+ {
+ if (curwin->w_wincol > Columns - max_width - pum_scrollbar
+ && max_width <= p_pw)
+ {
+ /* use full width to end of the screen */
+ pum_col = Columns - max_width - pum_scrollbar;
+ if (pum_col < 0)
+ pum_col = 0;
+ }
+ }
+
+ #ifdef FEAT_RIGHTLEFT
+ if (curwin->w_p_rl)
+ pum_width = pum_col - pum_scrollbar + 1;
+ else
+ #endif
+ pum_width = Columns - pum_col - pum_scrollbar;
+
+ if (pum_width < p_pw)
+ {
+ pum_width = p_pw;
+ #ifdef FEAT_RIGHTLEFT
+ if (curwin->w_p_rl)
+ {
+ if (pum_width > pum_col)
+ pum_width = pum_col;
+ }
+ else
+ #endif
+ {
+ if (pum_width >= Columns - pum_col)
+ pum_width = Columns - pum_col - 1;
+ }
+ }
+ else if (pum_width > max_width + pum_kind_width
+ + pum_extra_width + 1
+ && pum_width > p_pw)
+ {
+ pum_width = max_width + pum_kind_width
+ + pum_extra_width + 1;
+ if (pum_width < p_pw)
+ pum_width = p_pw;
+ }
+ }
+
+ }
+ else if (Columns < def_width)
+ {
+ /* not enough room, will use what we have */
+ #ifdef FEAT_RIGHTLEFT
+ if (curwin->w_p_rl)
+ pum_col = Columns - 1;
+ else
+ #endif
+ pum_col = 0;
+ pum_width = Columns - 1;
+ }
+ else
+ {
+ if (max_width > p_pw)
+ max_width = p_pw; /* truncate */
+ #ifdef FEAT_RIGHTLEFT
+ if (curwin->w_p_rl)
+ pum_col = max_width - 1;
+ else
+ #endif
+ pum_col = Columns - max_width;
+ pum_width = max_width - pum_scrollbar;
+ }
+
+ /* Set selected item and redraw. If the window size changed need to
+ * redo the positioning. Limit this to two times, when there is not
+ * much room the window size will keep changing. */
+ } while (pum_set_selected(selected, redo_count) && ++redo_count <= 2);
+ }
+
+ /*
+ * Set a flag that when pum_redraw() is called it first calls update_screen().
+ * This will avoid clearing and redrawing the popup menu, prevent flicker.
+ */
+ void
+ pum_call_update_screen()
+ {
+ call_update_screen = TRUE;
+
+ // Update the cursor position to be able to compute the popup menu
+ // position. The cursor line length may have changed because of the
+ // inserted completion.
+ curwin->w_valid &= ~(VALID_CROW|VALID_CHEIGHT);
+ validate_cursor();
+ }
+
+ /*
+ * Return TRUE if we are going to redraw the popup menu and the screen
position
+ * "row"/"col" is under the popup menu.
+ */
+ int
+ pum_under_menu(int row, int col)
+ {
+ return pum_skip_redraw
+ && row >= pum_row
+ && row < pum_row + pum_height
+ && col >= pum_col - 1
+ && col < pum_col + pum_width;
+ }
+
+ /*
+ * Redraw the popup menu, using "pum_first" and "pum_selected".
+ */
+ void
+ pum_redraw(void)
+ {
+ int row = pum_row;
+ int col;
+ int attr_norm = highlight_attr[HLF_PNI];
+ int attr_select = highlight_attr[HLF_PSI];
+ int attr_scroll = highlight_attr[HLF_PSB];
+ int attr_thumb = highlight_attr[HLF_PST];
+ int attr;
+ int i;
+ int idx;
+ char_u *s;
+ char_u *p = NULL;
+ int totwidth, width, w;
+ int thumb_pos = 0;
+ int thumb_height = 1;
+ int round;
+ int n;
+
+ if (call_update_screen)
+ {
+ call_update_screen = FALSE;
+ pum_skip_redraw = TRUE; // do not redraw in pum_may_redraw().
+ update_screen(0);
+ pum_skip_redraw = FALSE;
+ }
+
+ // never display more than we have
+ if (pum_first > pum_size - pum_height)
+ pum_first = pum_size - pum_height;
+
+ if (pum_scrollbar)
+ {
+ thumb_height = pum_height * pum_height / pum_size;
+ if (thumb_height == 0)
+ thumb_height = 1;
+ thumb_pos = (pum_first * (pum_height - thumb_height)
+ + (pum_size - pum_height) / 2)
+ / (pum_size - pum_height);
+ }
+
+ #ifdef FEAT_TEXT_PROP
+ // The popup menu is drawn over popup menus with zindex under
+ // POPUPMENU_ZINDEX.
+ screen_zindex = POPUPMENU_ZINDEX;
+ #endif
+
+ for (i = 0; i < pum_height; ++i)
+ {
+ idx = i + pum_first;
+ attr = (idx == pum_selected) ? attr_select : attr_norm;
+
+ /* prepend a space if there is room */
+ #ifdef FEAT_RIGHTLEFT
+ if (curwin->w_p_rl)
+ {
+ if (pum_col < curwin->w_wincol + curwin->w_width - 1)
+ screen_putchar(' ', row, pum_col + 1, attr);
+ }
+ else
+ #endif
+ if (pum_col > 0)
+ screen_putchar(' ', row, pum_col - 1, attr);
+
+ /* Display each entry, use two spaces for a Tab.
+ * Do this 3 times: For the main text, kind and extra info */
+ col = pum_col;
+ totwidth = 0;
+ for (round = 1; round <= 3; ++round)
+ {
+ width = 0;
+ s = NULL;
+ switch (round)
+ {
+ case 1: p = pum_array[idx].pum_text; break;
+ case 2: p = pum_array[idx].pum_kind; break;
+ case 3: p = pum_array[idx].pum_extra; break;
+ }
+ if (p != NULL)
+ for ( ; ; MB_PTR_ADV(p))
+ {
+ if (s == NULL)
+ s = p;
+ w = ptr2cells(p);
+ if (*p == NUL || *p == TAB || totwidth + w > pum_width)
+ {
+ /* Display the text that fits or comes before a Tab.
+ * First convert it to printable characters. */
+ char_u *st;
+ int saved = *p;
+
+ if (saved != NUL)
+ *p = NUL;
+ st = transstr(s);
+ if (saved != NUL)
+ *p = saved;
+ #ifdef FEAT_RIGHTLEFT
+ if (curwin->w_p_rl)
+ {
+ if (st != NULL)
+ {
+ char_u *rt = reverse_text(st);
+
+ if (rt != NULL)
+ {
+ char_u *rt_start = rt;
+ int size;
+
+ size = vim_strsize(rt);
+ if (size > pum_width)
+ {
+ do
+ {
+ size -= has_mbyte
+ ? (*mb_ptr2cells)(rt) : 1;
+ MB_PTR_ADV(rt);
+ } while (size > pum_width);
+
+ if (size < pum_width)
+ {
+ /* Most left character requires
+ * 2-cells but only 1 cell is
+ * available on screen. Put a
+ * '<' on the left of the pum
+ * item */
+ *(--rt) = '<';
+ size++;
+ }
+ }
+ screen_puts_len(rt, (int)STRLEN(rt),
+ row, col - size + 1, attr);
+ vim_free(rt_start);
+ }
+ vim_free(st);
+ }
+ col -= width;
+ }
+ else
+ #endif
+ {
+ if (st != NULL)
+ {
+ screen_puts_len(st, (int)STRLEN(st), row, col,
+ attr);
+ vim_free(st);
+ }
+ col += width;
+ }
+
+ if (*p != TAB)
+ break;
+
+ /* Display two spaces for a Tab. */
+ #ifdef FEAT_RIGHTLEFT
+ if (curwin->w_p_rl)
+ {
+ screen_puts_len((char_u *)" ", 2, row, col - 1,
+ attr);
+ col -= 2;
+ }
+ else
+ #endif
+ {
+ screen_puts_len((char_u *)" ", 2, row, col, attr);
+ col += 2;
+ }
+ totwidth += 2;
+ s = NULL; /* start text at next char */
+ width = 0;
+ }
+ else
+ width += w;
+ }
+
+ if (round > 1)
+ n = pum_kind_width + 1;
+ else
+ n = 1;
+
+ /* Stop when there is nothing more to display. */
+ if (round == 3
+ || (round == 2 && pum_array[idx].pum_extra == NULL)
+ || (round == 1 && pum_array[idx].pum_kind == NULL
+ && pum_array[idx].pum_extra == NULL)
+ || pum_base_width + n >= pum_width)
+ break;
+ #ifdef FEAT_RIGHTLEFT
+ if (curwin->w_p_rl)
+ {
+ screen_fill(row, row + 1, pum_col - pum_base_width - n + 1,
+ col + 1, ' ', ' ', attr);
+ col = pum_col - pum_base_width - n + 1;
+ }
+ else
+ #endif
+ {
+ screen_fill(row, row + 1, col, pum_col + pum_base_width + n,
+ ' ', ' ', attr);
+ col = pum_col + pum_base_width + n;
+ }
+ totwidth = pum_base_width + n;
+ }
+
+ #ifdef FEAT_RIGHTLEFT
+ if (curwin->w_p_rl)
+ screen_fill(row, row + 1, pum_col - pum_width + 1, col + 1, ' ',
+ ' ', attr);
+ else
+ #endif
+ screen_fill(row, row + 1, col, pum_col + pum_width, ' ', ' ',
+ attr);
+ if (pum_scrollbar > 0)
+ {
+ #ifdef FEAT_RIGHTLEFT
+ if (curwin->w_p_rl)
+ screen_putchar(' ', row, pum_col - pum_width,
+ i >= thumb_pos && i < thumb_pos + thumb_height
+ ? attr_thumb : attr_scroll);
+ else
+ #endif
+ screen_putchar(' ', row, pum_col + pum_width,
+ i >= thumb_pos && i < thumb_pos + thumb_height
+ ? attr_thumb : attr_scroll);
+ }
+
+ ++row;
+ }
+
+ #ifdef FEAT_TEXT_PROP
+ screen_zindex = 0;
+ #endif
+ }
+
+ #if defined(FEAT_TEXT_PROP) && defined(FEAT_QUICKFIX)
+ static void
+ pum_position_info_popup(void)
+ {
+ int col = pum_col + pum_width + 1;
+ int row = pum_row;
+ int botpos = POPPOS_BOTLEFT;
+
+ curwin->w_popup_pos = POPPOS_TOPLEFT;
+ if (Columns - col < 20 && Columns - col < pum_col)
+ {
+ col = pum_col - 1;
+ curwin->w_popup_pos = POPPOS_TOPRIGHT;
+ botpos = POPPOS_BOTRIGHT;
+ curwin->w_maxwidth = pum_col - 1;
+ }
+ else
+ curwin->w_maxwidth = Columns - col + 1;
+ curwin->w_maxwidth -= popup_extra_width(curwin);
+
+ row -= popup_top_extra(curwin);
+ if (curwin->w_popup_flags & POPF_INFO_MENU)
+ {
+ if (pum_row < pum_win_row)
+ {
+ // menu above cursor line, align with bottom
+ row += pum_height;
+ curwin->w_popup_pos = botpos;
+ }
+ else
+ // menu below cursor line, align with top
+ row += 1;
+ }
+ else
+ // align with the selected item
+ row += pum_selected - pum_first + 1;
+
+ popup_set_wantpos_rowcol(curwin, row, col);
+ }
+ #endif
+
+ /*
+ * Set the index of the currently selected item. The menu will scroll when
+ * necessary. When "n" is out of range don't scroll.
+ * This may be repeated when the preview window is used:
+ * "repeat" == 0: open preview window normally
+ * "repeat" == 1: open preview window but don't set the size
+ * "repeat" == 2: don't open preview window
+ * Returns TRUE when the window was resized and the location of the popup menu
+ * must be recomputed.
+ */
+ static int
+ pum_set_selected(int n, int repeat UNUSED)
+ {
+ int resized = FALSE;
+ int context = pum_height / 2;
+ #ifdef FEAT_QUICKFIX
+ int prev_selected = pum_selected;
+ #endif
+ #ifdef FEAT_TEXT_PROP
+ int has_info = FALSE;
+ #endif
+
+ pum_selected = n;
+
+ if (pum_selected >= 0 && pum_selected < pum_size)
+ {
+ if (pum_first > pum_selected - 4)
+ {
+ /* scroll down; when we did a jump it's probably a PageUp then
+ * scroll a whole page */
+ if (pum_first > pum_selected - 2)
+ {
+ pum_first -= pum_height - 2;
+ if (pum_first < 0)
+ pum_first = 0;
+ else if (pum_first > pum_selected)
+ pum_first = pum_selected;
+ }
+ else
+ pum_first = pum_selected;
+ }
+ else if (pum_first < pum_selected - pum_height + 5)
+ {
+ /* scroll up; when we did a jump it's probably a PageDown then
+ * scroll a whole page */
+ if (pum_first < pum_selected - pum_height + 1 + 2)
+ {
+ pum_first += pum_height - 2;
+ if (pum_first < pum_selected - pum_height + 1)
+ pum_first = pum_selected - pum_height + 1;
+ }
+ else
+ pum_first = pum_selected - pum_height + 1;
+ }
+
+ /* Give a few lines of context when possible. */
+ if (context > 3)
+ context = 3;
+ if (pum_height > 2)
+ {
+ if (pum_first > pum_selected - context)
+ {
+ /* scroll down */
+ pum_first = pum_selected - context;
+ if (pum_first < 0)
+ pum_first = 0;
+ }
+ else if (pum_first < pum_selected + context - pum_height + 1)
+ {
+ /* scroll up */
+ pum_first = pum_selected + context - pum_height + 1;
+ }
+ }
+ // adjust for the number of lines displayed
+ if (pum_first > pum_size - pum_height)
+ pum_first = pum_size - pum_height;
+
+ #if defined(FEAT_QUICKFIX)
+ /*
+ * Show extra info in the preview window if there is something and
+ * 'completeopt' contains "preview" or "popup".
+ * Skip this when tried twice already.
+ * Skip this also when there is not much room.
+ * NOTE: Be very careful not to sync undo!
+ */
+ if (pum_array[pum_selected].pum_info != NULL
+ && Rows > 10
+ && repeat <= 1
+ && vim_strchr(p_cot, 'p') != NULL)
+ {
+ win_T *curwin_save = curwin;
+ tabpage_T *curtab_save = curtab;
+ int res = OK;
+ # ifdef FEAT_TEXT_PROP
+ int use_popup = strstr((char *)p_cot, "popup") != NULL;
+ # else
+ # define use_popup 0
+ # endif
+ # ifdef FEAT_TEXT_PROP
+ has_info = TRUE;
+ # endif
+ // Open a preview window. 3 lines by default. Prefer
+ // 'previewheight' if set and smaller.
+ g_do_tagpreview = 3;
+ if (p_pvh > 0 && p_pvh < g_do_tagpreview)
+ g_do_tagpreview = p_pvh;
+ ++RedrawingDisabled;
+ // Prevent undo sync here, if an autocommand syncs undo weird
+ // things can happen to the undo tree.
+ ++no_u_sync;
+ resized = prepare_tagpreview(FALSE, FALSE, use_popup);
+ --no_u_sync;
+ --RedrawingDisabled;
+ g_do_tagpreview = 0;
+
+ if (curwin->w_p_pvw
+ # ifdef FEAT_TEXT_PROP
+ || (curwin->w_popup_flags & POPF_INFO)
+ # endif
+ )
+ {
+ if (!resized
+ && curbuf->b_nwindows == 1
+ && curbuf->b_fname == NULL
+ && bt_nofile(curbuf)
+ && curbuf->b_p_bh[0] == 'w')
+ {
+ // Already a "wipeout" buffer, make it empty.
+ while (!BUFEMPTY())
+ ml_delete((linenr_T)1, FALSE);
+ }
+ else
+ {
+ // Don't want to sync undo in the current buffer.
+ ++no_u_sync;
+ res = do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, 0, NULL);
+ --no_u_sync;
+ if (res == OK)
+ {
+ // Edit a new, empty buffer. Set options for a "wipeout"
+ // buffer.
+ set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL);
+ set_option_value((char_u *)"bt", 0L,
+ (char_u *)"nofile", OPT_LOCAL);
+ set_option_value((char_u *)"bh", 0L,
+ (char_u *)"wipe", OPT_LOCAL);
+ set_option_value((char_u *)"diff", 0L,
+ NULL, OPT_LOCAL);
+ }
+ }
+ if (res == OK)
+ {
+ char_u *p, *e;
+ linenr_T lnum = 0;
+
+ for (p = pum_array[pum_selected].pum_info; *p != NUL; )
+ {
+ e = vim_strchr(p, '\n');
+ if (e == NULL)
+ {
+ ml_append(lnum++, p, 0, FALSE);
+ break;
+ }
+ else
+ {
+ *e = NUL;
+ ml_append(lnum++, p, (int)(e - p + 1), FALSE);
+ *e = '\n';
+ p = e + 1;
+ }
+ }
+ // delete the empty last line
+ ml_delete(curbuf->b_ml.ml_line_count, FALSE);
+
+ /* Increase the height of the preview window to show the
+ * text, but no more than 'previewheight' lines. */
+ if (repeat == 0 && !use_popup)
+ {
+ if (lnum > p_pvh)
+ lnum = p_pvh;
+ if (curwin->w_height < lnum)
+ {
+ win_setheight((int)lnum);
+ resized = TRUE;
+ }
+ }
+
+ curbuf->b_changed = 0;
+ curbuf->b_p_ma = FALSE;
+ if (pum_selected != prev_selected)
+ {
+ # ifdef FEAT_TEXT_PROP
+ curwin->w_firstline = 1;
+ # endif
+ curwin->w_topline = 1;
+ }
+ else if (curwin->w_topline > curbuf->b_ml.ml_line_count)
+ curwin->w_topline = curbuf->b_ml.ml_line_count;
+ curwin->w_cursor.lnum = curwin->w_topline;
+ curwin->w_cursor.col = 0;
+ # ifdef FEAT_TEXT_PROP
+ if (use_popup)
+ {
+ pum_position_info_popup();
+ if (win_valid(curwin_save))
+ redraw_win_later(curwin_save, SOME_VALID);
+ }
+ # endif
+ if ((curwin != curwin_save && win_valid(curwin_save))
+ || (curtab != curtab_save
+ && valid_tabpage(curtab_save)))
+ {
+ if (curtab != curtab_save && valid_tabpage(curtab_save))
+ goto_tabpage_tp(curtab_save, FALSE, FALSE);
+
+ /* When the first completion is done and the preview
+ * window is not resized, skip the preview window's
+ * status line redrawing. */
+ if (ins_compl_active() && !resized)
+ curwin->w_redr_status = FALSE;
+
+ /* Return cursor to where we were */
+ validate_cursor();
+ redraw_later(SOME_VALID);
+
+ /* When the preview window was resized we need to
+ * update the view on the buffer. Only go back to
+ * the window when needed, otherwise it will always be
+ * redraw. */
+ if (resized && win_valid(curwin_save))
+ {
+ ++no_u_sync;
+ win_enter(curwin_save, TRUE);
+ --no_u_sync;
+ update_topline();
+ }
+
+ /* Update the screen before drawing the popup menu.
+ * Enable updating the status lines. */
+ pum_do_redraw = TRUE;
+ update_screen(0);
+ pum_do_redraw = FALSE;
+
+ if (!resized && win_valid(curwin_save))
+ {
+ ++no_u_sync;
+ win_enter(curwin_save, TRUE);
+ --no_u_sync;
+ }
+
+ /* May need to update the screen again when there are
+ * autocommands involved. */
+ pum_do_redraw = TRUE;
+ update_screen(0);
+ pum_do_redraw = FALSE;
+ call_update_screen = FALSE;
+ }
+ }
+ }
+ # if defined(FEAT_TEXT_PROP) && defined(FEAT_QUICKFIX)
+ if (WIN_IS_POPUP(curwin))
+ // can't keep focus in a popup window
+ win_enter(firstwin, TRUE);
+ # endif
+ }
+ #endif
+ }
+ #if defined(FEAT_TEXT_PROP) && defined(FEAT_QUICKFIX)
+ if (!has_info)
+ // hide any popup info window
+ popup_hide_info();
+ #endif
+
+ if (!resized)
+ pum_redraw();
+
+ return resized;
+ }
+
+ /*
+ * Undisplay the popup menu (later).
+ */
+ void
+ pum_undisplay(void)
+ {
+ pum_array = NULL;
+ redraw_all_later(NOT_VALID);
+ redraw_tabline = TRUE;
+ status_redraw_all();
+ #if defined(FEAT_TEXT_PROP) && defined(FEAT_QUICKFIX)
+ // hide any popup info window
+ popup_hide_info();
+ #endif
+ }
+
+ /*
+ * Clear the popup menu. Currently only resets the offset to the first
+ * displayed item.
+ */
+ void
+ pum_clear(void)
+ {
+ pum_first = 0;
+ }
+
+ /*
+ * Return TRUE if the popup menu is displayed.
+ * Overruled when "pum_do_redraw" is set, used to redraw the status lines.
+ */
+ int
+ pum_visible(void)
+ {
+ return !pum_do_redraw && pum_array != NULL;
+ }
+
+ /*
+ * Reposition the popup menu to adjust for window layout changes.
+ */
+ void
+ pum_may_redraw(void)
+ {
+ pumitem_T *array = pum_array;
+ int len = pum_size;
+ int selected = pum_selected;
+
+ if (!pum_visible() || pum_skip_redraw)
+ return; // nothing to do
+
+ if (pum_window != curwin
+ || (pum_win_row == curwin->w_wrow + W_WINROW(curwin)
+ && pum_win_height == curwin->w_height
+ && pum_win_col == curwin->w_wincol
+ && pum_win_width == curwin->w_width))
+ {
+ // window position didn't change, redraw in the same position
+ pum_redraw();
+ }
+ else
+ {
+ int wcol = curwin->w_wcol;
+
+ // Window layout changed, recompute the position.
+ // Use the remembered w_wcol value, the cursor may have moved when a
+ // completion was inserted, but we want the menu in the same position.
+ pum_undisplay();
+ curwin->w_wcol = pum_win_wcol;
+ curwin->w_valid |= VALID_WCOL;
+ pum_display(array, len, selected);
+ curwin->w_wcol = wcol;
+ }
+ }
+
+ /*
+ * Return the height of the popup menu, the number of entries visible.
+ * Only valid when pum_visible() returns TRUE!
+ */
+ int
+ pum_get_height(void)
+ {
+ return pum_height;
+ }
+
+ #if defined(FEAT_EVAL) || defined(PROTO)
+ /*
+ * Add size information about the pum to "dict".
+ */
+ void
+ pum_set_event_info(dict_T *dict)
+ {
+ if (!pum_visible())
+ return;
+ dict_add_number(dict, "height", pum_height);
+ dict_add_number(dict, "width", pum_width);
+ dict_add_number(dict, "row", pum_row);
+ dict_add_number(dict, "col", pum_col);
+ dict_add_number(dict, "size", pum_size);
+ dict_add_special(dict, "scrollbar", pum_scrollbar ? VVAL_TRUE :
VVAL_FALSE);
+ }
+ #endif
+
+ #if defined(FEAT_BEVAL_TERM) || defined(FEAT_TERM_POPUP_MENU) ||
defined(PROTO)
+ static void
+ pum_position_at_mouse(int min_width)
+ {
+ if (Rows - mouse_row > pum_size)
+ {
+ /* Enough space below the mouse row. */
+ pum_row = mouse_row + 1;
+ if (pum_height > Rows - pum_row)
+ pum_height = Rows - pum_row;
+ }
+ else
+ {
+ /* Show above the mouse row, reduce height if it does not fit. */
+ pum_row = mouse_row - pum_size;
+ if (pum_row < 0)
+ {
+ pum_height += pum_row;
+ pum_row = 0;
+ }
+ }
+ if (Columns - mouse_col >= pum_base_width
+ || Columns - mouse_col > min_width)
+ /* Enough space to show at mouse column. */
+ pum_col = mouse_col;
+ else
+ /* Not enough space, right align with window. */
+ pum_col = Columns - (pum_base_width > min_width
+ ? min_width : pum_base_width);
+
+ pum_width = Columns - pum_col;
+ if (pum_width > pum_base_width + 1)
+ pum_width = pum_base_width + 1;
+
+ // Do not redraw at cursor position.
+ pum_window = NULL;
+ }
+
+ #endif
+
+ #if defined(FEAT_BEVAL_TERM) || defined(PROTO)
+ static pumitem_T *balloon_array = NULL;
+ static int balloon_arraysize;
+
+ # define BALLOON_MIN_WIDTH 50
+ # define BALLOON_MIN_HEIGHT 10
+
+ typedef struct {
+ char_u *start;
+ int bytelen;
+ int cells;
+ int indent;
+ } balpart_T;
+
+ /*
+ * Split a string into parts to display in the balloon.
+ * Aimed at output from gdb. Attempts to split at white space, preserve
quoted
+ * strings and make a struct look good.
+ * Resulting array is stored in "array" and returns the size of the array.
+ */
+ int
+ split_message(char_u *mesg, pumitem_T **array)
+ {
+ garray_T ga;
+ char_u *p;
+ balpart_T *item;
+ int quoted = FALSE;
+ int height;
+ int line;
+ int item_idx;
+ int indent = 0;
+ int max_cells = 0;
+ int max_height = Rows / 2 - 2;
+ int long_item_count = 0;
+ int split_long_items = FALSE;
+
+ ga_init2(&ga, sizeof(balpart_T), 20);
+ p = mesg;
+
+ while (*p != NUL)
+ {
+ if (ga_grow(&ga, 1) == FAIL)
+ goto failed;
+ item = ((balpart_T *)ga.ga_data) + ga.ga_len;
+ item->start = p;
+ item->indent = indent;
+ item->cells = indent * 2;
+ ++ga.ga_len;
+ while (*p != NUL)
+ {
+ if (*p == '"')
+ quoted = !quoted;
+ else if (*p == '\\' && p[1] != NUL)
+ ++p;
+ else if (!quoted)
+ {
+ if ((*p == ',' && p[1] == ' ') || *p == '{' || *p == '}')
+ {
+ /* Looks like a good point to break. */
+ if (*p == '{')
+ ++indent;
+ else if (*p == '}' && indent > 0)
+ --indent;
+ ++item->cells;
+ p = skipwhite(p + 1);
+ break;
+ }
+ }
+ item->cells += ptr2cells(p);
+ p += MB_PTR2LEN(p);
+ }
+ item->bytelen = p - item->start;
+ if (item->cells > max_cells)
+ max_cells = item->cells;
+ long_item_count += (item->cells - 1) / BALLOON_MIN_WIDTH;
+ }
+
+ height = 2 + ga.ga_len;
+
+ /* If there are long items and the height is below the limit: split lines
*/
+ if (long_item_count > 0 && height + long_item_count <= max_height)
+ {
+ split_long_items = TRUE;
+ height += long_item_count;
+ }
+
+ /* Limit to half the window height, it has to fit above or below the mouse
+ * position. */
+ if (height > max_height)
+ height = max_height;
+ *array = ALLOC_CLEAR_MULT(pumitem_T, height);
+ if (*array == NULL)
+ goto failed;
+
+ /* Add an empty line above and below, looks better. */
+ (*array)->pum_text = vim_strsave((char_u *)"");
+ (*array + height - 1)->pum_text = vim_strsave((char_u *)"");
+
+ for (line = 1, item_idx = 0; line < height - 1; ++item_idx)
+ {
+ int skip;
+ int thislen;
+ int copylen;
+ int ind;
+ int cells;
+
+ item = ((balpart_T *)ga.ga_data) + item_idx;
+ for (skip = 0; skip < item->bytelen; skip += thislen)
+ {
+ if (split_long_items && item->cells >= BALLOON_MIN_WIDTH)
+ {
+ cells = item->indent * 2;
+ for (p = item->start + skip; p < item->start + item->bytelen;
+ p += MB_PTR2LEN(p))
+ if ((cells += ptr2cells(p)) > BALLOON_MIN_WIDTH)
+ break;
+ thislen = p - (item->start + skip);
+ }
+ else
+ thislen = item->bytelen;
+
+ // put indent at the start
+ p = alloc(thislen + item->indent * 2 + 1);
+ if (p == NULL)
+ {
+ for (line = 0; line <= height - 1; ++line)
+ vim_free((*array)[line].pum_text);
+ vim_free(*array);
+ goto failed;
+ }
+ for (ind = 0; ind < item->indent * 2; ++ind)
+ p[ind] = ' ';
+
+ // exclude spaces at the end of the string
+ for (copylen = thislen; copylen > 0; --copylen)
+ if (item->start[skip + copylen - 1] != ' ')
+ break;
+
+ vim_strncpy(p + ind, item->start + skip, copylen);
+ (*array)[line].pum_text = p;
+ item->indent = 0; /* wrapped line has no indent */
+ ++line;
+ }
+ }
+ ga_clear(&ga);
+ return height;
+
+ failed:
+ ga_clear(&ga);
+ return 0;
+ }
+
+ void
+ ui_remove_balloon(void)
+ {
+ if (balloon_array != NULL)
+ {
+ pum_undisplay();
+ while (balloon_arraysize > 0)
+ vim_free(balloon_array[--balloon_arraysize].pum_text);
+ VIM_CLEAR(balloon_array);
+ }
+ }
+
+ /*
+ * Terminal version of a balloon, uses the popup menu code.
+ */
+ void
+ ui_post_balloon(char_u *mesg, list_T *list)
+ {
+ ui_remove_balloon();
+
+ if (mesg == NULL && list == NULL)
+ {
+ pum_undisplay();
+ return;
+ }
+ if (list != NULL)
+ {
+ listitem_T *li;
+ int idx;
+
+ balloon_arraysize = list->lv_len;
+ balloon_array = ALLOC_CLEAR_MULT(pumitem_T, list->lv_len);
+ if (balloon_array == NULL)
+ return;
+ for (idx = 0, li = list->lv_first; li != NULL; li = li->li_next, ++idx)
+ {
+ char_u *text = tv_get_string_chk(&li->li_tv);
+
+ balloon_array[idx].pum_text = vim_strsave(
+ text == NULL ? (char_u *)"" : text);
+ }
+ }
+ else
+ balloon_arraysize = split_message(mesg, &balloon_array);
+
+ if (balloon_arraysize > 0)
+ {
+ pum_array = balloon_array;
+ pum_size = balloon_arraysize;
+ pum_compute_size();
+ pum_scrollbar = 0;
+ pum_height = balloon_arraysize;
+
+ pum_position_at_mouse(BALLOON_MIN_WIDTH);
+ pum_selected = -1;
+ pum_first = 0;
+ pum_redraw();
+ }
+ }
+
+ /*
+ * Called when the mouse moved, may remove any displayed balloon.
+ */
+ void
+ ui_may_remove_balloon(void)
+ {
+ // For now: remove the balloon whenever the mouse moves to another screen
+ // cell.
+ ui_remove_balloon();
+ }
+ #endif
+
+ #if defined(FEAT_TERM_POPUP_MENU) || defined(PROTO)
+ /*
+ * Select the pum entry at the mouse position.
+ */
+ static void
+ pum_select_mouse_pos(void)
+ {
+ int idx = mouse_row - pum_row;
+
+ if (idx < 0 || idx >= pum_size)
+ pum_selected = -1;
+ else if (*pum_array[idx].pum_text != NUL)
+ pum_selected = idx;
+ }
+
+ /*
+ * Execute the currently selected popup menu item.
+ */
+ static void
+ pum_execute_menu(vimmenu_T *menu, int mode)
+ {
+ vimmenu_T *mp;
+ int idx = 0;
+ exarg_T ea;
+
+ for (mp = menu->children; mp != NULL; mp = mp->next)
+ if ((mp->modes & mp->enabled & mode) && idx++ == pum_selected)
+ {
+ vim_memset(&ea, 0, sizeof(ea));
+ execute_menu(&ea, mp, -1);
+ break;
+ }
+ }
+
+ /*
+ * Open the terminal version of the popup menu and don't return until it is
+ * closed.
+ */
+ void
+ pum_show_popupmenu(vimmenu_T *menu)
+ {
+ vimmenu_T *mp;
+ int idx = 0;
+ pumitem_T *array;
+ # ifdef FEAT_BEVAL_TERM
+ int save_bevalterm = p_bevalterm;
+ # endif
+ int mode;
+
+ pum_undisplay();
+ pum_size = 0;
+ mode = get_menu_mode_flag();
+
+ for (mp = menu->children; mp != NULL; mp = mp->next)
+ if (menu_is_separator(mp->dname)
+ || (mp->modes & mp->enabled & mode))
+ ++pum_size;
+
+ // When there are only Terminal mode menus, using "popup Edit" results in
+ // pum_size being zero.
+ if (pum_size <= 0)
+ {
+ emsg(e_menuothermode);
+ return;
+ }
+
+ array = ALLOC_CLEAR_MULT(pumitem_T, pum_size);
+ if (array == NULL)
+ return;
+
+ for (mp = menu->children; mp != NULL; mp = mp->next)
+ if (menu_is_separator(mp->dname))
+ array[idx++].pum_text = (char_u *)"";
+ else if (mp->modes & mp->enabled & mode)
+ array[idx++].pum_text = mp->dname;
+
+ pum_array = array;
+ pum_compute_size();
+ pum_scrollbar = 0;
+ pum_height = pum_size;
+ pum_position_at_mouse(20);
+
+ pum_selected = -1;
+ pum_first = 0;
+ # ifdef FEAT_BEVAL_TERM
+ p_bevalterm = TRUE; /* track mouse movement */
+ mch_setmouse(TRUE);
+ # endif
+
+ for (;;)
+ {
+ int c;
+
+ pum_redraw();
+ setcursor_mayforce(TRUE);
+ out_flush();
+
+ c = vgetc();
+
+ // Bail out when typing Esc, CTRL-C or some callback closed the popup
+ // menu.
+ if (c == ESC || c == Ctrl_C || pum_array == NULL)
+ break;
+ else if (c == CAR || c == NL)
+ {
+ /* enter: select current item, if any, and close */
+ pum_execute_menu(menu, mode);
+ break;
+ }
+ else if (c == 'k' || c == K_UP || c == K_MOUSEUP)
+ {
+ /* cursor up: select previous item */
+ while (pum_selected > 0)
+ {
+ --pum_selected;
+ if (*array[pum_selected].pum_text != NUL)
+ break;
+ }
+ }
+ else if (c == 'j' || c == K_DOWN || c == K_MOUSEDOWN)
+ {
+ /* cursor down: select next item */
+ while (pum_selected < pum_size - 1)
+ {
+ ++pum_selected;
+ if (*array[pum_selected].pum_text != NUL)
+ break;
+ }
+ }
+ else if (c == K_RIGHTMOUSE)
+ {
+ /* Right mouse down: reposition the menu. */
+ vungetc(c);
+ break;
+ }
+ else if (c == K_LEFTDRAG || c == K_RIGHTDRAG || c == K_MOUSEMOVE)
+ {
+ /* mouse moved: select item in the mouse row */
+ pum_select_mouse_pos();
+ }
+ else if (c == K_LEFTMOUSE || c == K_LEFTMOUSE_NM || c == K_RIGHTRELEASE)
+ {
+ /* left mouse click: select clicked item, if any, and close;
+ * right mouse release: select clicked item, close if any */
+ pum_select_mouse_pos();
+ if (pum_selected >= 0)
+ {
+ pum_execute_menu(menu, mode);
+ break;
+ }
+ if (c == K_LEFTMOUSE || c == K_LEFTMOUSE_NM)
+ break;
+ }
+ }
+
+ vim_free(array);
+ pum_undisplay();
+ # ifdef FEAT_BEVAL_TERM
+ p_bevalterm = save_bevalterm;
+ mch_setmouse(TRUE);
+ # endif
+ }
+
+ void
+ pum_make_popup(char_u *path_name, int use_mouse_pos)
+ {
+ vimmenu_T *menu;
+
+ if (!use_mouse_pos)
+ {
+ /* Hack: set mouse position at the cursor so that the menu pops up
+ * around there. */
+ mouse_row = curwin->w_winrow + curwin->w_wrow;
+ mouse_col = curwin->w_wincol + curwin->w_wcol;
+ }
+
+ menu = gui_find_menu(path_name);
+ if (menu != NULL)
+ pum_show_popupmenu(menu);
+ }
+ #endif
*** ../vim-8.1.2081/src/proto/popupmnu.pro 2019-04-08 18:15:36.472223190
+0200
--- src/proto/popupmnu.pro 2019-09-27 12:49:30.472089296 +0200
***************
*** 1,4 ****
! /* popupmnu.c */
void pum_display(pumitem_T *array, int size, int selected);
void pum_call_update_screen(void);
int pum_under_menu(int row, int col);
--- 1,4 ----
! /* popupmenu.c */
void pum_display(pumitem_T *array, int size, int selected);
void pum_call_update_screen(void);
int pum_under_menu(int row, int col);
*** ../vim-8.1.2081/src/proto/popupmenu.pro 2019-09-27 13:07:04.830120777
+0200
--- src/proto/popupmenu.pro 2019-04-08 18:06:01.919216971 +0200
***************
*** 0 ****
--- 1,18 ----
+ /* popupmnu.c */
+ void pum_display(pumitem_T *array, int size, int selected);
+ void pum_call_update_screen(void);
+ int pum_under_menu(int row, int col);
+ void pum_redraw(void);
+ void pum_undisplay(void);
+ void pum_clear(void);
+ int pum_visible(void);
+ void pum_may_redraw(void);
+ int pum_get_height(void);
+ void pum_set_event_info(dict_T *dict);
+ int split_message(char_u *mesg, pumitem_T **array);
+ void ui_remove_balloon(void);
+ void ui_post_balloon(char_u *mesg, list_T *list);
+ void ui_may_remove_balloon(void);
+ void pum_show_popupmenu(vimmenu_T *menu);
+ void pum_make_popup(char_u *path_name, int use_mouse_pos);
+ /* vim: set ft=c : */
*** ../vim-8.1.2081/src/Make_cyg_ming.mak 2019-09-27 12:41:35.007573135
+0200
--- src/Make_cyg_ming.mak 2019-09-27 12:55:04.334058171 +0200
***************
*** 764,770 ****
$(OUTDIR)/os_mswin.o \
$(OUTDIR)/os_win32.o \
$(OUTDIR)/pathdef.o \
! $(OUTDIR)/popupmnu.o \
$(OUTDIR)/popupwin.o \
$(OUTDIR)/profiler.o \
$(OUTDIR)/quickfix.o \
--- 764,770 ----
$(OUTDIR)/os_mswin.o \
$(OUTDIR)/os_win32.o \
$(OUTDIR)/pathdef.o \
! $(OUTDIR)/popupmenu.o \
$(OUTDIR)/popupwin.o \
$(OUTDIR)/profiler.o \
$(OUTDIR)/quickfix.o \
***************
*** 1015,1021 ****
LFLAGS += -Wl,-Map=$(TARGET).map
endif
! all: $(MAIN_TARGET) vimrun.exe xxd/xxd.exe tee/tee.exe install.exe
uninstal.exe GvimExt/gvimext.dll
vimrun.exe: vimrun.c
$(CC) $(CFLAGS) -o vimrun.exe vimrun.c $(LIB)
--- 1015,1021 ----
LFLAGS += -Wl,-Map=$(TARGET).map
endif
! all: $(MAIN_TARGET) vimrun.exe xxd/xxd.exe tee/tee.exe install.exe
uninstall.exe GvimExt/gvimext.dll
vimrun.exe: vimrun.c
$(CC) $(CFLAGS) -o vimrun.exe vimrun.c $(LIB)
***************
*** 1023,1030 ****
install.exe: dosinst.c
$(CC) $(CFLAGS) -o install.exe dosinst.c $(LIB) -lole32 -luuid
! uninstal.exe: uninstal.c
! $(CC) $(CFLAGS) -o uninstal.exe uninstal.c $(LIB) -lole32
ifeq ($(VIMDLL),yes)
$(TARGET): $(OUTDIR) $(OBJ)
--- 1023,1030 ----
install.exe: dosinst.c
$(CC) $(CFLAGS) -o install.exe dosinst.c $(LIB) -lole32 -luuid
! uninstall.exe: uninstall.c
! $(CC) $(CFLAGS) -o uninstall.exe uninstall.c $(LIB) -lole32
ifeq ($(VIMDLL),yes)
$(TARGET): $(OUTDIR) $(OBJ)
***************
*** 1068,1074 ****
-$(DEL) $(OUTDIR)$(DIRSLASH)*.res
-$(DEL) $(OUTDIR)$(DIRSLASH)pathdef.c
-rmdir $(OUTDIR)
! -$(DEL) $(MAIN_TARGET) vimrun.exe install.exe uninstal.exe
ifdef PERL
-$(DEL) if_perl.c
-$(DEL) auto$(DIRSLASH)if_perl.c
--- 1068,1074 ----
-$(DEL) $(OUTDIR)$(DIRSLASH)*.res
-$(DEL) $(OUTDIR)$(DIRSLASH)pathdef.c
-rmdir $(OUTDIR)
! -$(DEL) $(MAIN_TARGET) vimrun.exe install.exe uninstall.exe
ifdef PERL
-$(DEL) if_perl.c
-$(DEL) auto$(DIRSLASH)if_perl.c
*** ../vim-8.1.2081/src/Make_morph.mak 2019-09-27 12:41:35.007573135 +0200
--- src/Make_morph.mak 2019-09-27 12:47:50.532747497 +0200
***************
*** 81,87 ****
option.c \
optionstr.c \
os_amiga.c \
! popupmnu.c \
profiler.c \
quickfix.c \
regexp.c \
--- 81,87 ----
option.c \
optionstr.c \
os_amiga.c \
! popupmenu.c \
profiler.c \
quickfix.c \
regexp.c \
*** ../vim-8.1.2081/src/Make_mvc.mak 2019-09-27 12:41:35.007573135 +0200
--- src/Make_mvc.mak 2019-09-27 12:55:31.897899015 +0200
***************
*** 771,777 ****
$(OUTDIR)\os_mswin.obj \
$(OUTDIR)\os_win32.obj \
$(OUTDIR)\pathdef.obj \
! $(OUTDIR)\popupmnu.obj \
$(OUTDIR)\popupwin.obj \
$(OUTDIR)\profiler.obj \
$(OUTDIR)\quickfix.obj \
--- 771,777 ----
$(OUTDIR)\os_mswin.obj \
$(OUTDIR)\os_win32.obj \
$(OUTDIR)\pathdef.obj \
! $(OUTDIR)\popupmenu.obj \
$(OUTDIR)\popupwin.obj \
$(OUTDIR)\profiler.obj \
$(OUTDIR)\quickfix.obj \
***************
*** 1280,1286 ****
all: $(MAIN_TARGET) \
vimrun.exe \
install.exe \
! uninstal.exe \
xxd/xxd.exe \
tee/tee.exe \
GvimExt/gvimext.dll
--- 1280,1286 ----
all: $(MAIN_TARGET) \
vimrun.exe \
install.exe \
! uninstall.exe \
xxd/xxd.exe \
tee/tee.exe \
GvimExt/gvimext.dll
***************
*** 1339,1346 ****
- if exist install.exe del install.exe
ren dosinst.exe install.exe
! uninstal.exe: uninstal.c
! $(CC) /nologo -DNDEBUG -DWIN32 uninstal.c shell32.lib advapi32.lib \
-link -subsystem:$(SUBSYSTEM_TOOLS)
vimrun.exe: vimrun.c
--- 1339,1346 ----
- if exist install.exe del install.exe
ren dosinst.exe install.exe
! uninstall.exe: uninstall.c
! $(CC) /nologo -DNDEBUG -DWIN32 uninstall.c shell32.lib advapi32.lib \
-link -subsystem:$(SUBSYSTEM_TOOLS)
vimrun.exe: vimrun.c
***************
*** 1387,1393 ****
!endif
- if exist vimrun.exe del vimrun.exe
- if exist install.exe del install.exe
! - if exist uninstal.exe del uninstal.exe
- if exist if_perl.c del if_perl.c
- if exist auto\if_perl.c del auto\if_perl.c
- if exist dimm.h del dimm.h
--- 1387,1393 ----
!endif
- if exist vimrun.exe del vimrun.exe
- if exist install.exe del install.exe
! - if exist uninstall.exe del uninstall.exe
- if exist if_perl.c del if_perl.c
- if exist auto\if_perl.c del auto\if_perl.c
- if exist dimm.h del dimm.h
***************
*** 1643,1649 ****
$(OUTDIR)/pathdef.obj: $(OUTDIR) $(PATHDEF_SRC) $(INCL)
$(CC) $(CFLAGS_OUTDIR) $(PATHDEF_SRC)
! $(OUTDIR)/popupmnu.obj: $(OUTDIR) popupmnu.c $(INCL)
$(OUTDIR)/popupwin.obj: $(OUTDIR) popupwin.c $(INCL)
--- 1643,1649 ----
$(OUTDIR)/pathdef.obj: $(OUTDIR) $(PATHDEF_SRC) $(INCL)
$(CC) $(CFLAGS_OUTDIR) $(PATHDEF_SRC)
! $(OUTDIR)/popupmenu.obj: $(OUTDIR) popupmenu.c $(INCL)
$(OUTDIR)/popupwin.obj: $(OUTDIR) popupwin.c $(INCL)
***************
*** 1841,1847 ****
proto/os_mswin.pro \
proto/winclip.pro \
proto/os_win32.pro \
! proto/popupmnu.pro \
proto/popupwin.pro \
proto/profiler.pro \
proto/quickfix.pro \
--- 1841,1847 ----
proto/os_mswin.pro \
proto/winclip.pro \
proto/os_win32.pro \
! proto/popupmenu.pro \
proto/popupwin.pro \
proto/profiler.pro \
proto/quickfix.pro \
*** ../vim-8.1.2081/src/Make_vms.mms 2019-09-27 12:41:35.007573135 +0200
--- src/Make_vms.mms 2019-09-27 12:48:34.728452771 +0200
***************
*** 2,8 ****
# Makefile for Vim on OpenVMS
#
# Maintainer: Zoltan Arpadffy <[email protected]>
! # Last change: 2019 Sep 04
#
# This has script been tested on VMS 6.2 to 8.2 on DEC Alpha, VAX and IA64
# with MMS and MMK
--- 2,8 ----
# Makefile for Vim on OpenVMS
#
# Maintainer: Zoltan Arpadffy <[email protected]>
! # Last change: 2019 Sep 27
#
# This has script been tested on VMS 6.2 to 8.2 on DEC Alpha, VAX and IA64
# with MMS and MMK
***************
*** 318,324 ****
indent.c insexpand.c json.c list.c main.c map.c mark.c menu.c mbyte.c \
memfile.c memline.c message.c misc1.c misc2.c mouse.c move.c normal.c \
ops.c \
! option.c optionstr.c popupmnu.c popupwin.c profiler.c quickfix.c \
regexp.c register.c scriptfile.c \
search.c session.c sha256.c sign.c spell.c spellfile.c spellsuggest.c \
syntax.c tag.c \
--- 318,324 ----
indent.c insexpand.c json.c list.c main.c map.c mark.c menu.c mbyte.c \
memfile.c memline.c message.c misc1.c misc2.c mouse.c move.c normal.c \
ops.c \
! option.c optionstr.c popupmenu.c popupwin.c profiler.c quickfix.c \
regexp.c register.c scriptfile.c \
search.c session.c sha256.c sign.c spell.c spellfile.c spellsuggest.c \
syntax.c tag.c \
***************
*** 340,346 ****
map.obj mark.obj menu.obj memfile.obj memline.obj message.obj \
misc1.obj misc2.obj mouse.obj move.obj mbyte.obj normal.obj ops.obj \
option.obj \
! optionstr.obj popupmnu.obj popupwin.obj profiler.obj quickfix.obj \
regexp.obj register.obj scriptfile.obj \
search.obj session.obj sha256.obj sign.obj spell.obj spellfile.obj \
spellsuggest.obj syntax.obj tag.obj term.obj termlib.obj testing.obj \
--- 340,346 ----
map.obj mark.obj menu.obj memfile.obj memline.obj message.obj \
misc1.obj misc2.obj mouse.obj move.obj mbyte.obj normal.obj ops.obj \
option.obj \
! optionstr.obj popupmenu.obj popupwin.obj profiler.obj quickfix.obj \
regexp.obj register.obj scriptfile.obj \
search.obj session.obj sha256.obj sign.obj spell.obj spellfile.obj \
spellsuggest.obj syntax.obj tag.obj term.obj termlib.obj testing.obj \
***************
*** 737,743 ****
ascii.h keymap.h term.h macros.h structs.h regexp.h \
gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \
globals.h
! popupmnu.obj : popupmnu.c vim.h [.auto]config.h feature.h os_unix.h \
ascii.h keymap.h term.h macros.h structs.h regexp.h \
gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \
globals.h
--- 737,743 ----
ascii.h keymap.h term.h macros.h structs.h regexp.h \
gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \
globals.h
! popupmenu.obj : popupmenu.c vim.h [.auto]config.h feature.h os_unix.h \
ascii.h keymap.h term.h macros.h structs.h regexp.h \
gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \
globals.h
*** ../vim-8.1.2081/src/Makefile 2019-09-27 12:41:35.007573135 +0200
--- src/Makefile 2019-09-27 12:48:51.272343976 +0200
***************
*** 1638,1644 ****
optionstr.c \
os_unix.c \
auto/pathdef.c \
! popupmnu.c \
popupwin.c \
profiler.c \
pty.c \
--- 1640,1646 ----
optionstr.c \
os_unix.c \
auto/pathdef.c \
! popupmenu.c \
popupwin.c \
profiler.c \
pty.c \
***************
*** 1774,1780 ****
objects/optionstr.o \
objects/os_unix.o \
objects/pathdef.o \
! objects/popupmnu.o \
objects/popupwin.o \
objects/profiler.o \
objects/pty.o \
--- 1776,1782 ----
objects/optionstr.o \
objects/os_unix.o \
objects/pathdef.o \
! objects/popupmenu.o \
objects/popupwin.o \
objects/profiler.o \
objects/pty.o \
***************
*** 1935,1941 ****
optionstr.pro \
os_mac_conv.pro \
os_unix.pro \
! popupmnu.pro \
popupwin.pro \
profiler.pro \
pty.pro \
--- 1937,1943 ----
optionstr.pro \
os_mac_conv.pro \
os_unix.pro \
! popupmenu.pro \
popupwin.pro \
profiler.pro \
pty.pro \
***************
*** 3341,3348 ****
objects/pathdef.o: auto/pathdef.c
$(CCC) -o $@ auto/pathdef.c
! objects/popupmnu.o: popupmnu.c
! $(CCC) -o $@ popupmnu.c
objects/popupwin.o: popupwin.c
$(CCC) -o $@ popupwin.c
--- 3343,3350 ----
objects/pathdef.o: auto/pathdef.c
$(CCC) -o $@ auto/pathdef.c
! objects/popupmenu.o: popupmenu.c
! $(CCC) -o $@ popupmenu.c
objects/popupwin.o: popupwin.c
$(CCC) -o $@ popupwin.c
***************
*** 3823,3829 ****
os_unix.h auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
proto.h globals.h
! objects/popupmnu.o: popupmnu.c vim.h protodef.h auto/config.h feature.h
os_unix.h \
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
proto.h globals.h
--- 3825,3831 ----
os_unix.h auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
proto.h globals.h
! objects/popupmenu.o: popupmenu.c vim.h protodef.h auto/config.h feature.h
os_unix.h \
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
proto.h globals.h
*** ../vim-8.1.2081/src/proto.h 2019-09-27 12:41:35.007573135 +0200
--- src/proto.h 2019-09-27 12:49:01.516277016 +0200
***************
*** 182,188 ****
# include "ops.pro"
# include "option.pro"
# include "optionstr.pro"
! # include "popupmnu.pro"
# if defined(FEAT_PROFILE) || defined(FEAT_RELTIME)
# include "profiler.pro"
# endif
--- 182,188 ----
# include "ops.pro"
# include "option.pro"
# include "optionstr.pro"
! # include "popupmenu.pro"
# if defined(FEAT_PROFILE) || defined(FEAT_RELTIME)
# include "profiler.pro"
# endif
*** ../vim-8.1.2081/src/README.md 2019-09-27 12:41:35.007573135 +0200
--- src/README.md 2019-09-27 12:49:47.343980923 +0200
***************
*** 58,64 ****
ops.c | handling operators ("d", "y", "p")
option.c | options
optionstr.c | handling string options
! popupmnu.c | popup menu
popupwin.c | popup window
profiler.c | vim script profiler
quickfix.c | quickfix commands (":make", ":cn")
--- 58,64 ----
ops.c | handling operators ("d", "y", "p")
option.c | options
optionstr.c | handling string options
! popupmenu.c | popup menu
popupwin.c | popup window
profiler.c | vim script profiler
quickfix.c | quickfix commands (":make", ":cn")
*** ../vim-8.1.2081/src/uninstal.c 2019-02-22 19:40:57.693250456 +0100
--- src/uninstal.c 1970-01-01 01:00:00.000000000 +0100
***************
*** 1,426 ****
- /* vi:set ts=8 sts=4 sw=4 noet:
- *
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.txt for an overview of the Vim source code.
- */
-
- /*
- * uninstal.c: Minimalistic uninstall program for Vim on MS-Windows
- * Removes:
- * - the "Edit with Vim" popup menu entry
- * - the Vim "Open With..." popup menu entry
- * - any Vim Batch files in the path
- * - icons for Vim on the Desktop
- * - the Vim entry in the Start Menu
- */
-
- /* Include common code for dosinst.c and uninstal.c. */
- #include "dosinst.h"
-
- /*
- * Return TRUE if the user types a 'y' or 'Y', FALSE otherwise.
- */
- static int
- confirm(void)
- {
- char answer[10];
-
- fflush(stdout);
- return (scanf(" %c", answer) == 1 && toupper(answer[0]) == 'Y');
- }
-
- static int
- reg_delete_key(HKEY hRootKey, const char *key, DWORD flag)
- {
- static int did_load = FALSE;
- static HANDLE advapi_lib = NULL;
- static LONG (WINAPI *delete_key_ex)(HKEY, LPCTSTR, REGSAM, DWORD) = NULL;
-
- if (!did_load)
- {
- /* The RegDeleteKeyEx() function is only available on new systems. It
- * is required for 64-bit registry access. For other systems fall
- * back to RegDeleteKey(). */
- did_load = TRUE;
- advapi_lib = LoadLibrary("ADVAPI32.DLL");
- if (advapi_lib != NULL)
- delete_key_ex = (LONG (WINAPI *)(HKEY, LPCTSTR, REGSAM,
DWORD))GetProcAddress(advapi_lib, "RegDeleteKeyExA");
- }
- if (delete_key_ex != NULL) {
- return (*delete_key_ex)(hRootKey, key, flag, 0);
- }
- return RegDeleteKey(hRootKey, key);
- }
-
- /*
- * Check if the popup menu entry exists and what gvim it refers to.
- * Returns non-zero when it's found.
- */
- static int
- popup_gvim_path(char *buf, DWORD bufsize)
- {
- HKEY key_handle;
- DWORD value_type;
- int r;
-
- /* Open the key where the path to gvim.exe is stored. */
- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Vim\\Gvim", 0,
- KEY_WOW64_64KEY | KEY_READ, &key_handle) != ERROR_SUCCESS)
- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Vim\\Gvim", 0,
- KEY_WOW64_32KEY | KEY_READ, &key_handle) != ERROR_SUCCESS)
- return 0;
-
- /* get the DisplayName out of it to show the user */
- r = RegQueryValueEx(key_handle, "path", 0,
- &value_type, (LPBYTE)buf, &bufsize);
- RegCloseKey(key_handle);
-
- return (r == ERROR_SUCCESS);
- }
-
- /*
- * Check if the "Open With..." menu entry exists and what gvim it refers to.
- * Returns non-zero when it's found.
- */
- static int
- openwith_gvim_path(char *buf, DWORD bufsize)
- {
- HKEY key_handle;
- DWORD value_type;
- int r;
-
- /* Open the key where the path to gvim.exe is stored. */
- if (RegOpenKeyEx(HKEY_CLASSES_ROOT,
- "Applications\\gvim.exe\\shell\\edit\\command", 0,
- KEY_WOW64_64KEY | KEY_READ, &key_handle) != ERROR_SUCCESS)
- return 0;
-
- /* get the DisplayName out of it to show the user */
- r = RegQueryValueEx(key_handle, "", 0, &value_type, (LPBYTE)buf,
&bufsize);
- RegCloseKey(key_handle);
-
- return (r == ERROR_SUCCESS);
- }
-
- static void
- remove_popup(void)
- {
- int fail = 0;
- int i;
- int loop = is_64bit_os() ? 2 : 1;
- int maxfail = loop * 6;
- DWORD flag;
- HKEY kh;
-
- for (i = 0; i < loop; i++)
- {
- if (i == 0)
- flag = KEY_WOW64_32KEY;
- else
- flag = KEY_WOW64_64KEY;
-
- if (reg_delete_key(HKEY_CLASSES_ROOT,
"CLSID\\{51EEE242-AD87-11d3-9C1E-0090278BBD99}\\InProcServer32", flag) !=
ERROR_SUCCESS)
- ++fail;
- if (reg_delete_key(HKEY_CLASSES_ROOT,
"CLSID\\{51EEE242-AD87-11d3-9C1E-0090278BBD99}", flag) != ERROR_SUCCESS)
- ++fail;
- if (reg_delete_key(HKEY_CLASSES_ROOT,
"*\\shellex\\ContextMenuHandlers\\gvim", flag) != ERROR_SUCCESS)
- ++fail;
- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
"Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved", 0,
- flag | KEY_ALL_ACCESS, &kh) != ERROR_SUCCESS)
- ++fail;
- else
- {
- if (RegDeleteValue(kh, "{51EEE242-AD87-11d3-9C1E-0090278BBD99}") !=
ERROR_SUCCESS)
- ++fail;
- RegCloseKey(kh);
- }
- if (reg_delete_key(HKEY_LOCAL_MACHINE, "Software\\Vim\\Gvim", flag) !=
ERROR_SUCCESS)
- ++fail;
- if (reg_delete_key(HKEY_LOCAL_MACHINE, "Software\\Vim", flag) !=
ERROR_SUCCESS)
- ++fail;
- }
-
- if (fail == maxfail)
- printf("No Vim popup registry entries could be removed\n");
- else if (fail > 0)
- printf("Some Vim popup registry entries could not be removed\n");
- else
- printf("The Vim popup registry entries have been removed\n");
- }
-
- static void
- remove_openwith(void)
- {
- int fail = 0;
- int i;
- int loop = is_64bit_os() ? 2 : 1;
- int maxfail = loop * 7;
- DWORD flag;
-
- for (i = 0; i < loop; i++)
- {
- if (i == 0)
- flag = KEY_WOW64_32KEY;
- else
- flag = KEY_WOW64_64KEY;
-
- if (reg_delete_key(HKEY_CLASSES_ROOT,
"Applications\\gvim.exe\\shell\\edit\\command", flag) != ERROR_SUCCESS)
- ++fail;
- if (reg_delete_key(HKEY_CLASSES_ROOT,
"Applications\\gvim.exe\\shell\\edit", flag) != ERROR_SUCCESS)
- ++fail;
- if (reg_delete_key(HKEY_CLASSES_ROOT, "Applications\\gvim.exe\\shell",
flag) != ERROR_SUCCESS)
- ++fail;
- if (reg_delete_key(HKEY_CLASSES_ROOT, "Applications\\gvim.exe", flag)
!= ERROR_SUCCESS)
- ++fail;
- if (reg_delete_key(HKEY_CLASSES_ROOT, ".htm\\OpenWithList\\gvim.exe",
flag) != ERROR_SUCCESS)
- ++fail;
- if (reg_delete_key(HKEY_CLASSES_ROOT, ".vim\\OpenWithList\\gvim.exe",
flag) != ERROR_SUCCESS)
- ++fail;
- if (reg_delete_key(HKEY_CLASSES_ROOT, "*\\OpenWithList\\gvim.exe",
flag) != ERROR_SUCCESS)
- ++fail;
- }
-
- if (fail == maxfail)
- printf("No Vim open-with registry entries could be removed\n");
- else if (fail > 0)
- printf("Some Vim open-with registry entries could not be removed\n");
- else
- printf("The Vim open-with registry entries have been removed\n");
- }
-
- /*
- * Check if a batch file is really for the current version. Don't delete a
- * batch file that was written for another (possibly newer) version.
- */
- static int
- batfile_thisversion(char *path)
- {
- FILE *fd;
- char line[BUFSIZE];
- char *p;
- int ver_len = strlen(VIM_VERSION_NODOT);
- int found = FALSE;
-
- fd = fopen(path, "r");
- if (fd != NULL)
- {
- while (fgets(line, sizeof(line), fd) != NULL)
- {
- for (p = line; *p != 0; ++p)
- /* don't accept "vim60an" when looking for "vim60". */
- if (strnicmp(p, VIM_VERSION_NODOT, ver_len) == 0
- && !isdigit(p[ver_len])
- && !isalpha(p[ver_len]))
- {
- found = TRUE;
- break;
- }
- if (found)
- break;
- }
- fclose(fd);
- }
- return found;
- }
-
- static int
- remove_batfiles(int doit)
- {
- char *batfile_path;
- int i;
- int found = 0;
-
- for (i = 1; i < TARGET_COUNT; ++i)
- {
- batfile_path = searchpath_save(targets[i].batname);
- if (batfile_path != NULL && batfile_thisversion(batfile_path))
- {
- ++found;
- if (doit)
- {
- printf("removing %s\n", batfile_path);
- remove(batfile_path);
- }
- else
- printf(" - the batch file %s\n", batfile_path);
- free(batfile_path);
- }
- }
- return found;
- }
-
- static void
- remove_if_exists(char *path, char *filename)
- {
- char buf[BUFSIZE];
- FILE *fd;
-
- sprintf(buf, "%s\\%s", path, filename);
-
- fd = fopen(buf, "r");
- if (fd != NULL)
- {
- fclose(fd);
- printf("removing %s\n", buf);
- remove(buf);
- }
- }
-
- static void
- remove_icons(void)
- {
- char path[BUFSIZE];
- int i;
-
- if (get_shell_folder_path(path, "desktop"))
- for (i = 0; i < ICON_COUNT; ++i)
- remove_if_exists(path, icon_link_names[i]);
- }
-
- static void
- remove_start_menu(void)
- {
- char path[BUFSIZE];
- int i;
- struct stat st;
-
- if (get_shell_folder_path(path, VIM_STARTMENU))
- {
- for (i = 1; i < TARGET_COUNT; ++i)
- remove_if_exists(path, targets[i].lnkname);
- remove_if_exists(path, "uninstall.lnk");
- remove_if_exists(path, "Help.lnk");
- /* Win95 uses .pif, WinNT uses .lnk */
- remove_if_exists(path, "Vim tutor.pif");
- remove_if_exists(path, "Vim tutor.lnk");
- remove_if_exists(path, "Vim online.url");
- if (stat(path, &st) == 0)
- {
- printf("removing %s\n", path);
- rmdir(path);
- }
- }
- }
-
- static void
- delete_uninstall_key(void)
- {
- reg_delete_key(HKEY_LOCAL_MACHINE,
"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Vim "
VIM_VERSION_SHORT, KEY_WOW64_64KEY);
- }
-
- int
- main(int argc, char *argv[])
- {
- int found = 0;
- FILE *fd;
- int i;
- struct stat st;
- char icon[BUFSIZE];
- char path[MAX_PATH];
- char popup_path[MAX_PATH];
-
- /* The nsis uninstaller calls us with a "-nsis" argument. */
- if (argc == 2 && stricmp(argv[1], "-nsis") == 0)
- interactive = FALSE;
- else
- interactive = TRUE;
-
- /* Initialize this program. */
- do_inits(argv);
-
- printf("This program will remove the following items:\n");
-
- if (popup_gvim_path(popup_path, sizeof(popup_path)))
- {
- printf(" - the \"Edit with Vim\" entry in the popup menu\n");
- printf(" which uses \"%s\"\n", popup_path);
- if (interactive)
- printf("\nRemove it (y/n)? ");
- if (!interactive || confirm())
- {
- remove_popup();
- /* Assume the "Open With" entry can be removed as well, don't
- * bother the user with asking him again. */
- remove_openwith();
- }
- }
- else if (openwith_gvim_path(popup_path, sizeof(popup_path)))
- {
- printf(" - the Vim \"Open With...\" entry in the popup menu\n");
- printf(" which uses \"%s\"\n", popup_path);
- printf("\nRemove it (y/n)? ");
- if (confirm())
- remove_openwith();
- }
-
- if (get_shell_folder_path(path, "desktop"))
- {
- printf("\n");
- for (i = 0; i < ICON_COUNT; ++i)
- {
- sprintf(icon, "%s\\%s", path, icon_link_names[i]);
- if (stat(icon, &st) == 0)
- {
- printf(" - the \"%s\" icon on the desktop\n", icon_names[i]);
- ++found;
- }
- }
- if (found > 0)
- {
- if (interactive)
- printf("\nRemove %s (y/n)? ", found > 1 ? "them" : "it");
- if (!interactive || confirm())
- remove_icons();
- }
- }
-
- if (get_shell_folder_path(path, VIM_STARTMENU)
- && stat(path, &st) == 0)
- {
- printf("\n - the \"%s\" entry in the Start Menu\n", VIM_STARTMENU);
- if (interactive)
- printf("\nRemove it (y/n)? ");
- if (!interactive || confirm())
- remove_start_menu();
- }
-
- printf("\n");
- found = remove_batfiles(0);
- if (found > 0)
- {
- if (interactive)
- printf("\nRemove %s (y/n)? ", found > 1 ? "them" : "it");
- if (!interactive || confirm())
- remove_batfiles(1);
- }
-
- fd = fopen("gvim.exe", "r");
- if (fd != NULL)
- {
- fclose(fd);
- printf("gvim.exe detected. Attempting to unregister gvim with OLE\n");
- system("gvim.exe -silent -unregister");
- }
-
- delete_uninstall_key();
-
- if (interactive)
- {
- printf("\nYou may now want to delete the Vim executables and runtime
files.\n");
- printf("(They are still where you unpacked them.)\n");
- }
-
- if (interactive)
- {
- rewind(stdin);
- printf("\nPress Enter to exit...");
- (void)getchar();
- }
- else
- sleep(3);
-
- return 0;
- }
--- 0 ----
*** ../vim-8.1.2081/src/uninstall.c 2019-09-27 13:07:04.862120609 +0200
--- src/uninstall.c 2019-09-27 12:54:23.538295695 +0200
***************
*** 0 ****
--- 1,426 ----
+ /* vi:set ts=8 sts=4 sw=4 noet:
+ *
+ * VIM - Vi IMproved by Bram Moolenaar
+ *
+ * Do ":help uganda" in Vim to read copying and usage conditions.
+ * Do ":help credits" in Vim to see a list of people who contributed.
+ * See README.txt for an overview of the Vim source code.
+ */
+
+ /*
+ * uninstall.c: Minimalistic uninstall program for Vim on MS-Windows
+ * Removes:
+ * - the "Edit with Vim" popup menu entry
+ * - the Vim "Open With..." popup menu entry
+ * - any Vim Batch files in the path
+ * - icons for Vim on the Desktop
+ * - the Vim entry in the Start Menu
+ */
+
+ /* Include common code for dosinst.c and uninstall.c. */
+ #include "dosinst.h"
+
+ /*
+ * Return TRUE if the user types a 'y' or 'Y', FALSE otherwise.
+ */
+ static int
+ confirm(void)
+ {
+ char answer[10];
+
+ fflush(stdout);
+ return (scanf(" %c", answer) == 1 && toupper(answer[0]) == 'Y');
+ }
+
+ static int
+ reg_delete_key(HKEY hRootKey, const char *key, DWORD flag)
+ {
+ static int did_load = FALSE;
+ static HANDLE advapi_lib = NULL;
+ static LONG (WINAPI *delete_key_ex)(HKEY, LPCTSTR, REGSAM, DWORD) = NULL;
+
+ if (!did_load)
+ {
+ /* The RegDeleteKeyEx() function is only available on new systems. It
+ * is required for 64-bit registry access. For other systems fall
+ * back to RegDeleteKey(). */
+ did_load = TRUE;
+ advapi_lib = LoadLibrary("ADVAPI32.DLL");
+ if (advapi_lib != NULL)
+ delete_key_ex = (LONG (WINAPI *)(HKEY, LPCTSTR, REGSAM,
DWORD))GetProcAddress(advapi_lib, "RegDeleteKeyExA");
+ }
+ if (delete_key_ex != NULL) {
+ return (*delete_key_ex)(hRootKey, key, flag, 0);
+ }
+ return RegDeleteKey(hRootKey, key);
+ }
+
+ /*
+ * Check if the popup menu entry exists and what gvim it refers to.
+ * Returns non-zero when it's found.
+ */
+ static int
+ popup_gvim_path(char *buf, DWORD bufsize)
+ {
+ HKEY key_handle;
+ DWORD value_type;
+ int r;
+
+ /* Open the key where the path to gvim.exe is stored. */
+ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Vim\\Gvim", 0,
+ KEY_WOW64_64KEY | KEY_READ, &key_handle) != ERROR_SUCCESS)
+ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Vim\\Gvim", 0,
+ KEY_WOW64_32KEY | KEY_READ, &key_handle) != ERROR_SUCCESS)
+ return 0;
+
+ /* get the DisplayName out of it to show the user */
+ r = RegQueryValueEx(key_handle, "path", 0,
+ &value_type, (LPBYTE)buf, &bufsize);
+ RegCloseKey(key_handle);
+
+ return (r == ERROR_SUCCESS);
+ }
+
+ /*
+ * Check if the "Open With..." menu entry exists and what gvim it refers to.
+ * Returns non-zero when it's found.
+ */
+ static int
+ openwith_gvim_path(char *buf, DWORD bufsize)
+ {
+ HKEY key_handle;
+ DWORD value_type;
+ int r;
+
+ /* Open the key where the path to gvim.exe is stored. */
+ if (RegOpenKeyEx(HKEY_CLASSES_ROOT,
+ "Applications\\gvim.exe\\shell\\edit\\command", 0,
+ KEY_WOW64_64KEY | KEY_READ, &key_handle) != ERROR_SUCCESS)
+ return 0;
+
+ /* get the DisplayName out of it to show the user */
+ r = RegQueryValueEx(key_handle, "", 0, &value_type, (LPBYTE)buf,
&bufsize);
+ RegCloseKey(key_handle);
+
+ return (r == ERROR_SUCCESS);
+ }
+
+ static void
+ remove_popup(void)
+ {
+ int fail = 0;
+ int i;
+ int loop = is_64bit_os() ? 2 : 1;
+ int maxfail = loop * 6;
+ DWORD flag;
+ HKEY kh;
+
+ for (i = 0; i < loop; i++)
+ {
+ if (i == 0)
+ flag = KEY_WOW64_32KEY;
+ else
+ flag = KEY_WOW64_64KEY;
+
+ if (reg_delete_key(HKEY_CLASSES_ROOT,
"CLSID\\{51EEE242-AD87-11d3-9C1E-0090278BBD99}\\InProcServer32", flag) !=
ERROR_SUCCESS)
+ ++fail;
+ if (reg_delete_key(HKEY_CLASSES_ROOT,
"CLSID\\{51EEE242-AD87-11d3-9C1E-0090278BBD99}", flag) != ERROR_SUCCESS)
+ ++fail;
+ if (reg_delete_key(HKEY_CLASSES_ROOT,
"*\\shellex\\ContextMenuHandlers\\gvim", flag) != ERROR_SUCCESS)
+ ++fail;
+ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
"Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved", 0,
+ flag | KEY_ALL_ACCESS, &kh) != ERROR_SUCCESS)
+ ++fail;
+ else
+ {
+ if (RegDeleteValue(kh, "{51EEE242-AD87-11d3-9C1E-0090278BBD99}") !=
ERROR_SUCCESS)
+ ++fail;
+ RegCloseKey(kh);
+ }
+ if (reg_delete_key(HKEY_LOCAL_MACHINE, "Software\\Vim\\Gvim", flag) !=
ERROR_SUCCESS)
+ ++fail;
+ if (reg_delete_key(HKEY_LOCAL_MACHINE, "Software\\Vim", flag) !=
ERROR_SUCCESS)
+ ++fail;
+ }
+
+ if (fail == maxfail)
+ printf("No Vim popup registry entries could be removed\n");
+ else if (fail > 0)
+ printf("Some Vim popup registry entries could not be removed\n");
+ else
+ printf("The Vim popup registry entries have been removed\n");
+ }
+
+ static void
+ remove_openwith(void)
+ {
+ int fail = 0;
+ int i;
+ int loop = is_64bit_os() ? 2 : 1;
+ int maxfail = loop * 7;
+ DWORD flag;
+
+ for (i = 0; i < loop; i++)
+ {
+ if (i == 0)
+ flag = KEY_WOW64_32KEY;
+ else
+ flag = KEY_WOW64_64KEY;
+
+ if (reg_delete_key(HKEY_CLASSES_ROOT,
"Applications\\gvim.exe\\shell\\edit\\command", flag) != ERROR_SUCCESS)
+ ++fail;
+ if (reg_delete_key(HKEY_CLASSES_ROOT,
"Applications\\gvim.exe\\shell\\edit", flag) != ERROR_SUCCESS)
+ ++fail;
+ if (reg_delete_key(HKEY_CLASSES_ROOT, "Applications\\gvim.exe\\shell",
flag) != ERROR_SUCCESS)
+ ++fail;
+ if (reg_delete_key(HKEY_CLASSES_ROOT, "Applications\\gvim.exe", flag)
!= ERROR_SUCCESS)
+ ++fail;
+ if (reg_delete_key(HKEY_CLASSES_ROOT, ".htm\\OpenWithList\\gvim.exe",
flag) != ERROR_SUCCESS)
+ ++fail;
+ if (reg_delete_key(HKEY_CLASSES_ROOT, ".vim\\OpenWithList\\gvim.exe",
flag) != ERROR_SUCCESS)
+ ++fail;
+ if (reg_delete_key(HKEY_CLASSES_ROOT, "*\\OpenWithList\\gvim.exe",
flag) != ERROR_SUCCESS)
+ ++fail;
+ }
+
+ if (fail == maxfail)
+ printf("No Vim open-with registry entries could be removed\n");
+ else if (fail > 0)
+ printf("Some Vim open-with registry entries could not be removed\n");
+ else
+ printf("The Vim open-with registry entries have been removed\n");
+ }
+
+ /*
+ * Check if a batch file is really for the current version. Don't delete a
+ * batch file that was written for another (possibly newer) version.
+ */
+ static int
+ batfile_thisversion(char *path)
+ {
+ FILE *fd;
+ char line[BUFSIZE];
+ char *p;
+ int ver_len = strlen(VIM_VERSION_NODOT);
+ int found = FALSE;
+
+ fd = fopen(path, "r");
+ if (fd != NULL)
+ {
+ while (fgets(line, sizeof(line), fd) != NULL)
+ {
+ for (p = line; *p != 0; ++p)
+ /* don't accept "vim60an" when looking for "vim60". */
+ if (strnicmp(p, VIM_VERSION_NODOT, ver_len) == 0
+ && !isdigit(p[ver_len])
+ && !isalpha(p[ver_len]))
+ {
+ found = TRUE;
+ break;
+ }
+ if (found)
+ break;
+ }
+ fclose(fd);
+ }
+ return found;
+ }
+
+ static int
+ remove_batfiles(int doit)
+ {
+ char *batfile_path;
+ int i;
+ int found = 0;
+
+ for (i = 1; i < TARGET_COUNT; ++i)
+ {
+ batfile_path = searchpath_save(targets[i].batname);
+ if (batfile_path != NULL && batfile_thisversion(batfile_path))
+ {
+ ++found;
+ if (doit)
+ {
+ printf("removing %s\n", batfile_path);
+ remove(batfile_path);
+ }
+ else
+ printf(" - the batch file %s\n", batfile_path);
+ free(batfile_path);
+ }
+ }
+ return found;
+ }
+
+ static void
+ remove_if_exists(char *path, char *filename)
+ {
+ char buf[BUFSIZE];
+ FILE *fd;
+
+ sprintf(buf, "%s\\%s", path, filename);
+
+ fd = fopen(buf, "r");
+ if (fd != NULL)
+ {
+ fclose(fd);
+ printf("removing %s\n", buf);
+ remove(buf);
+ }
+ }
+
+ static void
+ remove_icons(void)
+ {
+ char path[BUFSIZE];
+ int i;
+
+ if (get_shell_folder_path(path, "desktop"))
+ for (i = 0; i < ICON_COUNT; ++i)
+ remove_if_exists(path, icon_link_names[i]);
+ }
+
+ static void
+ remove_start_menu(void)
+ {
+ char path[BUFSIZE];
+ int i;
+ struct stat st;
+
+ if (get_shell_folder_path(path, VIM_STARTMENU))
+ {
+ for (i = 1; i < TARGET_COUNT; ++i)
+ remove_if_exists(path, targets[i].lnkname);
+ remove_if_exists(path, "uninstall.lnk");
+ remove_if_exists(path, "Help.lnk");
+ /* Win95 uses .pif, WinNT uses .lnk */
+ remove_if_exists(path, "Vim tutor.pif");
+ remove_if_exists(path, "Vim tutor.lnk");
+ remove_if_exists(path, "Vim online.url");
+ if (stat(path, &st) == 0)
+ {
+ printf("removing %s\n", path);
+ rmdir(path);
+ }
+ }
+ }
+
+ static void
+ delete_uninstall_key(void)
+ {
+ reg_delete_key(HKEY_LOCAL_MACHINE,
"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Vim "
VIM_VERSION_SHORT, KEY_WOW64_64KEY);
+ }
+
+ int
+ main(int argc, char *argv[])
+ {
+ int found = 0;
+ FILE *fd;
+ int i;
+ struct stat st;
+ char icon[BUFSIZE];
+ char path[MAX_PATH];
+ char popup_path[MAX_PATH];
+
+ /* The nsis uninstaller calls us with a "-nsis" argument. */
+ if (argc == 2 && stricmp(argv[1], "-nsis") == 0)
+ interactive = FALSE;
+ else
+ interactive = TRUE;
+
+ /* Initialize this program. */
+ do_inits(argv);
+
+ printf("This program will remove the following items:\n");
+
+ if (popup_gvim_path(popup_path, sizeof(popup_path)))
+ {
+ printf(" - the \"Edit with Vim\" entry in the popup menu\n");
+ printf(" which uses \"%s\"\n", popup_path);
+ if (interactive)
+ printf("\nRemove it (y/n)? ");
+ if (!interactive || confirm())
+ {
+ remove_popup();
+ /* Assume the "Open With" entry can be removed as well, don't
+ * bother the user with asking him again. */
+ remove_openwith();
+ }
+ }
+ else if (openwith_gvim_path(popup_path, sizeof(popup_path)))
+ {
+ printf(" - the Vim \"Open With...\" entry in the popup menu\n");
+ printf(" which uses \"%s\"\n", popup_path);
+ printf("\nRemove it (y/n)? ");
+ if (confirm())
+ remove_openwith();
+ }
+
+ if (get_shell_folder_path(path, "desktop"))
+ {
+ printf("\n");
+ for (i = 0; i < ICON_COUNT; ++i)
+ {
+ sprintf(icon, "%s\\%s", path, icon_link_names[i]);
+ if (stat(icon, &st) == 0)
+ {
+ printf(" - the \"%s\" icon on the desktop\n", icon_names[i]);
+ ++found;
+ }
+ }
+ if (found > 0)
+ {
+ if (interactive)
+ printf("\nRemove %s (y/n)? ", found > 1 ? "them" : "it");
+ if (!interactive || confirm())
+ remove_icons();
+ }
+ }
+
+ if (get_shell_folder_path(path, VIM_STARTMENU)
+ && stat(path, &st) == 0)
+ {
+ printf("\n - the \"%s\" entry in the Start Menu\n", VIM_STARTMENU);
+ if (interactive)
+ printf("\nRemove it (y/n)? ");
+ if (!interactive || confirm())
+ remove_start_menu();
+ }
+
+ printf("\n");
+ found = remove_batfiles(0);
+ if (found > 0)
+ {
+ if (interactive)
+ printf("\nRemove %s (y/n)? ", found > 1 ? "them" : "it");
+ if (!interactive || confirm())
+ remove_batfiles(1);
+ }
+
+ fd = fopen("gvim.exe", "r");
+ if (fd != NULL)
+ {
+ fclose(fd);
+ printf("gvim.exe detected. Attempting to unregister gvim with OLE\n");
+ system("gvim.exe -silent -unregister");
+ }
+
+ delete_uninstall_key();
+
+ if (interactive)
+ {
+ printf("\nYou may now want to delete the Vim executables and runtime
files.\n");
+ printf("(They are still where you unpacked them.)\n");
+ }
+
+ if (interactive)
+ {
+ rewind(stdin);
+ printf("\nPress Enter to exit...");
+ (void)getchar();
+ }
+ else
+ sleep(3);
+
+ return 0;
+ }
*** ../vim-8.1.2081/uninstal.txt 2018-12-02 13:57:54.840490432 +0100
--- uninstal.txt 1970-01-01 01:00:00.000000000 +0100
***************
*** 1,77 ****
- Uninstalling Vim on MS-Windows.
-
- There are three ways to remove Vim:
-
- 1. With the GUI uninstaller.
- This is only available when Vim was installed with the self-installing
- executable. This has a minimal number of questions. It can delete
- everything that was installed. This also unregisters the VisVim.dll.
-
- 2. With uninstal.exe.
- This removes most installed items, but does not delete the files you
- unpacked.
-
- 3. By hand.
- This is a bit more work, but you can decide exactly what you want to
- remove. For uninstalling the "Edit with Vim" popup menu entry you still
- have to use uninstal.exe.
-
- It's recommended to use the method that matches with how you installed Vim.
- Thus if you installed Vim by hand, delete it by hand.
-
- The first two methods should be available from the Add/Remove software window
- and the Vim entry in the Start menu. If these have been removed already, find
- "uninstall-gui.exe" or "uninstal.exe" in the Vim directory.
- Running these programs should be self-explanatory. Carefully read the
- messages to avoid deleting something you want to keep.
-
- Here are guidelines for removing Vim by hand:
-
- 1. Remove the "Edit with Vim" popup menu entry, if it exists. This is done by
- running the uninstal.exe program. It removes the registry entries for the
- "Edit with Vim" popup menu entry. You only need to run uninstal.exe when
- you have installed the menu entry. You can also run uninstal.exe from the
- Control panel with the Add/Remove programs application.
- Note that uninstal.exe offers you the option to uninstal other items. You
- can skip this.
-
- 2. Only if you have used the OLE version of gvim: Remove the registration of
- this program by running "gvim -unregister" in a console window.
-
- 3. Delete the executables. If you copied the executables to another location,
- you will have to delete them from where you copied them to. If you don't
- remember where they are, look in the directories from the $PATH environment
- variable.
- If you created .bat files when installing Vim, also search for vim.bat,
- gvim.bat, etc.
-
- 4. If you want to completely delete vim, and are not going to install another
- version, you can delete the vimrc files that you created. These are
- normally located in a directory like "C:\vim". If the $VIM environment
- variable is set, it will tell the name of the directory. Normally you can
- delete everything in this directory. Warning: You might have put some
- files there that you would like to save. If you did remove it all, you can
- skip the next step.
-
- 5. Delete the distributed files. If you followed the directions, these will
- be located in a directory like "C:\vim\vim81". If the $VIM environment
- variable is set, the directory will be $VIM\vim81. Delete the "vim81"
- directory and all that is in it. Warning: If you changed any of the
- distributed files, or added some of your own files, you might want to save
- these first. But normally you would not have changed or added files here.
-
- 6. Remove setting the $VIM and $VIMRUNTIME environment variable and adjust
- $PATH. $VIM only needs to be removed if you are not going to install
- another version of Vim. $VIMRUNTIME is mostly not set. Check if $PATH
- contains the path of the vim directory. Note that $PATH may be set in
- several places, you will have to find the right one, and only delete the
- Vim path from it. You might need to use the "System Properties" editor to
- change the environment variables. You can start it by selecting
- Start/Settings/Control Panel and then "System".
-
- 7. If you added a Vim entry in the start menu, delete it.
-
- 8. If you created icons for Vim on the desktop, delete them.
-
- Vim does not use .ini files. The above should remove all Vim files, except
- the ones that you moved elsewhere yourself.
--- 0 ----
*** ../vim-8.1.2081/uninstall.txt 2019-09-27 13:07:04.870120566 +0200
--- uninstall.txt 2019-09-27 12:57:17.617297415 +0200
***************
*** 0 ****
--- 1,77 ----
+ Uninstalling Vim on MS-Windows.
+
+ There are three ways to remove Vim:
+
+ 1. With the GUI uninstaller.
+ This is only available when Vim was installed with the self-installing
+ executable. This has a minimal number of questions. It can delete
+ everything that was installed. This also unregisters the VisVim.dll.
+
+ 2. With uninstall.exe.
+ This removes most installed items, but does not delete the files you
+ unpacked.
+
+ 3. By hand.
+ This is a bit more work, but you can decide exactly what you want to
+ remove. For uninstalling the "Edit with Vim" popup menu entry you still
+ have to use uninstall.exe.
+
+ It's recommended to use the method that matches with how you installed Vim.
+ Thus if you installed Vim by hand, delete it by hand.
+
+ The first two methods should be available from the Add/Remove software window
+ and the Vim entry in the Start menu. If these have been removed already, find
+ "uninstall-gui.exe" or "uninstall.exe" in the Vim directory.
+ Running these programs should be self-explanatory. Carefully read the
+ messages to avoid deleting something you want to keep.
+
+ Here are guidelines for removing Vim by hand:
+
+ 1. Remove the "Edit with Vim" popup menu entry, if it exists. This is done by
+ running the uninstall.exe program. It removes the registry entries for the
+ "Edit with Vim" popup menu entry. You only need to run uninstall.exe when
+ you have installed the menu entry. You can also run uninstall.exe from the
+ Control panel with the Add/Remove programs application.
+ Note that uninstall.exe offers you the option to uninstall other items.
You
+ can skip this.
+
+ 2. Only if you have used the OLE version of gvim: Remove the registration of
+ this program by running "gvim -unregister" in a console window.
+
+ 3. Delete the executables. If you copied the executables to another location,
+ you will have to delete them from where you copied them to. If you don't
+ remember where they are, look in the directories from the $PATH environment
+ variable.
+ If you created .bat files when installing Vim, also search for vim.bat,
+ gvim.bat, etc.
+
+ 4. If you want to completely delete vim, and are not going to install another
+ version, you can delete the vimrc files that you created. These are
+ normally located in a directory like "C:\vim". If the $VIM environment
+ variable is set, it will tell the name of the directory. Normally you can
+ delete everything in this directory. Warning: You might have put some
+ files there that you would like to save. If you did remove it all, you can
+ skip the next step.
+
+ 5. Delete the distributed files. If you followed the directions, these will
+ be located in a directory like "C:\vim\vim81". If the $VIM environment
+ variable is set, the directory will be $VIM\vim81. Delete the "vim81"
+ directory and all that is in it. Warning: If you changed any of the
+ distributed files, or added some of your own files, you might want to save
+ these first. But normally you would not have changed or added files here.
+
+ 6. Remove setting the $VIM and $VIMRUNTIME environment variable and adjust
+ $PATH. $VIM only needs to be removed if you are not going to install
+ another version of Vim. $VIMRUNTIME is mostly not set. Check if $PATH
+ contains the path of the vim directory. Note that $PATH may be set in
+ several places, you will have to find the right one, and only delete the
+ Vim path from it. You might need to use the "System Properties" editor to
+ change the environment variables. You can start it by selecting
+ Start/Settings/Control Panel and then "System".
+
+ 7. If you added a Vim entry in the start menu, delete it.
+
+ 8. If you created icons for Vim on the desktop, delete them.
+
+ Vim does not use .ini files. The above should remove all Vim files, except
+ the ones that you moved elsewhere yourself.
*** ../vim-8.1.2081/nsis/gvim.nsi 2019-05-26 20:49:39.472283431 +0200
--- nsis/gvim.nsi 2019-09-27 13:01:09.124018601 +0200
***************
*** 341,353 ****
File ${VIMSRC}\vim${BIT}.dll
!endif
File /oname=install.exe ${VIMSRC}\installw32.exe
! File /oname=uninstal.exe ${VIMSRC}\uninstalw32.exe
File ${VIMSRC}\vimrun.exe
File /oname=tee.exe ${VIMSRC}\teew32.exe
File /oname=xxd.exe ${VIMSRC}\xxdw32.exe
File ..\vimtutor.bat
File ..\README.txt
! File ..\uninstal.txt
File ${VIMRT}\*.vim
File ${VIMRT}\rgb.txt
--- 341,353 ----
File ${VIMSRC}\vim${BIT}.dll
!endif
File /oname=install.exe ${VIMSRC}\installw32.exe
! File /oname=uninstall.exe ${VIMSRC}\uninstallw32.exe
File ${VIMSRC}\vimrun.exe
File /oname=tee.exe ${VIMSRC}\teew32.exe
File /oname=xxd.exe ${VIMSRC}\xxdw32.exe
File ..\vimtutor.bat
File ..\README.txt
! File ..\uninstall.txt
File ${VIMRT}\*.vim
File ${VIMRT}\rgb.txt
***************
*** 955,961 ****
# delete the context menu entry and batch files
DetailPrint "$(str_msg_unregistering)"
! nsExec::Exec "$0\uninstal.exe -nsis"
Pop $3
# We may have been put to the background when uninstall did something.
--- 955,961 ----
# delete the context menu entry and batch files
DetailPrint "$(str_msg_unregistering)"
! nsExec::Exec "$0\uninstall.exe -nsis"
Pop $3
# We may have been put to the background when uninstall did something.
*** ../vim-8.1.2081/src/INSTALLpc.txt 2019-05-09 15:12:45.164723999 +0200
--- src/INSTALLpc.txt 2019-09-27 13:02:02.763728139 +0200
***************
*** 1023,1029 ****
Move the "vim81" subdirectory into the subdirectory where you want Vim
to be installed. Typically, this subdirectory will be named "vim".
If you already have a "vim81" subdirectory in "vim", delete it first
! by running its uninstal.exe program.
E. Install Vim
---------------
--- 1023,1029 ----
Move the "vim81" subdirectory into the subdirectory where you want Vim
to be installed. Typically, this subdirectory will be named "vim".
If you already have a "vim81" subdirectory in "vim", delete it first
! by running its uninstall.exe program.
E. Install Vim
---------------
*** ../vim-8.1.2081/src/dosinst.c 2019-05-25 20:21:24.669951062 +0200
--- src/dosinst.c 2019-09-27 13:02:29.111586085 +0200
***************
*** 14,20 ****
*/
/*
! * Include common code for dosinst.c and uninstal.c.
*/
#define DOSINST
#include "dosinst.h"
--- 14,20 ----
*/
/*
! * Include common code for dosinst.c and uninstall.c.
*/
#define DOSINST
#include "dosinst.h"
***************
*** 1686,1692 ****
/* For the NSIS installer use the generated uninstaller. */
if (interactive)
! sprintf(uninstall_string, "%s\\uninstal.exe", installdir);
else
sprintf(uninstall_string, "%s\\uninstall-gui.exe", installdir);
--- 1686,1692 ----
/* For the NSIS installer use the generated uninstaller. */
if (interactive)
! sprintf(uninstall_string, "%s\\uninstall.exe", installdir);
else
sprintf(uninstall_string, "%s\\uninstall-gui.exe", installdir);
***************
*** 1962,1968 ****
return;
}
if (build_shortcut("Uninstall",
! interactive ? "uninstal.exe" : "uninstall-gui.exe", "",
VIM_STARTMENU, installdir) == FAIL)
return;
/* For Windows NT the working dir of the vimtutor.bat must be right,
--- 1962,1968 ----
return;
}
if (build_shortcut("Uninstall",
! interactive ? "uninstall.exe" : "uninstall-gui.exe", "",
VIM_STARTMENU, installdir) == FAIL)
return;
/* For Windows NT the working dir of the vimtutor.bat must be right,
*** ../vim-8.1.2081/src/dosinst.h 2019-05-09 15:12:45.168723969 +0200
--- src/dosinst.h 2019-09-27 13:02:50.167472860 +0200
***************
*** 7,13 ****
* See README.txt for an overview of the Vim source code.
*/
/*
! * dosinst.h: Common code for dosinst.c and uninstal.c
*/
/* Visual Studio 2005 has 'deprecated' many of the standard CRT functions */
--- 7,13 ----
* See README.txt for an overview of the Vim source code.
*/
/*
! * dosinst.h: Common code for dosinst.c and uninstall.c
*/
/* Visual Studio 2005 has 'deprecated' many of the standard CRT functions */
*** ../vim-8.1.2081/src/version.c 2019-09-27 12:41:35.011573098 +0200
--- src/version.c 2019-09-27 12:50:17.159791192 +0200
***************
*** 759,760 ****
--- 759,762 ----
{ /* Add new patch number below this line */
+ /**/
+ 2082,
/**/
--
Have you heard about the new Barbie doll? It's called Divorce
Barbie. It comes with most of Ken's stuff.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ 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/201909271109.x8RB9SNM007874%40masaka.moolenaar.net.