Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@k-takata
Copy link
Member

The VIMDLL support was removed at 8.1.1066.
I reimplemented it on MSVC and MinGW.
The differences from the old implementation are:

  • Supports MSVC and MinGW. (Don't support Borland C++.)
  • Supports gvim.exe and vim.exe.
    If you build with nmake -f Make_mvc.mak VIMDLL=yes, vim{32,64}.dll
    will be built and also stub gvim.exe and vim.exe will be built.
    The shared codes between GUI and CUI are all built into the DLL.
    So the total size of the distribution files can be reduced.
  • Supports vim -g and the :gui commands.
    If the commands are executed with the -f option, vim.exe will open a GUI
    window directly. Otherwise, vim.exe will execute gvim.exe. :gui will
    use :mksession to inherit the session to gvim.exe.

Related: #4171 (comment)

k-takata added 30 commits April 4, 2019 07:57
Currently only supports MSVC.
If you build with `nmake -f Make_mvc.mak VIMDLL=yes`, vim{32,64}.dll
will be built and also small gvim.exe and vim.exe will be built.
The shared codes between GUI and CUI are all built into the DLL.
So the total size of the distribution files can be reduced.

TODO:
* Update "make clean".
* Fix terminal behavior on vim.exe.
* Fix shell behavior on vim.exe.
* Check all `FEAT_GUI_MSWIN` definitions.
* Check all `ALWAYS_USE_GUI` definitions.
* Support MinGW.
* Fix version string.
* Enable VTP on console version.
* Fix color of 'tgc'.
* Fix backspace in terminal mode on console version.
TODO:
Still red and blue are swapped when t_Co=256 and 'notgc' on vim.exe.
This was removed by v8.1.1109.
Update for 8.1.1131.
When using the terminal on vim.exe with `:set t_Co=16` (default), the colors
are shown incorrectly. Red and blue are swapped.

To reproduce:

1. Download `color16.bat` from [here](https://gist.github.com/k-takata/2d4f562bacf8bae6691973a540970117#file-color16-bat).
2. Execute `vim --clean`.
3. Type `:terminal`.
4. Execute `color16.bat` on the terminal.

Color indices between the ANSI escape sequence and the Windows console
(in 16-color mode) are different, so they should be adjusted.
It seems that a condition was wrong. This fixes it.
@k-takata
Copy link
Member Author

k-takata commented Apr 23, 2019

@brammool
https://groups.google.com/d/msg/vim_dev/9JS4qp5cFLA/Tkc3OcGuCAAJ

  • Supports vim -g and the :gui commands.
    If the commands are executed with the -f option, vim.exe will open a GUI
    window directly. Otherwise, vim.exe will execute gvim.exe. :gui will
    use :mksession to inherit the session to gvim.exe.

Does this really work? Any variable values would be lost.

:gui with :mksession works almost fine. It inherits global status. But It is not perfect as you pointed out.
(On the other hand, :gui -f works perfect, because vim.exe itself opens the window in the same process.)
If there are any unsaved files, :gui automatically falls back to :gui -f.

@brammool
Copy link
Contributor

brammool commented Apr 23, 2019 via email

@k-takata
Copy link
Member Author

But I suppose bringing back the command prompt won't be possible, since Windows doesn't have a way to detach, other than starting a GUI program.

Yes, unix shell can use Ctrl-Z and bg to move the process to the background, but Windows doesn't support it. Opening a GUI from vim.exe and stay in foreground is useless. So, :gui -f is not useful.
And :gui -b doesn't work perfectly as it uses :mksession. So it might be better to disable :gui.

I think that vim -g is still useful. It works perfectly.

Add the EXPERIMENTAL_GUI_CMD definition instead.
@k-takata
Copy link
Member Author

I disabled the :gui command in the latest commit.

@brammool
Copy link
Contributor

Thanks. So now we mainly save space and the installer will get a lot smaller.
If someone sees a drawback, please let us know.
Otherwise I'll include it soon.

Move the common part of the resources from the exes to the dll.
* icon files (except the main icon)
* bmp files
* print status dialog

Adjust the handling of HINSTANCE for that.  Move SaveInst() from
gui_w32.c to os_mswin.c and change s_hinst to g_hinst.
Call SaveInst() from DllMain().

Update the dependencies of the resource files in the makefiles.

Embed the manifest to the resource also for vim.exe so that the print
dialog will be shown in XP style.

Notes:
It might be better to separate the resource file for gvim.exe and
vim.exe, because currently "OriginalFilename" in the version resource is
set to "VIM.EXE".

The print dialogs are different between gvim.exe and vim.exe.  Is it
intentional?
Separate the resource file for gvim.exe and vim.exe.
Make the definition of RCFLAGS similar to Make_cyg_ming.mak.
Set the gui.starting flag before checking sever options.
Check the subsystem of the current executable file for that.
Don't drop the gui.starting flag.
@k-takata
Copy link
Member Author

I had a report that "gvim --serverlist" didn't work, so I fixed it.
I also revised the makefiles, update nsis script for VIMDLL.

I think this is ready to be included. If there are still some problems, they can be fixed one by one.

@brammool brammool closed this in afde13b Apr 28, 2019
@k-takata k-takata deleted the vimdll branch April 29, 2019 00:27
janlazo added a commit to janlazo/neovim that referenced this pull request Dec 30, 2020
Problem:    Code for viminfo support is spread out.
Solution:   Move to code to viminfo.c. (Yegappan Lakshmanan, closes vim/vim#4686)
vim/vim@defa067

N/A patches for version.c:

vim-patch:8.1.1230: a lot of code is shared between vim.exe and gvim.exe

Problem:    A lot of code is shared between vim.exe and gvim.exe.
Solution:   Optionally put the shared code in vim.dll. (Ken Takata,
            closes vim/vim#4287)
vim/vim@afde13b

vim-patch:8.2.2247: VMS: various smaller problems

Problem:    VMS: various smaller problems.
Solution:   Fix VMS building and other problems. (Zoltan Arpadffy)
vim/vim@467676d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants