summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2006-03-06 23:29:24 +0000
committerBram Moolenaar <Bram@vim.org>2006-03-06 23:29:24 +0000
commit362e1a30c6f3527d5d0efc328c2fb448290cd6fc (patch)
tree91c408352947bec09aee2032949ef1acef606d15 /src
parent768b8c4dbcb3cdaccab87daa833ab176a438cc3c (diff)
downloadvim-git-362e1a30c6f3527d5d0efc328c2fb448290cd6fc.tar.gz
updated for version 7.0216v7.0216
Diffstat (limited to 'src')
-rw-r--r--src/GvimExt/Makefile5
-rw-r--r--src/GvimExt/gvimext.h6
-rw-r--r--src/GvimExt/gvimext.rc2
-rw-r--r--src/INSTALLpc.txt420
-rw-r--r--src/Make_mvc.mak53
-rw-r--r--src/dosinst.h9
-rw-r--r--src/edit.c10
-rw-r--r--src/eval.c43
-rw-r--r--src/ex_cmds.c16
-rw-r--r--src/ex_cmds.h6
-rw-r--r--src/ex_cmds2.c2
-rw-r--r--src/ex_docmd.c9
-rw-r--r--src/ex_getln.c128
-rw-r--r--src/feature.h6
-rw-r--r--src/fileio.c4
-rw-r--r--src/globals.h5
-rw-r--r--src/gui.h2
-rw-r--r--src/gui_beval.c2
-rw-r--r--src/gui_gtk_x11.c38
-rw-r--r--src/gui_w32.c22
-rw-r--r--src/if_cscope.c2
-rw-r--r--src/if_mzsch.c2
-rw-r--r--src/if_ole.cpp2
-rw-r--r--src/if_perl.xs5
-rw-r--r--src/if_ruby.c2
-rw-r--r--src/if_sniff.c2
-rw-r--r--src/if_tcl.c2
-rw-r--r--src/main.c4
-rw-r--r--src/mbyte.c80
-rw-r--r--src/memfile.c2
-rw-r--r--src/memline.c2
-rw-r--r--src/message.c8
-rw-r--r--src/misc1.c9
-rw-r--r--src/msvcsetup.bat12
-rw-r--r--src/netbeans.c2
-rw-r--r--src/normal.c9
-rw-r--r--src/ops.c2
-rw-r--r--src/option.c36
-rw-r--r--src/option.h3
-rw-r--r--src/os_msdos.c2
-rw-r--r--src/os_mswin.c2
-rw-r--r--src/os_win16.c2
-rw-r--r--src/os_win32.c3
-rw-r--r--src/proto/eval.pro2
-rw-r--r--src/proto/mbyte.pro4
-rw-r--r--src/proto/spell.pro1
-rw-r--r--src/regexp.c100
-rw-r--r--src/screen.c263
-rw-r--r--src/spell.c141
-rw-r--r--src/tag.c2
-rw-r--r--src/testdir/test58.in14
-rw-r--r--src/testdir/test59.in14
-rw-r--r--src/ui.c14
-rw-r--r--src/version.h4
-rw-r--r--src/vim.h50
-rw-r--r--src/vim.rc8
-rw-r--r--src/vimio.h16
-rw-r--r--src/xxd/Make_mvc.mak5
-rw-r--r--src/xxd/xxd.c7
59 files changed, 1105 insertions, 523 deletions
diff --git a/src/GvimExt/Makefile b/src/GvimExt/Makefile
index d1bd2d1da..f9dddf6ce 100644
--- a/src/GvimExt/Makefile
+++ b/src/GvimExt/Makefile
@@ -16,8 +16,9 @@ all: gvimext.dll
gvimext.dll: gvimext.obj \
gvimext.res
- $(implib) /NOLOGO -machine:$(CPU) -def:gvimext.def $** -out:gvimext.lib
- $(link) $(dlllflags) -base:0x1C000000 -out:$*.dll $** $(olelibsdll) shell32.lib gvimext.lib comctl32.lib gvimext.exp
+# $(implib) /NOLOGO -machine:$(CPU) -def:gvimext.def $** -out:gvimext.lib
+# $(link) $(dlllflags) -base:0x1C000000 -out:$*.dll $** $(olelibsdll) shell32.lib gvimext.lib comctl32.lib gvimext.exp
+ $(link) $(lflags) -dll -def:gvimext.def -base:0x1C000000 -out:$*.dll $** $(olelibsdll) shell32.lib comctl32.lib
gvimext.obj: gvimext.h
diff --git a/src/GvimExt/gvimext.h b/src/GvimExt/gvimext.h
index 5eb50048b..d68807320 100644
--- a/src/GvimExt/gvimext.h
+++ b/src/GvimExt/gvimext.h
@@ -33,6 +33,12 @@
#define INC_OLE2 // WIN32, get ole2 from windows.h
+/* Visual Studio 2005 has 'deprecated' many of the standard CRT functions */
+#if _MSC_VER >= 1400
+# define _CRT_SECURE_NO_DEPRECATE
+# define _CRT_NONSTDC_NO_DEPRECATE
+#endif
+
#include <windows.h>
#include <windowsx.h>
#include <shlobj.h>
diff --git a/src/GvimExt/gvimext.rc b/src/GvimExt/gvimext.rc
index 19a5d0ca7..22102db75 100644
--- a/src/GvimExt/gvimext.rc
+++ b/src/GvimExt/gvimext.rc
@@ -8,7 +8,7 @@
// Generated from the TEXTINCLUDE 2 resource.
//
#ifndef __BORLANDC__
-# include "afxres.h"
+# include "winresrc.h"
#endif
/////////////////////////////////////////////////////////////////////////////
diff --git a/src/INSTALLpc.txt b/src/INSTALLpc.txt
index d220e0e1b..106c76703 100644
--- a/src/INSTALLpc.txt
+++ b/src/INSTALLpc.txt
@@ -3,215 +3,196 @@ INSTALLpc.txt - Installation of Vim on PC
This file contains instructions for compiling Vim. If you already have an
executable version of Vim, you don't need this.
-More information can be found here:
+More information can be found here: (Very stale now.)
- http://mywebpage.netscape.com/sharppeople/vim/howto/
+ http://mywebpage.netscape.com/sharppeople/vim/howto/
The file "feature.h" can be edited to match your preferences. You can skip
this, then you will get the default behavior as is documented, which should
be fine for most people.
+With the exception of the last two sections (Windows 3.1 and MS-DOS),
+this document assumes that you are building Vim for Win32
+(Windows NT/2000/XP/2003/Vista and Windows 95/98/Me)
+
Contents:
-1. MS-DOS
-2. Win32 (Windows XP/NT and Windows 95/98)
-3. Windows NT with OpenNT
-4. Windows 3.1
-5. Using Mingw
-6. Cross compiling for Win32 from a Linux machine
-7. Building with Python support
-8. Building with MzScheme support
+1. Microsoft Visual C++
+2. Using MinGW
+3. Cygwin
+4. Borland
+5. Cross compiling for Win32 from a Linux machine
+6. Building with Python support
+7. Building with MzScheme support
+8. Windows 3.1
+9. MS-DOS
+The currently preferred method is using the free Visual C++ Toolkit 2003.
-1. MS-DOS
-=========
-Summary:
-ren Make_bc3.mak Makefile; make 16 bit, Borland C++ and Turbo C++
-ren Make_tcc.mak Makefile; make 16 bit, Turbo C
-make -f Make_djg.mak 32 bit, DJGPP 2.0
-make -f Make_bc5.mak 32 bit, Borland C++ 5.x (edit it to
- define DOS)
+1. Microsoft Visual C++
+=======================
-Warning: Be sure to use the right make.exe. Microsoft C make doesn't work;
-Borland make only works with Make_bc3.mak, Make_bc5.mak and Make_tcc.mak;
-DJGPP/GNU make must be used for Make_djg.mak.
+Visual Studio
+-------------
-The Borland C++ compiler has been used to generate the MS-DOS executable; it
-should work without problems. You will probably have to change the paths for
-LIBPATH and INCLUDEPATH in the start of the Makefile. You will get two
-warnings which can be ignored (one about _chmod and one about precompiled
-header files).
+Building with Visual Studio (VS 98, VS .NET, VS .NET 2003, and VS .NET 2005)
+is straightforward. (These instructions should also work for VS 4 and VS 5.)
-The "spawno" library by Ralf Brown was used in order to free memory when Vim
-starts a shell or other external command. Only about 200 bytes are taken from
-conventional memory. When recompiling get the spawno library from Simtel,
-directory "msdos/c". It is called something like "spwno413.zip". Or follow
-the instructions in the Makefile to remove the library.
+To build Vim from the command line with MSVC, use Make_mvc.mak.
+Visual Studio installed a batch file called vcvars32.bat, which you must
+run to set up paths for nmake and MSVC.
-The Turbo C Makefile has not been tested much lately. It is included for those
-that don't have C++. You may need to make a few changes to get it to work.
+nmake -f Make_mvc.mak console Win32 SDK or Microsoft Visual C++
+nmake -f Make_mvc.mak GUI=yes GUI Microsoft Visual C++
+nmake -f Make_mvc.mak OLE=yes OLE Microsoft Visual C++
+nmake -f Make_mvc.mak PERL=C:\Perl PYTHON=C:\Python etc.
+ Perl, Python, etc.
-DJGPP needs to be installed properly to compile Vim; you need a lot of things
-before it works. When your setup is OK, Vim should compile with just one
-warning (about an argument to signal()).
+Make_mvc.mak allows a Vim to be built with various different features and
+debug support. Debugging with MS Devstudio is provided by Make_dvc.mak.
+For a description of the use of Make_dvc.mak, look in Make_mvc.mak.
-Make_bc5.mak is for those that have Borland C++ 5.0 or later. At the top of
-the file, there are some variables you can change to make either a 32-bit
-Windows exe (GUI or console mode), or a 16-bit MS-DOS version.
-NOTE: multi-byte support is broken in the Borland libraries, not everything
-will work properly! Esp. handling multi-byte file names.
+For compiling Gvim with IME support on far-east Windows, add IME=yes
+to the parameters you pass to Make_mvc.mak.
-If you get all kinds of strange error messages when compiling, try adding
-changing the file format from "unix" to "dos".
+To build Vim from within the Visual Studio IDE, open the Make_ivc.mak project.
+(Note: Make_ivc.mak is not as rich as Make_mvc.mak, which allows for
+far more configuration.) Make_ivc.mak can also be built with nmake.
+
+nmake -f Make_ivc.mak CFG="Vim - Win32 Release gvim"
+ GUI Microsoft Visual C++ 4.x or later
+nmake -f Make_ivc.mak CFG="Vim - Win32 Release gvim OLE"
+ OLE Microsoft Visual C++ 4.x or later
+See the specific files for comments and options.
-2. Win32 (Windows NT/XP and Windows 95/98)
-====================================
+These files have been supplied by George V. Reilly, Ben Singer, Ken Scott and
+Ron Aaron; they have been tested.
-Summary:
-vcvars32 Setup paths for nmake and MSVC
-nmake -f Make_mvc.mak console Win32 SDK or Microsoft Visual C++
-nmake -f Make_mvc.mak GUI=yes GUI Microsoft Visual C++
-nmake -f Make_mvc.mak OLE=yes OLE Microsoft Visual C++
-nmake -f Make_mvc.mak PERL=C:\Perl PYTHON=C:\Python etc.
- Perl, Python, etc.
- Microsoft Visual C++
+Visual C++ Toolkit 2003
+-----------------------
-make -f Make_bc5.mak GUI Borland C++ 5.x
-make -f Make_bc5.mak console Borland C++ 5.x (change the file)
-nmake -f Make_ivc.mak CFG="Vim - Win32 Release gvim"
- GUI Microsoft Visual C++ 4.x or later
-nmake -f Make_ivc.mak CFG="Vim - Win32 Release gvim OLE"
- OLE Microsoft Visual C++ 4.x or later
+You can download the Microsoft Visual C++ Toolkit 2003 from
+ http://msdn.microsoft.com/visualc/vctoolkit2003/
+This contains the command-line tools (compiler, linker, CRT headers,
+and libraries) for Visual Studio .NET 2003, but not the Visual Studio IDE.
+To compile and debug Vim with the VC2003 Toolkit, you will also need
+|ms-platform-sdk|, |dotnet-1.1-redist|, |dotnet-1.1-sdk|,
+and |windbg-download|.
-make -f Make_cyg.mak various Cygnus gcc
-make -f Make_ming.mak various MingW with gcc
+It's easier to download Visual C++ 2005 Express Edition, |msvc-2005-express|.
+The advantage of the VC 2003 Toolkit is that it will be freely available
+long after VC 2005 Express Edition stops being free in November 2006.
-See the specific files for comments and options.
+The free Code::Blocks IDE works with the VC2003 Toolkit, as described at
+ http://wiki.codeblocks.org/index.php?title=Integrating_Microsoft_Visual_Toolkit_2003_with_Code::Blocks_IDE
+(This site also takes you through configuring a number of other
+free C compilers for Win32.)
-These files have been supplied by George V. Reilly, Ben Singer, Ken Scott and
-Ron Aaron; they have been tested. The Cygnus one many not fully work yet.
-With Cygnus gcc you can use the Unix Makefile instead (you need to get the
-Unix archive then). Then you get a Cygwin application (feels like Vim is
-runnin on Unix), while with Make_cyg.mak you get a Windows application (like
-with the other makefiles).
+To compile Vim using the VC2003 Toolkit and Make_mvc.mak, you must first
+execute the following commands in a cmd.exe window (the msvcsetup.bat batch
+file can be used):
+
+ set PATH=%SystemRoot%\Microsoft.NET\Framework\v1.1.4322;%PATH%
+ call "%VCToolkitInstallDir%vcvars32.bat"
+ set MSVCVer=7.1
+ call "%ProgramFiles%\Microsoft Platform SDK\SetEnv.Cmd"
+ set LIB=%ProgramFiles%\Microsoft Visual Studio .NET 2003\Vc7\lib;%LIB%
-You can also use the Visual C++ IDE: use File/Open workspace, select the
-Make_ivc.mak file, then select Build/Build all. This builds the GUI version
-by default.
+Now you can build Vim with Make_mvc.mak.
-Vim for Win32 compiles with the Microsoft Visual C++ 2.0 compiler and later,
-and with the Borland C++ 4.5 32-bit compiler and later. It compiles on
-Windows 95 and all four NT platforms: i386, Alpha, MIPS, and PowerPC. The
-NT/i386 and the Windows 95 binaries are identical. Use Make_mvc.mak to
-compile with Visual C++ and Make_bc5.mak to compile with Borland C++.
-Make_mvc.mak allows a Vim to be built with various different features and
-debug support. Debugging with MS Devstudio is provided by Make_dvc.mak.
-For a description of the use of Make_dvc.mak, look in Make_mvc.mak.
+Getting the Windows Platform SDK *ms-platform-sdk*
-For compiling Gvim with IME support on far-east Windows, uncomment the
-MULTI_BYTE_IME define in the src/feature.h file before compiling.
+You will also need a copy of the Windows Platform SDK from
+ http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
+Specifically, you need the Windows Core SDK subset of the Platform SDK,
+which contains the Windows headers and libraries.
-The Win32 console binary was compiled with Visual C++ version 5.0, using
-Make_mvc.mak and Make_bc5.mak (Borland C). Other compilers should also work.
-If you get all kinds of strange error messages when compiling (you shouldn't
-with the Microsoft or Borland 32-bit compilers), try adding <CR> characters
-at the end of each line.
-You probably need to run "vcvars32" before using "nmake".
+Getting the .NET Framework 1.1 Runtime *dotnet-1.1-redist*
-For making the Win32s version, you need Microsoft Visual C++ 4.1 OR EARLIER.
-In version 4.2 support for Win32s was dropped! Use this command:
- nmake -f Make_mvc.mak GUI=yes
-
-See the respective Makefiles for more comments.
-
-
-3. Windows NT with OpenNT
-=========================
-
-(contributed by Michael A. Benzinger)
-
-Building Vim on OpenNT 2.0 on Windows NT 4.0, with Softway's prerelease gcc:
-1. export CONFIG_SHELL=//D/OpenNT/bin/sh
-2. Make the following exports for modifying config.mk:
- export CFLAGS=-O -Wshadow
- export X_PRE_LIBS=-lXmu
-2. Run configure as follows:
- configure --prefix=/vim --bindir=/bin/opennt --enable-gui=Motif
- If you don't have OpenNTif (Motif support), use this:
- configure --prefix=/vim --bindir=/bin/opennt --enable-gui=Athena
-3. Edit Makefile to perform the following since the Makefile include syntax
- differs from that of gmake:
- #include config.mk
- .include "config.mk"
-4. Change all install links to be "ln -f" and not "ln -s".
-5. Change to the 'ctags' directory and configure.
-6. Edit the Makefile and remove spurious spaces from lines 99 and 114.
-7. Change slink to "ln -f" from "ln -s".
-8. Return to the src directory.
-9. make
-
-
-4. Windows 3.1x
-===============
+You need the .NET Framework 1.1 Redistributable Package from
+ http://www.microsoft.com/downloads/details.aspx?familyid=262d25e3-f589-4842-8157-034d1e7cf3a3
+or from Windows Update:
+ http://windowsupdate.microsoft.com/
+This is needed to install |dotnet-1.1-sdk|. It also contains cvtres.exe,
+which is needed to link Vim.
-make -f Make_w16.mak 16 bit, Borland C++ 5.0
-Warning: Be sure to use the right make.exe. It should be Borland make.
+Getting the .NET Framework 1.1 SDK *dotnet-1.1-sdk*
-You will almost certainly have to change the paths for libs and include files
-in the Makefile. Look for "D:\BC5" and "ctl3dv2". You will get a number of
-warnings which can be ignored ( _chmod, precompiled header files, and
-"possibly incorrect assignment").
+You need the .NET Framework 1.1 SDK from
+ http://www.microsoft.com/downloads/details.aspx?familyid=9b3a2ca6-3647-4070-9f41-a333c6b9181d
+This contains some additional libraries needed to compile Vim,
+such as msvcrt.lib. You must install |dotnet-1.1-redist| before
+installing the .NET 1.1 SDK.
-The makefile should also work for BC++ 4.0 and 4.5, but may need tweaking to
-remove unsupported compiler & liker options.
+Getting the WinDbg debugger *windbg-download*
+
+The Debugging Tools for Windows can be downloaded from
+ http://www.microsoft.com/whdc/devtools/debugging/default.mspx
+This includes the WinDbg debugger, which you will want if you ever need
+to debug Vim itself. An earlier version of the Debugging Tools
+is also available through the Platform SDK, |ms-platform-sdk|.
-5. Mingw
+
+Visual C++ 2005 Express Edition
+-------------------------------
+
+Visual C++ 2005 Express Edition can be downloaded for free
+before November 2006 from
+ http://msdn.microsoft.com/vstudio/express/visualC/default.aspx
+This includes the IDE and the debugger. You will also need
+|ms-platform-sdk|. You can build Vim with Make_mvc.mak.
+
+Instructions for integrating the Platform SDK into VC Express:
+ http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/default.aspx
+
+
+2. MinGW
========
(written by Ron Aaron: <ronaharon@yahoo.com>)
-This is about how to produce a Win32 binary of gvim with Mingw.
+This is about how to produce a Win32 binary of gvim with MinGW.
First, you need to get the 'mingw32' compiler, which is free for the download
at:
- http://www.mingw.org/
+ http://www.mingw.org/
Once you have downloaded the compiler binaries, unpack them on your hard disk
somewhere, and put them on your PATH. If you are on Win95/98 you can edit
your AUTOEXEC.BAT file with a line like:
- set PATH=C:\GCC-2.95.2\BIN;%PATH%
+ set PATH=C:\GCC-2.95.2\BIN;%PATH%
-or on NT/2000, go to the Control Panel, System, and edit the environment from
-there.
+or on NT/2000/XP, go to the Control Panel, (Performance and Maintenance),
+System, Advanced, and edit the environment from there.
-Test if gcc is on your path. From a CMD (or COMMAND on '95/98):
+Test if gcc is on your path. From a CMD (or COMMAND on '95/98) window:
- C:\> gcc --version
- 2.95.2
+ C:\> gcc --version
+ 2.95.2
- C:\> make --version
- GNU Make version 3.77 (...etc...)
+ C:\> make --version
+ GNU Make version 3.77 (...etc...)
Now you are ready to rock 'n' roll. Unpack the vim sources (look on
www.vim.org for exactly which version of the vim files you need).
Change directory to 'vim\src':
- C:\> cd vim\src
- C:\VIM\SRC>
+ C:\> cd vim\src
+ C:\VIM\SRC>
and you type:
- make -f Make_ming.mak gvim.exe
+ make -f Make_ming.mak gvim.exe
After churning for a while, you will end up with 'gvim.exe' in the 'vim\src'
directory.
@@ -224,10 +205,9 @@ the 'gvim.exe' to 'vim.exe' in the 'make' commands given above.
If you are dismayed by how big the EXE is, I strongly recommend you get 'UPX'
(also free!) and compress the file (typical compression is 50%). UPX can be
found at
- http://upx.tsx.org/
-
+ http://www.upx.org/
-ADDITION: NLS support with Mingw
+ADDITION: NLS support with MinGW
(by Eduardo F. Amatria <eferna1@platea.pntic.mec.es>)
@@ -235,58 +215,44 @@ If you want National Language Support, read the file src/po/README_mingw.txt.
You need to uncomment lines in Make_ming.mak to have NLS defined.
-6. Cross compiling for Win32 from a Linux machine
+3. Cygwin
+=========
+
+Use Make_cyg.mak with Cygwin's GCC. See
+ http://users.skynet.be/antoine.mechelynck/vim/compile.htm
+
+The Cygnus one many not fully work yet.
+With Cygnus gcc you can use the Unix Makefile instead (you need to get the
+Unix archive then). Then you get a Cygwin application (feels like Vim is
+runnin on Unix), while with Make_cyg.mak you get a Windows application (like
+with the other makefiles).
+
+
+4. Borland
+===========
+
+Use Make_bc5.mak with Borland C++ 5.x. See
+ http://users.skynet.be/antoine.mechelynck/vim/compile.htm
+
+
+5. Cross compiling for Win32 from a Linux machine
=================================================
-(written by Ron Aaron: <ronaharon@yahoo.com> with help from
-Martin Kahlert <martin.kahlert@infineon.com>)
+[Update of 1) needs to be verified]
If you like, you can compile the 'mingw' Win32 version from the comfort of
your Linux (or other unix) box. To do this, you need to follow a few steps:
-
- 1) Install the mingw32 cross-compiler (if you have it, go to step 2)
- 1a) from 'ftp://ftp.nanotech.wisc.edu/pub/khan/gnu-win32/mingw32/snapshots/gcc-2.95.2-1',
- get:
- binutils-19990818-1-src.tar.gz
- mingw-msvcrt-20000203.zip
- gcc-2.95.2-1-x86-win32.diff.gz
- 1b) from 'http://gcc.gnu.org/' get:
- gcc-2.95.2.tar.gz
- 1c) create a place to put the compiler source and binaries:
- (assuming you are in the home directory)
- mkdir gcc-bin
- mkdir gcc-src
- 1d) unpack the sources:
- cd gcc-src
- tar xzf ../binutils-19990818-1-src.tar.gz
- tar xzf ../gcc-2.95.2.tar.gz
- unzip ../mingw-msvcrt-20000203
- 1e) build the different tools:
- export PREFIX=~/gcc-bin/
- cd gcc-2.95.2
- zcat ../gcc-2.95.2-1-x86-win32.diff.gz | patch -p1 -E
- cd ../binutils-19990818
- ./configure --target=i586-pc-mingw32msvc --prefix=$PREFIX
- make
- make install
- cd ../gcc-2.95.2
- ./configure --target=i586-pc-mingw32msvc \
- --with-libs=~/gcc-bin/i386-mingw32msvc/lib \
- --with-headers=~/gcc-bin/i386-mingw32msvc/include \
- --enable-languages=c++ \
- --prefix=$PREFIX
- make
- make install
- 1f) Add $PREFIX/bin to your $PATH.
-
- 2) get the *unix* version of the vim sources
- 3) in 'Make_ming.mak', set 'CROSS' to '1' instead of '0'.
- 4) make -f Make_ming.mak gvim.exe
+ 1) Install the mingw32 cross-compiler. See
+ http://www.libsdl.org/extras/win32/cross/README.txt
+ 2) get the *unix* version of the vim sources
+ 3) in 'Make_ming.mak', set 'CROSS' to '1' instead of '0'.
+ 4) make -f Make_ming.mak gvim.exe
Now you have created the Windows binary from your Linux box! Have fun...
-7. Building with Python support
-=================================================
+
+6. Building with Python support
+===============================
(written by Ron Aaron: <ronaharon@yahoo.com>)
@@ -312,8 +278,9 @@ Now just do:
and you will end up with a Python-enabled, Win32 version. Enjoy!
-8. Building with MzScheme support
-=================================================
+
+7. Building with MzScheme support
+=================================
(written by Sergey Khorev <sergey.khorev@gmail.com>)
@@ -341,8 +308,71 @@ libmzschXXXXXXX.dll and libmzgcXXXXXXX.dll should be copied from
dir or even MzScheme home).
Pass that path as MZSCHEME_DLLS parameter for Make. E.g.,
-make -fMake_cyg.mak MZSCHEME=d:/Develop/MzScheme MZSCHEME_VER=209_000
+make -f Make_cyg.mak MZSCHEME=d:/Develop/MzScheme MZSCHEME_VER=209_000
MZSCHEME_DLLS=c:/Temp DYNAMIC_MZSCHEME=no
-After successful build these dlls can be freely removed, leaving them in
+After a successful build, these dlls can be freely removed, leaving them in
%WINDOWS%\System32 only.
+
+
+8. Windows 3.1x
+===============
+
+make -f Make_w16.mak 16 bit, Borland C++ 5.0
+
+Warning: Be sure to use the right make.exe. It should be Borland make.
+
+You will almost certainly have to change the paths for libs and include files
+in the Makefile. Look for "D:\BC5" and "ctl3dv2". You will get a number of
+warnings which can be ignored ( _chmod, precompiled header files, and
+"possibly incorrect assignment").
+
+The makefile should also work for BC++ 4.0 and 4.5, but may need tweaking to
+remove unsupported compiler & liker options.
+
+For making the Win32s version, you need Microsoft Visual C++ 4.1 OR EARLIER.
+In MSVC 4.2 support for Win32s was dropped! Use this command:
+ nmake -f Make_mvc.mak GUI=yes
+
+
+9. MS-DOS
+=========
+
+Summary:
+ren Make_bc3.mak Makefile; make 16 bit, Borland C++ and Turbo C++
+ren Make_tcc.mak Makefile; make 16 bit, Turbo C
+make -f Make_djg.mak 32 bit, DJGPP 2.0
+make -f Make_bc5.mak 32 bit, Borland C++ 5.x (edit it to
+ define DOS)
+
+Warning: Be sure to use the right make.exe. Microsoft C make doesn't work;
+Borland make only works with Make_bc3.mak, Make_bc5.mak and Make_tcc.mak;
+DJGPP/GNU make must be used for Make_djg.mak.
+
+The Borland C++ compiler has been used to generate the MS-DOS executable; it
+should work without problems. You will probably have to change the paths for
+LIBPATH and INCLUDEPATH in the start of the Makefile. You will get two
+warnings which can be ignored (one about _chmod and one about precompiled
+header files).
+
+The "spawno" library by Ralf Brown was used in order to free memory when Vim
+starts a shell or other external command. Only about 200 bytes are taken from
+conventional memory. When recompiling get the spawno library from Simtel,
+directory "msdos/c". It is called something like "spwno413.zip". Or follow
+the instructions in the Makefile to remove the library.
+
+The Turbo C Makefile has not been tested much lately. It is included for those
+that don't have C++. You may need to make a few changes to get it to work.
+
+DJGPP needs to be installed properly to compile Vim; you need a lot of things
+before it works. When your setup is OK, Vim should compile with just one
+warning (about an argument to signal()).
+
+Make_bc5.mak is for those that have Borland C++ 5.0 or later. At the top of
+the file, there are some variables you can change to make either a 32-bit
+Windows exe (GUI or console mode), or a 16-bit MS-DOS version.
+NOTE: multi-byte support is broken in the Borland libraries, not everything
+will work properly! Esp. handling multi-byte file names.
+
+If you get all kinds of strange error messages when compiling, try adding
+changing the file format from "unix" to "dos".
diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak
index ca94386ce..e569b9a83 100644
--- a/src/Make_mvc.mak
+++ b/src/Make_mvc.mak
@@ -131,9 +131,9 @@
### See feature.h for a list of optionals.
# If you want to build some optional features without modifying the source,
# you can set DEFINES on the command line, e.g.,
-# nmake -f makefile.mvc "DEFINES=-DEMACS_TAGS"
+# nmake -f Make_mvc.mvc "DEFINES=-DEMACS_TAGS"
-# Build on both Windows NT and Windows 95
+# Build on both Windows NT/XP and Windows 9x
TARGETOS = BOTH
@@ -167,12 +167,12 @@ OBJDIR = $(OBJDIR)Z
OBJDIR = $(OBJDIR)d
!endif
-# ntwin32.mak requires that CPU be set appropriately
+# Win32.mak requires that CPU be set appropriately
!ifdef PROCESSOR_ARCHITECTURE
-# We're on Windows NT or using VC 6
+# We're on Windows NT or using VC 6+
CPU = $(PROCESSOR_ARCHITECTURE)
-! if "$(CPU)" == "x86"
+! if ("$(CPU)" == "x86") || ("$(CPU)" == "X86")
CPU = i386
! endif
!else # !PROCESSOR_ARCHITECTURE
@@ -190,17 +190,12 @@ MAKEFLAGS_GVIMEXT = DEBUG=yes
!endif
-# Build a multithreaded version for the Windows 95 dead keys hack
-# Commented out because it doesn't work.
-# MULTITHREADED = 1
-
-
# Get all sorts of useful, standard macros from the SDK. (Note that
# MSVC 2.2 does not install <ntwin32.mak> in the \msvc20\include
# directory, but you can find it in \msvc20\include on the CD-ROM.
# You may also need <win32.mak> from the same place.)
-!include <ntwin32.mak>
+!include <Win32.mak>
#>>>>> path of the compiler and linker; name of include and lib directories
@@ -263,12 +258,14 @@ XPM_INC = -I $(XPM)\include
!endif
!endif
+# Set which version of the CRT to use
!if defined(USE_MSVCRT)
CVARS = $(cvarsdll)
-!elseif defined(MULTITHREADED)
-CVARS = $(cvarsmt)
+# !elseif defined(MULTITHREADED)
+# CVARS = $(cvarsmt)
!else
-CVARS = $(cvars)
+# CVARS = $(cvars)
+CVARS = $(cvarsmt)
!endif
# need advapi32.lib for GetUserName()
@@ -276,7 +273,7 @@ CVARS = $(cvars)
# gdi32.lib and comdlg32.lib for printing support
# ole32.lib and uuid.lib are needed for FEAT_SHORTCUT
CON_LIB = advapi32.lib shell32.lib gdi32.lib comdlg32.lib ole32.lib uuid.lib
-!if "$(VC6)" == "yes"
+!if "$(DELAYLOAD)" == "yes"
CON_LIB = $(CON_LIB) /DELAYLOAD:comdlg32.dll /DELAYLOAD:ole32.dll DelayImp.lib
!endif
@@ -340,10 +337,14 @@ RCFLAGS = $(rcflags) $(rcvars) -DNDEBUG
! ifdef USE_MSVCRT
CFLAGS = $(CFLAGS) -MD
LIBC = msvcrt.lib
-! elseif defined(MULTITHREADED)
-LIBC = libcmt.lib
+# CFLAGS = $(CFLAGS) $(cvarsdll)
+# ! elseif defined(MULTITHREADED)
+# LIBC = libcmt.lib
+# CFLAGS = $(CFLAGS) $(cvarsmt)
! else
-LIBC = libc.lib
+# LIBC = libc.lib
+LIBC = libcmt.lib
+# CFLAGS = $(CFLAGS) $(cvars)
! endif
!else # DEBUG
VIM = vimd
@@ -358,10 +359,14 @@ LIBC = /fixed:no
! ifdef USE_MSVCRT
CFLAGS = $(CFLAGS) -MDd
LIBC = $(LIBC) msvcrtd.lib
-! elseif defined(MULTITHREADED)
-LIBC = $(LIBC) libcmtd.lib
+# CFLAGS = $(CFLAGS) $(cvarsdll)
+# ! elseif defined(MULTITHREADED)
+# LIBC = $(LIBC) libcmtd.lib
+# CFLAGS = $(CFLAGS) $(cvarsmt)
! else
-LIBC = $(LIBC) libcd.lib
+# LIBC = $(LIBC) libcd.lib
+LIBC = $(LIBC) libcmtd.lib
+# CFLAGS = $(CFLAGS) $(cvars)
! endif
!endif # DEBUG
@@ -666,7 +671,7 @@ CFLAGS = $(CFLAGS) -DFEAT_$(FEATURES)
# on a crash (doesn't add overhead to the executable).
#
CFLAGS = $(CFLAGS) /Zi /Fd$(OUTDIR)/
-LINK_PDB = /PDB:$(OUTDIR)/$(VIM).pdb -debug:full -debugtype:cv,fixup
+LINK_PDB = /PDB:$(OUTDIR)/$(VIM).pdb -debug # -debug:full -debugtype:cv,fixup
#
# End extra feature include
@@ -1004,4 +1009,8 @@ proto.h: \
proto/window.pro \
$(NETBEANS_PRO)
+.cod.c:
+ $(CC) $(CFLAGS) /FAc $<
+
+
# vim: set noet sw=8 ts=8 sts=0 wm=0 tw=0:
diff --git a/src/dosinst.h b/src/dosinst.h
index 5ff4d67a0..7b53e5008 100644
--- a/src/dosinst.h
+++ b/src/dosinst.h
@@ -9,6 +9,13 @@
/*
* dosinst.h: Common code for dosinst.c and uninstal.c
*/
+
+/* Visual Studio 2005 has 'deprecated' many of the standard CRT functions */
+#if _MSC_VER >= 1400
+# define _CRT_SECURE_NO_DEPRECATE
+# define _CRT_NONSTDC_NO_DEPRECATE
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -16,7 +23,7 @@
#include <fcntl.h>
#ifndef UNIX_LINT
-# include <io.h>
+# include "vimio.h"
# include <ctype.h>
# ifndef __CYGWIN__
diff --git a/src/edit.c b/src/edit.c
index 3ad12a7a6..3a7a8ced6 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -7604,7 +7604,7 @@ ins_bs(c, mode, inserted_space_p)
int in_indent;
int oldState;
#ifdef FEAT_MBYTE
- int p1, p2;
+ int cpc[MAX_MCO]; /* composing characters */
#endif
/*
@@ -7920,16 +7920,16 @@ ins_bs(c, mode, inserted_space_p)
{
#ifdef FEAT_MBYTE
if (enc_utf8 && p_deco)
- (void)utfc_ptr2char(ml_get_cursor(), &p1, &p2);
+ (void)utfc_ptr2char(ml_get_cursor(), cpc);
#endif
(void)del_char(FALSE);
#ifdef FEAT_MBYTE
/*
- * If p1 or p2 is non-zero, there are combining characters we
- * need to take account of. Don't back up before the base
+ * If there are combining characters and 'delcombine' is set
+ * move the cursor back. Don't back up before the base
* character.
*/
- if (enc_utf8 && p_deco && (p1 != NUL || p2 != NUL))
+ if (enc_utf8 && p_deco && cpc[0] != NUL)
inc_cursor();
#endif
#ifdef FEAT_RIGHTLEFT
diff --git a/src/eval.c b/src/eval.c
index 1c7d0f8c1..4336a2633 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -11,7 +11,7 @@
* eval.c: Expression evaluation.
*/
#if defined(MSDOS) || defined(MSWIN)
-# include <io.h> /* for mch_open(), must be before vim.h */
+# include "vimio.h" /* for mch_open(), must be before vim.h */
#endif
#include "vim.h"
@@ -718,7 +718,7 @@ static void call_user_func __ARGS((ufunc_T *fp, int argcount, typval_T *argvars,
static void add_nr_var __ARGS((dict_T *dp, dictitem_T *v, char *name, varnumber_T nr));
static win_T *find_win_by_nr __ARGS((typval_T *vp));
static int searchpair_cmn __ARGS((typval_T *argvars, pos_T *match_pos));
-static int search_cmn __ARGS((typval_T *argvars, pos_T *match_pos));
+static int search_cmn __ARGS((typval_T *argvars, pos_T *match_pos, int *flagsp));
/* Character used as separated in autoload function/variable names. */
#define AUTOLOAD_CHAR '#'
@@ -1171,18 +1171,28 @@ skip_expr(pp)
* Return pointer to allocated memory, or NULL for failure.
*/
char_u *
-eval_to_string(arg, nextcmd)
+eval_to_string(arg, nextcmd, dolist)
char_u *arg;
char_u **nextcmd;
+ int dolist; /* turn List into sequence of lines */
{
typval_T tv;
char_u *retval;
+ garray_T ga;
if (eval0(arg, &tv, nextcmd, TRUE) == FAIL)
retval = NULL;
else
{
- retval = vim_strsave(get_tv_string(&tv));
+ if (dolist && tv.v_type == VAR_LIST)
+ {
+ ga_init2(&ga, (int)sizeof(char), 80);
+ list_join(&ga, tv.vval.v_list, (char_u *)"\n", TRUE, 0);
+ ga_append(&ga, NUL);
+ retval = (char_u *)ga.ga_data;
+ }
+ else
+ retval = vim_strsave(get_tv_string(&tv));
clear_tv(&tv);
}
@@ -1206,7 +1216,7 @@ eval_to_string_safe(arg, nextcmd, use_sandbox)
if (use_sandbox)
++sandbox;
++textlock;
- retval = eval_to_string(arg, nextcmd);
+ retval = eval_to_string(arg, nextcmd, FALSE);
if (use_sandbox)
--sandbox;
--textlock;
@@ -13273,25 +13283,27 @@ get_search_arg(varp, flagsp)
* Shared by search() and searchpos() functions
*/
static int
-search_cmn(argvars, match_pos)
+search_cmn(argvars, match_pos, flagsp)
typval_T *argvars;
pos_T *match_pos;
+ int *flagsp;
{
+ int flags;
char_u *pat;
pos_T pos;
pos_T save_cursor;
int save_p_ws = p_ws;
int dir;
- int flags = 0;
int retval = 0; /* default: FAIL */
long lnum_stop = 0;
int options = SEARCH_KEEP;
int subpatnum;
pat = get_tv_string(&argvars[0]);
- dir = get_search_arg(&argvars[1], &flags); /* may set p_ws */
+ dir = get_search_arg(&argvars[1], flagsp); /* may set p_ws */
if (dir == 0)
goto theend;
+ flags = *flagsp;
if (flags & SP_START)
options |= SEARCH_START;
if (flags & SP_END)
@@ -13359,7 +13371,9 @@ f_search(argvars, rettv)
typval_T *argvars;
typval_T *rettv;
{
- rettv->vval.v_number = search_cmn(argvars, NULL);
+ int flags = 0;
+
+ rettv->vval.v_number = search_cmn(argvars, NULL, &flags);
}
/*
@@ -13649,13 +13663,16 @@ f_searchpos(argvars, rettv)
pos_T match_pos;
int lnum = 0;
int col = 0;
+ int n;
+ int flags = 0;
rettv->vval.v_number = 0;
if (rettv_list_alloc(rettv) == FAIL)
return;
- if (search_cmn(argvars, &match_pos) > 0)
+ n = search_cmn(argvars, &match_pos, &flags);
+ if (n > 0)
{
lnum = match_pos.lnum;
col = match_pos.col;
@@ -13663,7 +13680,8 @@ f_searchpos(argvars, rettv)
list_append_number(rettv->vval.v_list, (varnumber_T)lnum);
list_append_number(rettv->vval.v_list, (varnumber_T)col);
-
+ if (flags & SP_SUBPAT)
+ list_append_number(rettv->vval.v_list, (varnumber_T)n);
}
@@ -15675,6 +15693,7 @@ f_winrestview(argvars, rettv)
curwin->w_cursor.coladd = get_dict_number(dict, (char_u *)"coladd");
#endif
curwin->w_curswant = get_dict_number(dict, (char_u *)"curswant");
+ curwin->w_set_curswant = FALSE;
curwin->w_topline = get_dict_number(dict, (char_u *)"topline");
#ifdef FEAT_DIFF
@@ -16208,7 +16227,7 @@ make_expanded_name(in_start, expr_start, expr_end, in_end)
c1 = *in_end;
*in_end = NUL;
- temp_result = eval_to_string(expr_start + 1, &nextcmd);
+ temp_result = eval_to_string(expr_start + 1, &nextcmd, FALSE);
if (temp_result != NULL && nextcmd == NULL)
{
retval = alloc((unsigned)(STRLEN(temp_result) + (expr_start - in_start)
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 71766b910..22bbd45dd 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -52,12 +52,12 @@ do_ascii(eap)
char buf2[20];
char_u buf3[7];
#ifdef FEAT_MBYTE
- int c1 = 0;
- int c2 = 0;
+ int cc[MAX_MCO];
+ int ci = 0;
int len;
if (enc_utf8)
- c = utfc_ptr2char(ml_get_cursor(), &c1, &c2);
+ c = utfc_ptr2char(ml_get_cursor(), cc);
else
#endif
c = gchar_cursor();
@@ -95,9 +95,7 @@ do_ascii(eap)
_("<%s>%s%s %d, Hex %02x, Octal %03o"),
transchar(c), buf1, buf2, c, c, c);
#ifdef FEAT_MBYTE
- c = c1;
- c1 = c2;
- c2 = 0;
+ c = cc[ci++];
#endif
}
@@ -120,9 +118,9 @@ do_ascii(eap)
vim_snprintf((char *)IObuff + len, IOSIZE - len,
c < 0x10000 ? _("> %d, Hex %04x, Octal %o")
: _("> %d, Hex %08x, Octal %o"), c, c, c);
- c = c1;
- c1 = c2;
- c2 = 0;
+ if (ci == MAX_MCO)
+ break;
+ c = cc[ci++];
}
#endif
diff --git a/src/ex_cmds.h b/src/ex_cmds.h
index f66a9740d..364803439 100644
--- a/src/ex_cmds.h
+++ b/src/ex_cmds.h
@@ -831,14 +831,16 @@ EX(CMD_split, "split", ex_splitview,
BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR),
EX(CMD_spellgood, "spellgood", ex_spell,
BANG|RANGE|NOTADR|NEEDARG|EXTRA|TRLBAR),
-EX(CMD_spellwrong, "spellwrong", ex_spell,
- BANG|RANGE|NOTADR|NEEDARG|EXTRA|TRLBAR),
EX(CMD_spelldump, "spelldump", ex_spelldump,
BANG|TRLBAR),
+EX(CMD_spellinfo, "spellinfo", ex_spellinfo,
+ TRLBAR),
EX(CMD_spellrepall, "spellrepall", ex_spellrepall,
TRLBAR),
EX(CMD_spellundo, "spellundo", ex_spell,
BANG|RANGE|NOTADR|NEEDARG|EXTRA|TRLBAR),
+EX(CMD_spellwrong, "spellwrong", ex_spell,
+ BANG|RANGE|NOTADR|NEEDARG|EXTRA|TRLBAR),
EX(CMD_sprevious, "sprevious", ex_previous,
EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR),
EX(CMD_srewind, "srewind", ex_rewind,
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 0d7188ac1..7d6a0eb6e 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -12,7 +12,7 @@
*/
#if defined(WIN32) && defined(FEAT_CSCOPE)
-# include <io.h>
+# include "vimio.h"
#endif
#include "vim.h"
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 27f2ce760..e1e5a83c4 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -240,6 +240,7 @@ static void ex_popup __ARGS((exarg_T *eap));
# define ex_spell ex_ni
# define ex_mkspell ex_ni
# define ex_spelldump ex_ni
+# define ex_spellinfo ex_ni
# define ex_spellrepall ex_ni
#endif
#ifndef FEAT_MZSCHEME
@@ -3289,10 +3290,17 @@ set_one_cmd_context(xp, buff)
if (bow != NULL && in_quote)
xp->xp_pattern = bow;
xp->xp_context = EXPAND_FILES;
+
#ifndef BACKSLASH_IN_FILENAME
/* For a shell command more chars need to be escaped. */
if (usefilter || ea.cmdidx == CMD_bang)
+ {
xp->xp_shell = TRUE;
+
+ /* When still after the command name expand executables. */
+ if (xp->xp_pattern == skipwhite(arg))
+ xp->xp_context = EXPAND_SHELLCMD;
+ }
#endif
/* Check for environment variable */
@@ -5089,6 +5097,7 @@ static struct
{EXPAND_MAPPINGS, "mapping"},
{EXPAND_MENUS, "menu"},
{EXPAND_SETTINGS, "option"},
+ {EXPAND_SHELLCMD, "shellcmd"},
{EXPAND_TAGS, "tag"},
{EXPAND_TAGS_LISTFILES, "tag_listfiles"},
{EXPAND_USER_VARS, "var"},
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 061f8c4f5..4b7a58438 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -518,7 +518,8 @@ getcmdline(firstc, count, indent)
xpc.xp_context = EXPAND_NOTHING;
}
}
- if (xpc.xp_context == EXPAND_FILES && p_wmnu)
+ if ((xpc.xp_context == EXPAND_FILES
+ || xpc.xp_context == EXPAND_SHELLCMD) && p_wmnu)
{
char_u upseg[5];
@@ -2466,9 +2467,9 @@ draw_cmdline(start, len)
int pc, pc1;
int prev_c = 0;
int prev_c1 = 0;
- int u8c, u8c_c1, u8c_c2;
+ int u8c;
+ int u8cc[MAX_MCO];
int nc = 0;
- int dummy;
/*
* Do arabic shaping into a temporary buffer. This is very
@@ -2495,7 +2496,7 @@ draw_cmdline(start, len)
for (j = start; j < start + len; j += mb_l)
{
p = ccline.cmdbuff + j;
- u8c = utfc_ptr2char_len(p, &u8c_c1, &u8c_c2, start + len - j);
+ u8c = utfc_ptr2char_len(p, u8cc, start + len - j);
mb_l = utfc_ptr2len_len(p, start + len - j);
if (ARABIC_CHAR(u8c))
{
@@ -2505,7 +2506,7 @@ draw_cmdline(start, len)
/* displaying from right to left */
pc = prev_c;
pc1 = prev_c1;
- prev_c1 = u8c_c1;
+ prev_c1 = u8cc[0];
if (j + mb_l >= start + len)
nc = NUL;
else
@@ -2517,20 +2518,25 @@ draw_cmdline(start, len)
if (j + mb_l >= start + len)
pc = NUL;
else
- pc = utfc_ptr2char_len(p + mb_l, &pc1, &dummy,
+ {
+ int pcc[MAX_MCO];
+
+ pc = utfc_ptr2char_len(p + mb_l, pcc,
start + len - j - mb_l);
+ pc1 = pcc[0];
+ }
nc = prev_c;
}
prev_c = u8c;
- u8c = arabic_shape(u8c, NULL, &u8c_c1, pc, pc1, nc);
+ u8c = arabic_shape(u8c, NULL, &u8cc[0], pc, pc1, nc);
newlen += (*mb_char2bytes)(u8c, arshape_buf + newlen);
- if (u8c_c1 != 0)
+ if (u8cc[0] != 0)
{
- newlen += (*mb_char2bytes)(u8c_c1, arshape_buf + newlen);
- if (u8c_c2 != 0)
- newlen += (*mb_char2bytes)(u8c_c2,
+ newlen += (*mb_char2bytes)(u8cc[0], arshape_buf + newlen);
+ if (u8cc[1] != 0)
+ newlen += (*mb_char2bytes)(u8cc[1],
arshape_buf + newlen);
}
}
@@ -3353,6 +3359,7 @@ ExpandOne(xp, str, orig, options, mode)
#ifdef CASE_INSENSITIVE_FILENAME
if (xp->xp_context == EXPAND_DIRECTORIES
|| xp->xp_context == EXPAND_FILES
+ || xp->xp_context == EXPAND_SHELLCMD
|| xp->xp_context == EXPAND_BUFFERS)
{
if (TOLOWER_LOC(xp->xp_files[i][len]) !=
@@ -3454,6 +3461,7 @@ ExpandEscape(xp, str, numfiles, files, options)
if (options & WILD_ESCAPE)
{
if (xp->xp_context == EXPAND_FILES
+ || xp->xp_context == EXPAND_SHELLCMD
|| xp->xp_context == EXPAND_BUFFERS
|| xp->xp_context == EXPAND_DIRECTORIES)
{
@@ -3648,6 +3656,7 @@ showmatches(xp, wildmenu)
for (i = 0; i < num_files; ++i)
{
if (!showtail && (xp->xp_context == EXPAND_FILES
+ || xp->xp_context == EXPAND_SHELLCMD
|| xp->xp_context == EXPAND_BUFFERS))
{
home_replace(NULL, files_found[i], NameBuff, MAXPATHL, TRUE);
@@ -3700,6 +3709,7 @@ showmatches(xp, wildmenu)
for (j = maxlen - lastlen; --j >= 0; )
msg_putchar(' ');
if (xp->xp_context == EXPAND_FILES
+ || xp->xp_context == EXPAND_SHELLCMD
|| xp->xp_context == EXPAND_BUFFERS)
{
/* highlight directories */
@@ -3789,7 +3799,9 @@ expand_showtail(xp)
char_u *end;
/* When not completing file names a "/" may mean something different. */
- if (xp->xp_context != EXPAND_FILES && xp->xp_context != EXPAND_DIRECTORIES)
+ if (xp->xp_context != EXPAND_FILES
+ && xp->xp_context != EXPAND_SHELLCMD
+ && xp->xp_context != EXPAND_DIRECTORIES)
return FALSE;
end = gettail(xp->xp_pattern);
@@ -3826,7 +3838,9 @@ addstar(fname, len, context)
int new_len;
char_u *tail;
- if (context != EXPAND_FILES && context != EXPAND_DIRECTORIES)
+ if (context != EXPAND_FILES
+ && context != EXPAND_SHELLCMD
+ && context != EXPAND_DIRECTORIES)
{
/*
* Matching will be done internally (on something other than files).
@@ -3943,6 +3957,7 @@ addstar(fname, len, context)
* EXPAND_DIRECTORIES In some cases this is used instead of the latter
* when we know only directories are of interest. eg
* :set dir=^I
+ * EXPAND_SHELLCMD After ":!cmd", ":r !cmd" or ":w !cmd".
* EXPAND_SETTINGS Complete variable names. eg :set d^I
* EXPAND_BOOL_SETTINGS Complete boolean variables only, eg :set no^I
* EXPAND_TAGS Complete tags from the files in p_tags. eg :ta a^I
@@ -4165,6 +4180,93 @@ ExpandFromContext(xp, pat, num_file, file, options)
return ret;
}
+ if (xp->xp_context == EXPAND_SHELLCMD)
+ {
+ /*
+ * Expand shell command.
+ */
+ int i;
+ char_u *path;
+ int mustfree = FALSE;
+ garray_T ga;
+ char_u *buf = alloc(MAXPATHL);
+ int l;
+ char_u *s, *e;
+
+ if (buf == NULL)
+ return FAIL;
+
+ /* for ":set path=" and ":set tags=" halve backslashes for escaped
+ * space */
+ pat = vim_strsave(pat);
+ for (i = 0; pat[i]; ++i)
+ if (pat[i] == '\\' && pat[i + 1] == ' ')
+ STRCPY(pat + i, pat + i + 1);
+
+ flags |= EW_FILE | EW_EXEC;
+ /* For an absolute name we don't use $PATH. */
+ if ((pat[0] == '.' && (vim_ispathsep(pat[1])
+ || (pat[1] == '.' && vim_ispathsep(pat[2])))))
+ path = (char_u *)".";
+ else
+ path = vim_getenv((char_u *)"PATH", &mustfree);
+
+ ga_init2(&ga, (int)sizeof(char *), 10);
+ for (s = path; *s != NUL; s = e)
+ {
+#if defined(MSDOS) || defined(MSWIN) || defined(OS2)
+ e = vim_strchr(s, ';');
+#else
+ e = vim_strchr(s, ':');
+#endif
+ if (e == NULL)
+ e = s + STRLEN(s);
+
+ l = e - s;
+ if (l > MAXPATHL - 5)
+ break;
+ vim_strncpy(buf, s, l);
+ add_pathsep(buf);
+ l = STRLEN(buf);
+ vim_strncpy(buf + l, pat, MAXPATHL - 1 - l);
+
+ /* Expand matches in one directory of $PATH. */
+ ret = expand_wildcards(1, &buf, num_file, file, flags);
+ if (ret == OK)
+ {
+ if (ga_grow(&ga, *num_file) == FAIL)
+ FreeWild(*num_file, *file);
+ else
+ {
+ for (i = 0; i < *num_file; ++i)
+ {
+ s = (*file)[i];
+ if (STRLEN(s) > l)
+ {
+ /* Remove the path again. */
+ mch_memmove(s, s + l, STRLEN(s + l) + 1);
+ ((char_u **)ga.ga_data)[ga.ga_len] = s;
+ ++ga.ga_len;
+ }
+ else
+ vim_free(s);
+ }
+ vim_free(*file);
+ }
+ }
+ if (*e != NUL)
+ ++e;
+ }
+ *file = ga.ga_data;
+ *num_file = ga.ga_len;
+
+ vim_free(buf);
+ vim_free(pat);
+ if (mustfree)
+ vim_free(path);
+ return ret;
+ }
+
*file = (char_u **)"";
*num_file = 0;
if (xp->xp_context == EXPAND_HELP)
diff --git a/src/feature.h b/src/feature.h
index 34b673d5d..7231b96bf 100644
--- a/src/feature.h
+++ b/src/feature.h
@@ -609,6 +609,10 @@
# define FEAT_MBYTE
#endif
+/* Define this if you want to use 16 bit Unicode only, reduces memory used for
+ * the screen structures. */
+/* #define UNICODE16 */
+
/*
* +multi_byte_ime Win32 IME input method. Requires +multi_byte.
* Only for far-east Windows, so IME can be used to input
@@ -732,7 +736,7 @@
/*
* GUI tabline
*/
-#if defined(FEAT_GUI_GTK) && defined(HAVE_GTK2) && defined(FEAT_WINDOWS)
+#if defined(FEAT_GUI_GTK) && defined(FEAT_WINDOWS)
# define FEAT_GUI_TABLINE
#endif
diff --git a/src/fileio.c b/src/fileio.c
index 508de0bc1..8333f73b2 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -12,11 +12,11 @@
*/
#if defined(MSDOS) || defined(WIN16) || defined(WIN32) || defined(_WIN64)
-# include <io.h> /* for lseek(), must be before vim.h */
+# include "vimio.h" /* for lseek(), must be before vim.h */
#endif
#if defined __EMX__
-# include <io.h> /* for mktemp(), CJW 1997-12-03 */
+# include "vimio.h" /* for mktemp(), CJW 1997-12-03 */
#endif
#include "vim.h"
diff --git a/src/globals.h b/src/globals.h
index 9e0f3e4f8..d31109565 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -53,8 +53,9 @@ EXTERN char_u *LineWraps INIT(= NULL); /* line wraps to next line */
* Note: These three are only allocated when enc_utf8 is set!
*/
EXTERN u8char_T *ScreenLinesUC INIT(= NULL); /* decoded UTF-8 characters */
-EXTERN u8char_T *ScreenLinesC1 INIT(= NULL); /* first composing char */
-EXTERN u8char_T *ScreenLinesC2 INIT(= NULL); /* second composing char */
+EXTERN u8char_T *ScreenLinesC[MAX_MCO]; /* composing characters */
+EXTERN int Screen_mco INIT(= 0); /* value of p_mco used when
+ allocating ScreenLinesC[] */
/* Only used for euc-jp: Second byte of a character that starts with 0x8e.
* These are single-width. */
diff --git a/src/gui.h b/src/gui.h
index 90047c38f..6544244dd 100644
--- a/src/gui.h
+++ b/src/gui.h
@@ -391,6 +391,8 @@ typedef struct Gui
PangoContext *text_context; /* the context used for all text */
PangoFont *ascii_font; /* cached font for ASCII strings */
PangoGlyphString *ascii_glyphs; /* cached code point -> glyph map */
+# endif
+# ifdef FEAT_GUI_TABLINE
GtkWidget *tabline; /* tab pages line handle */
# endif
diff --git a/src/gui_beval.c b/src/gui_beval.c
index 0bcd023fe..b79884ee8 100644
--- a/src/gui_beval.c
+++ b/src/gui_beval.c
@@ -61,7 +61,7 @@ general_beval_cb(beval, state)
++textlock;
vim_free(result);
- result = eval_to_string(p_bexpr, NULL);
+ result = eval_to_string(p_bexpr, NULL, TRUE);
if (use_sandbox)
--sandbox;
diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c
index 04f1372ec..058e90c96 100644
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -3187,6 +3187,10 @@ on_select_tab(
}
}
+#ifndef HAVE_GTK2
+static int showing_tabline = 0;
+#endif
+
/*
* Show or hide the tabline.
*/
@@ -3196,11 +3200,19 @@ gui_mch_show_tabline(int showit)
if (gui.tabline == NULL)
return;
+#ifdef HAVE_GTK2
+ /* gtk_notebook_get_show_tabs does not exist in gtk+-1.2.10 */
if (!showit != !gtk_notebook_get_show_tabs(GTK_NOTEBOOK(gui.tabline)))
+#else
+ if (!showit != !showing_tabline)
+#endif
{
/* Note: this may cause a resize event */
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gui.tabline), showit);
update_window_manager_hints();
+#ifndef HAVE_GTK2
+ showing_tabline = showit;
+#endif
}
}
@@ -3211,7 +3223,13 @@ gui_mch_show_tabline(int showit)
gui_mch_showing_tabline(void)
{
return gui.tabline != NULL
- && gtk_notebook_get_show_tabs(GTK_NOTEBOOK(gui.tabline));
+#ifdef HAVE_GTK2
+ /* gtk_notebook_get_show_tabs does not exist in gtk+-1.2.10 */
+ && gtk_notebook_get_show_tabs(GTK_NOTEBOOK(gui.tabline))
+#else
+ && showing_tabline
+#endif
+ ;
}
/*
@@ -4456,7 +4474,9 @@ gui_mch_font_dialog(char_u *oldval)
if (gui.fontname != NULL)
{
- fontname = vim_strsave(gui.fontname);
+ /* Apparently some font names include a comma, need to escape that,
+ * because in 'guifont' it separates names. */
+ fontname = vim_strsave_escaped(gui.fontname, (char_u *)",");
g_free(gui.fontname);
gui.fontname = NULL;
}
@@ -4526,11 +4546,19 @@ gui_mch_font_dialog(char_u *oldval)
GTK_FONT_SELECTION_DIALOG(dialog));
if (name != NULL)
{
+ char_u *p;
+
+ /* Apparently some font names include a comma, need to escape
+ * that, because in 'guifont' it separates names. */
+ p = vim_strsave_escaped((char_u *)name, (char_u *)",");
+ g_free(name);
if (input_conv.vc_type != CONV_NONE)
- fontname = string_convert(&input_conv, (char_u *)name, NULL);
+ {
+ fontname = string_convert(&input_conv, p, NULL);
+ vim_free(p);
+ }
else
- fontname = vim_strsave((char_u *)name);
- g_free(name);
+ fontname = p;
}
}
diff --git a/src/gui_w32.c b/src/gui_w32.c
index 234afe1f3..46ca5468d 100644
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -2025,12 +2025,26 @@ gui_mch_draw_string(
int clen; /* string length up to composing char */
int cells; /* cell width of string up to composing char */
int cw; /* width of current cell */
+ int c;
+ int xtra;
cells = 0;
for (clen = 0; i < len; )
{
- unicodebuf[clen] = utf_ptr2char(text + i);
- cw = utf_char2cells(unicodebuf[clen]);
+ c = utf_ptr2char(text + i);
+ if (c >= 0x10000)
+ {
+ /* Turn into UTF-16 encoding. */
+ unicodebuf[clen] = ((c - 0x10000) >> 10) + 0xD800;
+ unicodebuf[clen + 1] = ((c - 0x10000) & 0x3ff) + 0xDC00;
+ xtra = 1;
+ }
+ else
+ {
+ unicodebuf[clen] = c;
+ xtra = 0;
+ }
+ cw = utf_char2cells(c);
if (cw > 2) /* don't use 4 for unprintable char */
cw = 1;
if (unicodepdy != NULL)
@@ -2039,10 +2053,12 @@ gui_mch_draw_string(
* when the font uses different widths (e.g., bold character
* is wider). */
unicodepdy[clen] = cw * gui.char_width;
+ if (xtra == 1)
+ unicodepdy[clen + 1] = cw * gui.char_width;
}
cells += cw;
i += utfc_ptr2len_len(text + i, len - i);
- ++clen;
+ clen += xtra + 1;
}
ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row),
foptions, pcliprect, unicodebuf, clen, unicodepdy);
diff --git a/src/if_cscope.c b/src/if_cscope.c
index f92196570..aef48d064 100644
--- a/src/if_cscope.c
+++ b/src/if_cscope.c
@@ -22,7 +22,7 @@
# include <sys/wait.h>
#else
/* not UNIX, must be WIN32 */
-# include <io.h>
+# include "vimio.h"
# include <fcntl.h>
# include <process.h>
# define STDIN_FILENO 0
diff --git a/src/if_mzsch.c b/src/if_mzsch.c
index 9eb524a6a..6a34ad34a 100644
--- a/src/if_mzsch.c
+++ b/src/if_mzsch.c
@@ -1249,7 +1249,7 @@ vim_eval(void *data, int argc, Scheme_Object **argv)
expr = SCHEME_STR_VAL(GUARANTEE_STRING(prim->name, 0));
- str = (char *)eval_to_string((char_u *)expr, NULL);
+ str = (char *)eval_to_string((char_u *)expr, NULL, TRUE);
if (str == NULL)
raise_vim_exn(_("invalid expression"));
diff --git a/src/if_ole.cpp b/src/if_ole.cpp
index 544ea16fb..59c786a42 100644
--- a/src/if_ole.cpp
+++ b/src/if_ole.cpp
@@ -368,7 +368,7 @@ CVim::Eval(BSTR expr, BSTR *result)
/* Evaluate the expression */
++emsg_skip;
- str = (char *)eval_to_string((char_u *)buffer, NULL);
+ str = (char *)eval_to_string((char_u *)buffer, NULL, TRUE);
--emsg_skip;
vim_free(buffer);
if (str == NULL)
diff --git a/src/if_perl.xs b/src/if_perl.xs
index 0f1dcd27f..14cb86f2c 100644
--- a/src/if_perl.xs
+++ b/src/if_perl.xs
@@ -427,9 +427,10 @@ msg_split(s, attr)
* work properly.
*/
char_u *
-eval_to_string(arg, nextcmd)
+eval_to_string(arg, nextcmd, dolist)
char_u *arg;
char_u **nextcmd;
+ int dolist;
{
return NULL;
}
@@ -827,7 +828,7 @@ Eval(str)
PREINIT:
char_u *value;
PPCODE:
- value = eval_to_string((char_u *)str, (char_u**)0);
+ value = eval_to_string((char_u *)str, (char_u **)0, TRUE);
if (value == NULL)
{
XPUSHs(sv_2mortal(newSViv(0)));
diff --git a/src/if_ruby.c b/src/if_ruby.c
index bacd6c72b..6e9f95d65 100644
--- a/src/if_ruby.c
+++ b/src/if_ruby.c
@@ -519,7 +519,7 @@ static VALUE vim_command(VALUE self, VALUE str)
static VALUE vim_evaluate(VALUE self, VALUE str)
{
#ifdef FEAT_EVAL
- char_u *value = eval_to_string((char_u *)STR2CSTR(str), NULL);
+ char_u *value = eval_to_string((char_u *)STR2CSTR(str), NULL, TRUE);
if (value)
{
diff --git a/src/if_sniff.c b/src/if_sniff.c
index 1485d5e51..ab7a3f056 100644
--- a/src/if_sniff.c
+++ b/src/if_sniff.c
@@ -12,7 +12,7 @@
#ifdef WIN32
# include <stdio.h>
# include <fcntl.h>
-# include <io.h>
+# include "vimio.h"
# include <process.h>
# include <string.h>
# include <assert.h>
diff --git a/src/if_tcl.c b/src/if_tcl.c
index 30f7d9857..fe43d23ce 100644
--- a/src/if_tcl.c
+++ b/src/if_tcl.c
@@ -1407,7 +1407,7 @@ tclvimexpr(interp, objc, objv, objn)
#ifdef FEAT_EVAL
expr = Tcl_GetStringFromObj(objv[objn], NULL);
- str = (char *)eval_to_string((char_u *)expr, NULL);
+ str = (char *)eval_to_string((char_u *)expr, NULL, TRUE);
if (str == NULL)
Tcl_SetResult(interp, _("invalid expression"), TCL_STATIC);
else
diff --git a/src/main.c b/src/main.c
index 1a16f443c..bd31e50b0 100644
--- a/src/main.c
+++ b/src/main.c
@@ -8,7 +8,7 @@
*/
#if defined(MSDOS) || defined(WIN32) || defined(_WIN64)
-# include <io.h> /* for close() and dup() */
+# include "vimio.h" /* for close() and dup() */
#endif
#define EXTERN
@@ -3602,7 +3602,7 @@ eval_client_expr_to_string(expr)
redir_off = 0;
++emsg_skip;
- res = eval_to_string(expr, NULL);
+ res = eval_to_string(expr, NULL, TRUE);
debug_break_level = save_dbl;
redir_off = save_ro;
diff --git a/src/mbyte.c b/src/mbyte.c
index 062d5842f..4cd7e96fa 100644
--- a/src/mbyte.c
+++ b/src/mbyte.c
@@ -1486,55 +1486,59 @@ utf_composinglike(p1, p2)
#endif
/*
- * Convert a UTF-8 byte string to a wide chararacter. Also get up to two
+ * Convert a UTF-8 byte string to a wide chararacter. Also get up to MAX_MCO
* composing characters.
*/
int
-utfc_ptr2char(p, p1, p2)
+utfc_ptr2char(p, pcc)
char_u *p;
- int *p1; /* return: first composing char or 0 */
- int *p2; /* return: second composing char or 0 */
+ int *pcc; /* return: composing chars, last one is 0 */
{
int len;
int c;
int cc;
+ int i = 0;
c = utf_ptr2char(p);
len = utf_ptr2len(p);
+
/* Only accept a composing char when the first char isn't illegal. */
if ((len > 1 || *p < 0x80)
&& p[len] >= 0x80
&& UTF_COMPOSINGLIKE(p, p + len))
{
- *p1 = utf_ptr2char(p + len);
- len += utf_ptr2len(p + len);
- if (p[len] >= 0x80 && utf_iscomposing(cc = utf_ptr2char(p + len)))
- *p2 = cc;
- else
- *p2 = 0;
- }
- else
- {
- *p1 = 0;
- *p2 = 0;
+ cc = utf_ptr2char(p + len);
+ for (;;)
+ {
+ pcc[i++] = cc;
+ if (i == MAX_MCO)
+ break;
+ len += utf_ptr2len(p + len);
+ if (p[len] < 0x80 || !utf_iscomposing(cc = utf_ptr2char(p + len)))
+ break;
+ }
}
+
+ if (i < MAX_MCO) /* last composing char must be 0 */
+ pcc[i] = 0;
+
return c;
}
/*
- * Convert a UTF-8 byte string to a wide chararacter. Also get up to two
+ * Convert a UTF-8 byte string to a wide chararacter. Also get up to MAX_MCO
* composing characters. Use no more than p[maxlen].
*/
int
-utfc_ptr2char_len(p, p1, p2, maxlen)
+utfc_ptr2char_len(p, pcc, maxlen)
char_u *p;
- int *p1; /* return: first composing char or 0 */
- int *p2; /* return: second composing char or 0 */
+ int *pcc; /* return: composing chars, last one is 0 */
int maxlen;
{
int len;
int c;
int cc;
+ int i = 0;
c = utf_ptr2char(p);
len = utf_ptr2len_len(p, maxlen);
@@ -1544,20 +1548,23 @@ utfc_ptr2char_len(p, p1, p2, maxlen)
&& p[len] >= 0x80
&& UTF_COMPOSINGLIKE(p, p + len))
{
- *p1 = utf_ptr2char(p + len);
- len += utf_ptr2len_len(p + len, maxlen - len);
- if (len < maxlen
- && p[len] >= 0x80
- && utf_iscomposing(cc = utf_ptr2char(p + len)))
- *p2 = cc;
- else
- *p2 = 0;
- }
- else
- {
- *p1 = 0;
- *p2 = 0;
+ cc = utf_ptr2char(p + len);
+ for (;;)
+ {
+ pcc[i++] = cc;
+ if (i == MAX_MCO)
+ break;
+ len += utf_ptr2len_len(p + len, maxlen - len);
+ if (len >= maxlen
+ || p[len] < 0x80
+ || !utf_iscomposing(cc = utf_ptr2char(p + len)))
+ break;
+ }
}
+
+ if (i < MAX_MCO) /* last composing char must be 0 */
+ pcc[i] = 0;
+
return c;
}
@@ -1573,13 +1580,14 @@ utfc_char2bytes(off, buf)
char_u *buf;
{
int len;
+ int i;
len = utf_char2bytes(ScreenLinesUC[off], buf);
- if (ScreenLinesC1[off] != 0)
+ for (i = 0; i < Screen_mco; ++i)
{
- len += utf_char2bytes(ScreenLinesC1[off], buf + len);
- if (ScreenLinesC2[off] != 0)
- len += utf_char2bytes(ScreenLinesC2[off], buf + len);
+ if (ScreenLinesC[i][off] == 0)
+ break;
+ len += utf_char2bytes(ScreenLinesC[i][off], buf + len);
}
return len;
}
diff --git a/src/memfile.c b/src/memfile.c
index bac84fed9..aeeb8cba9 100644
--- a/src/memfile.c
+++ b/src/memfile.c
@@ -33,7 +33,7 @@
*/
#if defined MSDOS || defined(WIN32) || defined(_WIN64)
-# include <io.h> /* for lseek(), must be before vim.h */
+# include "vimio.h" /* for lseek(), must be before vim.h */
#endif
#include "vim.h"
diff --git a/src/memline.c b/src/memline.c
index 451ace35a..b876261b0 100644
--- a/src/memline.c
+++ b/src/memline.c
@@ -43,7 +43,7 @@
*/
#if defined(MSDOS) || defined(WIN32) || defined(_WIN64)
-# include <io.h>
+# include "vimio.h"
#endif
#include "vim.h"
diff --git a/src/message.c b/src/message.c
index 0cba2ccba..c3acc409a 100644
--- a/src/message.c
+++ b/src/message.c
@@ -293,10 +293,12 @@ trunc_string(s, buf, room)
else if (enc_utf8)
{
/* For UTF-8 we can go backwards easily. */
- i = (int)STRLEN(s);
+ half = i = (int)STRLEN(s);
for (;;)
{
- half = i - (*mb_head_off)(s, s + i - 1) - 1;
+ do
+ half = half - (*mb_head_off)(s, s + half - 1) - 1;
+ while (utf_iscomposing(utf_ptr2char(s + half)) && half > 0);
n = ptr2cells(s + half);
if (len + n > room)
break;
@@ -1723,7 +1725,7 @@ msg_puts_long_attr(longstr, attr)
char_u *longstr;
int attr;
{
- msg_puts_long_len_attr(longstr, (int)strlen((char *)longstr), attr);
+ msg_puts_long_len_attr(longstr, (int)STRLEN(longstr), attr);
}
void
diff --git a/src/misc1.c b/src/misc1.c
index c9deb85fe..f95d93d49 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -2177,11 +2177,11 @@ del_bytes(count, fixpos, use_delcombine)
if (p_deco && use_delcombine && enc_utf8
&& utfc_ptr2len(oldp + col) >= count)
{
- int c1, c2;
+ int cc[MAX_MCO];
int n;
- (void)utfc_ptr2char(oldp + col, &c1, &c2);
- if (c1 != NUL)
+ (void)utfc_ptr2char(oldp + col, cc);
+ if (cc[0] != NUL)
{
/* Find the last composing char, there can be several. */
n = col;
@@ -8056,6 +8056,7 @@ fast_breakcheck()
/*
* Expand wildcards. Calls gen_expand_wildcards() and removes files matching
* 'wildignore'.
+ * Returns OK or FAIL.
*/
int
expand_wildcards(num_pat, pat, num_file, file, flags)
@@ -8898,7 +8899,7 @@ expand_backtick(gap, pat, flags)
#ifdef FEAT_EVAL
if (*cmd == '=') /* `={expr}`: Expand expression */
- buffer = eval_to_string(cmd + 1, &p);
+ buffer = eval_to_string(cmd + 1, &p, TRUE);
else
#endif
buffer = get_cmd_output(cmd, NULL,
diff --git a/src/msvcsetup.bat b/src/msvcsetup.bat
new file mode 100644
index 000000000..e57702049
--- /dev/null
+++ b/src/msvcsetup.bat
@@ -0,0 +1,12 @@
+rem To be used on MS-Windows when using the Visual C++ Toolkit 2003
+rem See INSTALLpc.txt for information.
+
+set PATH=%SystemRoot%\Microsoft.NET\Framework\v1.1.4322;%PATH%
+call "%VCToolkitInstallDir%vcvars32.bat"
+set MSVCVer=7.1
+
+rem The platform SDK can be installed elsewhere, adjust the path.
+call "%ProgramFiles%\Microsoft Platform SDK\SetEnv.Cmd"
+rem call "e:\Microsoft Platform SDK\SetEnv.Cmd"
+
+set LIB=%ProgramFiles%\Microsoft Visual Studio .NET 2003\Vc7\lib;%LIB%
diff --git a/src/netbeans.c b/src/netbeans.c
index eb9146bba..c28462493 100644
--- a/src/netbeans.c
+++ b/src/netbeans.c
@@ -26,7 +26,7 @@
# ifdef DEBUG
# include <tchar.h> /* for _T definition for TRACEn macros */
# endif
-# include <io.h>
+# include "vimio.h"
/* WinSock API is separated from C API, thus we can't use read(), write(),
* errno... */
# define sock_errno WSAGetLastError()
diff --git a/src/normal.c b/src/normal.c
index 73812568e..c59b01f27 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -5691,9 +5691,9 @@ nv_right(cap)
|| (PAST_LINE && *ml_get_cursor() == NUL))
{
/*
- * <Space> wraps to next line if 'whichwrap' bit 1 set.
- * 'l' wraps to next line if 'whichwrap' bit 2 set.
- * CURS_RIGHT wraps to next line if 'whichwrap' bit 3 set
+ * <Space> wraps to next line if 'whichwrap' has 's'.
+ * 'l' wraps to next line if 'whichwrap' has 'l'.
+ * CURS_RIGHT wraps to next line if 'whichwrap' has '>'.
*/
if ( ((cap->cmdchar == ' '
&& vim_strchr(p_ww, 's') != NULL)
@@ -5706,8 +5706,7 @@ nv_right(cap)
/* When deleting we also count the NL as a character.
* Set cap->oap->inclusive when last char in the line is
* included, move to next line after that */
- if ( (cap->oap->op_type == OP_DELETE
- || cap->oap->op_type == OP_CHANGE)
+ if ( cap->oap->op_type != OP_NOP
&& !cap->oap->inclusive
&& !lineempty(curwin->w_cursor.lnum))
cap->oap->inclusive = TRUE;
diff --git a/src/ops.c b/src/ops.c
index 9695d9da3..82a759558 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -780,7 +780,7 @@ get_expr_line()
if (expr_copy == NULL)
return NULL;
- rv = eval_to_string(expr_copy, NULL);
+ rv = eval_to_string(expr_copy, NULL, TRUE);
vim_free(expr_copy);
return rv;
}
diff --git a/src/option.c b/src/option.c
index 23b6be81e..5c957e5e9 100644
--- a/src/option.c
+++ b/src/option.c
@@ -414,6 +414,8 @@ struct vimoption
#define P_NFNAME 0x200000L/* only normal file name chars allowed */
#define P_INSECURE 0x400000L/* option was set from a modeline */
+#define ISK_LATIN1 (char_u *)"@,48-57,_,192-255"
+
/*
* options[] is initialized here.
* The order of the options MUST be alphabetic for ":set all" and findoption().
@@ -848,8 +850,7 @@ static struct vimoption
#else
(char_u *)NULL, PV_NONE,
#endif
- {(char_u *)FALSE, (char_u *)0L}
- },
+ {(char_u *)FALSE, (char_u *)0L}},
{"dictionary", "dict", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP,
#ifdef FEAT_INS_EXPAND
(char_u *)&p_dict, PV_DICT,
@@ -1423,7 +1424,7 @@ static struct vimoption
# if defined(MSDOS) || defined(MSWIN) || defined(OS2)
(char_u *)"@,48-57,_,128-167,224-235"
# else
- (char_u *)"@,48-57,_,192-255"
+ ISK_LATIN1
# endif
#endif
}},
@@ -1602,6 +1603,13 @@ static struct vimoption
{"matchtime", "mat", P_NUM|P_VI_DEF,
(char_u *)&p_mat, PV_NONE,
{(char_u *)5L, (char_u *)0L}},
+ {"maxcombine", "mco", P_NUM|P_VI_DEF,
+#ifdef FEAT_MBYTE
+ (char_u *)&p_mco, PV_NONE,
+#else
+ (char_u *)NULL, PV_NONE,
+#endif
+ {(char_u *)2, (char_u *)0L}},
{"maxfuncdepth", "mfd", P_NUM|P_VI_DEF,
#ifdef FEAT_EVAL
(char_u *)&p_mfd, PV_NONE,
@@ -3198,9 +3206,17 @@ set_init_1()
# endif
)
{
- /* Adjust the default for 'isprint' to match latin1. */
+ /* Adjust the default for 'isprint' and 'iskeyword' to match
+ * latin1. Also set the defaults for when 'nocompatible' is
+ * set. */
set_string_option_direct((char_u *)"isp", -1,
(char_u *)"@,161-255", OPT_FREE, SID_NONE);
+ set_string_option_direct((char_u *)"isk", -1,
+ ISK_LATIN1, OPT_FREE, SID_NONE);
+ opt_idx = findoption((char_u *)"isp");
+ options[opt_idx].def_val[VIM_DEFAULT] = (char_u *)"@,161-255";
+ opt_idx = findoption((char_u *)"isk");
+ options[opt_idx].def_val[VIM_DEFAULT] = ISK_LATIN1;
(void)init_chartab();
}
#endif
@@ -7564,6 +7580,18 @@ set_num_option(opt_idx, varp, value, errbuf, errbuflen, opt_flags)
}
#endif /* FEAT_FOLDING */
+#ifdef FEAT_MBYTE
+ /* 'maxcombine' */
+ else if (pp == &p_mco)
+ {
+ if (p_mco > MAX_MCO)
+ p_mco = MAX_MCO;
+ else if (p_mco < 0)
+ p_mco = 0;
+ screenclear(); /* will re-allocate the screen */
+ }
+#endif
+
else if (pp == &curbuf->b_p_iminsert)
{
if (curbuf->b_p_iminsert < 0 || curbuf->b_p_iminsert > B_IMODE_LAST)
diff --git a/src/option.h b/src/option.h
index 1ed2a4fd5..fa5de56e7 100644
--- a/src/option.h
+++ b/src/option.h
@@ -583,6 +583,9 @@ EXTERN char_u *p_mef; /* 'makeef' */
EXTERN char_u *p_mp; /* 'makeprg' */
#endif
EXTERN long p_mat; /* 'matchtime' */
+#ifdef FEAT_MBYTE
+EXTERN long p_mco; /* 'maxcombine' */
+#endif
#ifdef FEAT_EVAL
EXTERN long p_mfd; /* 'maxfuncdepth' */
#endif
diff --git a/src/os_msdos.c b/src/os_msdos.c
index bd18c84a3..4563bf18c 100644
--- a/src/os_msdos.c
+++ b/src/os_msdos.c
@@ -21,7 +21,7 @@
* Some functions are also used for Win16 (MS-Windows 3.1).
*/
-#include <io.h>
+#include "vimio.h"
#include "vim.h"
#include <conio.h>
diff --git a/src/os_mswin.c b/src/os_mswin.c
index 998d27b53..3d8a084ef 100644
--- a/src/os_mswin.c
+++ b/src/os_mswin.c
@@ -22,7 +22,7 @@
# endif
#endif
-#include <io.h>
+#include "vimio.h"
#include "vim.h"
#ifdef HAVE_FCNTL_H
diff --git a/src/os_win16.c b/src/os_win16.c
index b0a4f71ec..e92034cc5 100644
--- a/src/os_win16.c
+++ b/src/os_win16.c
@@ -20,7 +20,7 @@
# pragma warn -obs
#endif
-#include <io.h>
+#include "vimio.h"
#include "vim.h"
#include <fcntl.h>
diff --git a/src/os_win32.c b/src/os_win32.c
index 3aec6ac6a..a45255cae 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -20,7 +20,7 @@
* Roger Knobbe <rogerk@wonderware.com> did the initial port of Vim 3.0.
*/
-#include <io.h>
+#include "vimio.h"
#include "vim.h"
#ifdef FEAT_MZSCHEME
@@ -1926,6 +1926,7 @@ RestoreConsoleBuffer(
return TRUE;
}
+#define FEAT_RESTORE_ORIG_SCREEN
#ifdef FEAT_RESTORE_ORIG_SCREEN
static ConsoleBuffer g_cbOrig = { 0 };
#endif
diff --git a/src/proto/eval.pro b/src/proto/eval.pro
index 31182822a..a0e86850f 100644
--- a/src/proto/eval.pro
+++ b/src/proto/eval.pro
@@ -17,7 +17,7 @@ void eval_patch __ARGS((char_u *origfile, char_u *difffile, char_u *outfile));
int eval_to_bool __ARGS((char_u *arg, int *error, char_u **nextcmd, int skip));
char_u *eval_to_string_skip __ARGS((char_u *arg, char_u **nextcmd, int skip));
int skip_expr __ARGS((char_u **pp));
-char_u *eval_to_string __ARGS((char_u *arg, char_u **nextcmd));
+char_u *eval_to_string __ARGS((char_u *arg, char_u **nextcmd, int dolist));
char_u *eval_to_string_safe __ARGS((char_u *arg, char_u **nextcmd, int use_sandbox));
int eval_to_number __ARGS((char_u *expr));
list_T *eval_spell_expr __ARGS((char_u *badword, char_u *expr));
diff --git a/src/proto/mbyte.pro b/src/proto/mbyte.pro
index 9bff4d3db..e5c9295fa 100644
--- a/src/proto/mbyte.pro
+++ b/src/proto/mbyte.pro
@@ -22,8 +22,8 @@ int mb_cptr2char_adv __ARGS((char_u **pp));
int arabic_combine __ARGS((int one, int two));
int arabic_maycombine __ARGS((int two));
int utf_composinglike __ARGS((char_u *p1, char_u *p2));
-int utfc_ptr2char __ARGS((char_u *p, int *p1, int *p2));
-int utfc_ptr2char_len __ARGS((char_u *p, int *p1, int *p2, int maxlen));
+int utfc_ptr2char __ARGS((char_u *p, int *pcc));
+int utfc_ptr2char_len __ARGS((char_u *p, int *pcc, int maxlen));
int utfc_char2bytes __ARGS((int off, char_u *buf));
int utf_ptr2len __ARGS((char_u *p));
int utf_byte2len __ARGS((int b));
diff --git a/src/proto/spell.pro b/src/proto/spell.pro
index 9fc7a7433..d94b95969 100644
--- a/src/proto/spell.pro
+++ b/src/proto/spell.pro
@@ -16,6 +16,7 @@ void spell_suggest __ARGS((int count));
void ex_spellrepall __ARGS((exarg_T *eap));
void spell_suggest_list __ARGS((garray_T *gap, char_u *word, int maxcount, int need_cap, int interactive));
char_u *eval_soundfold __ARGS((char_u *word));
+void ex_spellinfo __ARGS((exarg_T *eap));
void ex_spelldump __ARGS((exarg_T *eap));
void spell_dump_compl __ARGS((buf_T *buf, char_u *pat, int ic, int *dir, int dumpflags_arg));
char_u *spell_to_word_end __ARGS((char_u *start, buf_T *buf));
diff --git a/src/regexp.c b/src/regexp.c
index df5589c28..a143719c8 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -665,6 +665,9 @@ static char_u *regconcat __ARGS((int *flagp));
static char_u *regpiece __ARGS((int *));
static char_u *regatom __ARGS((int *));
static char_u *regnode __ARGS((int));
+#ifdef FEAT_MBYTE
+static int use_multibytecode __ARGS((int c));
+#endif
static int prog_magic_wrong __ARGS((void));
static char_u *regnext __ARGS((char_u *));
static void regc __ARGS((int b));
@@ -1662,6 +1665,15 @@ regatom(flagp)
p = vim_strchr(classchars, no_Magic(c));
if (p == NULL)
EMSG_RET_NULL(_("E63: invalid use of \\_"));
+#ifdef FEAT_MBYTE
+ /* When '.' is followed by a composing char ignore the dot, so that
+ * the composing char is matched here. */
+ if (enc_utf8 && c == Magic('.') && utf_iscomposing(peekchr()))
+ {
+ c = getchr();
+ goto do_multibyte;
+ }
+#endif
ret = regnode(classcodes[p - classchars] + extra);
*flagp |= HASWIDTH | SIMPLE;
break;
@@ -1921,7 +1933,12 @@ regatom(flagp)
EMSG_M_RET_NULL(
_("E678: Invalid character after %s%%[dxouU]"),
reg_magic == MAGIC_ALL);
- ret = regnode(EXACTLY);
+#ifdef FEAT_MBYTE
+ if (use_multibytecode(i))
+ ret = regnode(MULTIBYTECODE);
+ else
+#endif
+ ret = regnode(EXACTLY);
if (i == 0)
regc(0x0a);
else
@@ -2289,10 +2306,10 @@ collection:
#ifdef FEAT_MBYTE
/* A multi-byte character is handled as a separate atom if it's
- * before a multi. */
- if (has_mbyte && (*mb_char2len)(c) > 1
- && re_multi_type(peekchr()) != NOT_MULTI)
+ * before a multi and when it's a composing char. */
+ if (use_multibytecode(c))
{
+do_multibyte:
ret = regnode(MULTIBYTECODE);
regmbc(c);
*flagp |= HASWIDTH | SIMPLE;
@@ -2323,27 +2340,17 @@ collection:
regmbc(c);
if (enc_utf8)
{
- int off;
int l;
- /* Need to get composing character too, directly
- * access regparse for that, because skipchr() skips
- * over composing chars. */
- ungetchr();
- if (*regparse == '\\' && regparse[1] != NUL)
- off = 1;
- else
- off = 0;
+ /* Need to get composing character too. */
for (;;)
{
- l = utf_ptr2len(regparse + off);
- if (!UTF_COMPOSINGLIKE(regparse + off,
- regparse + off + l))
+ l = utf_ptr2len(regparse);
+ if (!UTF_COMPOSINGLIKE(regparse, regparse + l))
break;
- off += l;
- regmbc(utf_ptr2char(regparse + off));
+ regmbc(utf_ptr2char(regparse));
+ skipchr();
}
- skipchr();
}
}
else
@@ -2364,6 +2371,21 @@ collection:
return ret;
}
+#ifdef FEAT_MBYTE
+/*
+ * Return TRUE if MULTIBYTECODE should be used instead of EXACTLY for
+ * character "c".
+ */
+ static int
+use_multibytecode(c)
+ int c;
+{
+ return has_mbyte && (*mb_char2len)(c) > 1
+ && (re_multi_type(peekchr()) != NOT_MULTI
+ || (enc_utf8 && utf_iscomposing(c)));
+}
+#endif
+
/*
* emit a node
* Return pointer to generated code.
@@ -2747,7 +2769,9 @@ skipchr()
if (regparse[prevchr_len] != NUL)
{
#ifdef FEAT_MBYTE
- if (has_mbyte)
+ if (enc_utf8)
+ prevchr_len += utf_char2len(mb_ptr2char(regparse + prevchr_len));
+ else if (has_mbyte)
prevchr_len += (*mb_ptr2len)(regparse + prevchr_len);
else
#endif
@@ -4229,6 +4253,7 @@ regmatch(scan)
{
int i, len;
char_u *opnd;
+ int opndc, inpc;
opnd = OPERAND(scan);
/* Safety check (just in case 'encoding' was changed since
@@ -4238,12 +4263,37 @@ regmatch(scan)
status = RA_NOMATCH;
break;
}
- for (i = 0; i < len; ++i)
- if (opnd[i] != reginput[i])
+ if (enc_utf8)
+ opndc = mb_ptr2char(opnd);
+ if (enc_utf8 && utf_iscomposing(opndc))
+ {
+ /* When only a composing char is given match at any
+ * position where that composing char appears. */
+ status = RA_NOMATCH;
+ for (i = 0; reginput[i] != NUL; i += utf_char2len(inpc))
{
- status = RA_NOMATCH;
- break;
+ inpc = mb_ptr2char(reginput + i);
+ if (!utf_iscomposing(inpc))
+ {
+ if (i > 0)
+ break;
+ }
+ else if (opndc == inpc)
+ {
+ /* Include all following composing chars. */
+ len = i + mb_ptr2len(reginput + i);
+ status = RA_MATCH;
+ break;
+ }
}
+ }
+ else
+ for (i = 0; i < len; ++i)
+ if (opnd[i] != reginput[i])
+ {
+ status = RA_NOMATCH;
+ break;
+ }
reginput += len;
}
else
@@ -6745,7 +6795,7 @@ vim_regsub_both(source, dest, copy, magic, backslash)
save_ireg_ic = ireg_ic;
can_f_submatch = TRUE;
- eval_result = eval_to_string(source + 2, NULL);
+ eval_result = eval_to_string(source + 2, NULL, TRUE);
if (eval_result != NULL)
{
for (s = eval_result; *s != NUL; mb_ptr_adv(s))
diff --git a/src/screen.c b/src/screen.c
index c53feca31..781c19270 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -27,7 +27,7 @@
* ScreenLinesUC[]. ScreenLines[] contains the first byte only. For an ASCII
* character without composing chars ScreenLinesUC[] will be 0. When the
* character occupies two display cells the next byte in ScreenLines[] is 0.
- * ScreenLinesC1[] and ScreenLinesC2[] contain up to two composing characters
+ * ScreenLinesC[][] contain up to 'maxcombine' composing characters
* (drawn on top of the first character). They are 0 when not used.
* ScreenLines2[] is only used for euc-jp to store the second byte if the
* first byte is 0x8e (single-width character).
@@ -2187,7 +2187,8 @@ fold_line(wp, fold_count, foldinfo, lnum, row)
if (has_mbyte)
{
int cells;
- int u8c, u8c_c1, u8c_c2;
+ int u8c, u8cc[MAX_MCO];
+ int i;
int idx;
int c_len;
char_u *p;
@@ -2217,8 +2218,8 @@ fold_line(wp, fold_count, foldinfo, lnum, row)
ScreenLines[idx] = *p;
if (enc_utf8)
{
- u8c = utfc_ptr2char(p, &u8c_c1, &u8c_c2);
- if (*p < 0x80 && u8c_c1 == 0 && u8c_c2 == 0)
+ u8c = utfc_ptr2char(p, u8cc);
+ if (*p < 0x80 && u8cc[0] == 0)
{
ScreenLinesUC[idx] = 0;
#ifdef FEAT_ARABIC
@@ -2231,7 +2232,8 @@ fold_line(wp, fold_count, foldinfo, lnum, row)
if (p_arshape && !p_tbidi && ARABIC_CHAR(u8c))
{
/* Do Arabic shaping. */
- int pc, pc1, nc, dummy;
+ int pc, pc1, nc;
+ int pcc[MAX_MCO];
int firstbyte = *p;
/* The idea of what is the previous and next
@@ -2241,16 +2243,17 @@ fold_line(wp, fold_count, foldinfo, lnum, row)
pc = prev_c;
pc1 = prev_c1;
nc = utf_ptr2char(p + c_len);
- prev_c1 = u8c_c1;
+ prev_c1 = u8cc[0];
}
else
{
- pc = utfc_ptr2char(p + c_len, &pc1, &dummy);
+ pc = utfc_ptr2char(p + c_len, pcc);
nc = prev_c;
+ pc1 = pcc[0];
}
prev_c = u8c;
- u8c = arabic_shape(u8c, &firstbyte, &u8c_c1,
+ u8c = arabic_shape(u8c, &firstbyte, &u8cc[0],
pc, pc1, nc);
ScreenLines[idx] = firstbyte;
}
@@ -2262,8 +2265,12 @@ fold_line(wp, fold_count, foldinfo, lnum, row)
ScreenLinesUC[idx] = (cells == 2) ? 0xff1f : (int)'?';
else
ScreenLinesUC[idx] = u8c;
- ScreenLinesC1[idx] = u8c_c1;
- ScreenLinesC2[idx] = u8c_c2;
+ for (i = 0; i < Screen_mco; ++i)
+ {
+ ScreenLinesC[i][idx] = u8cc[i];
+ if (u8cc[i] == 0)
+ break;
+ }
}
if (cells > 1)
ScreenLines[idx + 1] = 0;
@@ -2315,8 +2322,7 @@ fold_line(wp, fold_count, foldinfo, lnum, row)
if (fill_fold >= 0x80)
{
ScreenLinesUC[off + col] = fill_fold;
- ScreenLinesC1[off + col] = 0;
- ScreenLinesC2[off + col] = 0;
+ ScreenLinesC[0][off + col] = 0;
}
else
ScreenLinesUC[off + col] = 0;
@@ -2561,8 +2567,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
int mb_l = 1; /* multi-byte byte length */
int mb_c = 0; /* decoded multi-byte character */
int mb_utf8 = FALSE; /* screen char is UTF-8 char */
- int u8c_c1 = 0; /* first composing UTF-8 char */
- int u8c_c2 = 0; /* second composing UTF-8 char */
+ int u8cc[MAX_MCO]; /* composing UTF-8 chars */
#endif
#ifdef FEAT_DIFF
int filler_lines; /* nr of filler lines to be drawn */
@@ -2581,6 +2586,8 @@ win_line(wp, lnum, startrow, endrow, nochange)
#endif
#ifdef FEAT_SEARCH_EXTRA
match_T *shl; /* points to search_hl or match_hl */
+#endif
+#if defined(FEAT_SEARCH_EXTRA) || defined(FEAT_MBYTE)
int i;
#endif
#ifdef FEAT_ARABIC
@@ -3433,7 +3440,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
if (enc_utf8 && (*mb_char2len)(c) > 1)
{
mb_utf8 = TRUE;
- u8c_c1 = u8c_c2 = 0;
+ u8cc[0] = 0;
}
else
mb_utf8 = FALSE;
@@ -3456,7 +3463,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
mb_l = 1;
else if (mb_l > 1)
{
- mb_c = utfc_ptr2char(p_extra, &u8c_c1, &u8c_c2);
+ mb_c = utfc_ptr2char(p_extra, u8cc);
mb_utf8 = TRUE;
}
}
@@ -3520,7 +3527,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
mb_utf8 = FALSE;
if (mb_l > 1)
{
- mb_c = utfc_ptr2char(ptr, &u8c_c1, &u8c_c2);
+ mb_c = utfc_ptr2char(ptr, u8cc);
/* Overlong encoded ASCII or ASCII with composing char
* is displayed normally, except a NUL. */
if (mb_c < 0x80)
@@ -3531,8 +3538,9 @@ win_line(wp, lnum, startrow, endrow, nochange)
* Draw it as a space with a composing char. */
if (utf_iscomposing(mb_c))
{
- u8c_c2 = u8c_c1;
- u8c_c1 = mb_c;
+ for (i = Screen_mco - 1; i > 0; --i)
+ u8cc[i] = u8cc[i - 1];
+ u8cc[0] = mb_c;
mb_c = ' ';
}
}
@@ -3549,10 +3557,10 @@ win_line(wp, lnum, startrow, endrow, nochange)
if (mb_c < 0x10000)
{
transchar_hex(extra, mb_c);
-#ifdef FEAT_RIGHTLEFT
+# ifdef FEAT_RIGHTLEFT
if (wp->w_p_rl) /* reverse */
rl_mirror(extra);
-#endif
+# endif
}
else if (utf_char2cells(mb_c) != 2)
STRCPY(extra, "?");
@@ -3579,7 +3587,8 @@ win_line(wp, lnum, startrow, endrow, nochange)
else if (p_arshape && !p_tbidi && ARABIC_CHAR(mb_c))
{
/* Do Arabic shaping. */
- int pc, pc1, nc, dummy;
+ int pc, pc1, nc;
+ int pcc[MAX_MCO];
/* The idea of what is the previous and next
* character depends on 'rightleft'. */
@@ -3588,16 +3597,17 @@ win_line(wp, lnum, startrow, endrow, nochange)
pc = prev_c;
pc1 = prev_c1;
nc = utf_ptr2char(ptr + mb_l);
- prev_c1 = u8c_c1;
+ prev_c1 = u8cc[0];
}
else
{
- pc = utfc_ptr2char(ptr + mb_l, &pc1, &dummy);
+ pc = utfc_ptr2char(ptr + mb_l, pcc);
nc = prev_c;
+ pc1 = pcc[0];
}
prev_c = mb_c;
- mb_c = arabic_shape(mb_c, &c, &u8c_c1, pc, pc1, nc);
+ mb_c = arabic_shape(mb_c, &c, &u8cc[0], pc, pc1, nc);
}
else
prev_c = mb_c;
@@ -3704,7 +3714,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
if (enc_utf8 && (*mb_char2len)(c) > 1)
{
mb_utf8 = TRUE;
- u8c_c1 = u8c_c2 = 0;
+ u8cc[0] = 0;
}
else
mb_utf8 = FALSE;
@@ -3866,7 +3876,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
if (enc_utf8 && (*mb_char2len)(c) > 1)
{
mb_utf8 = TRUE;
- u8c_c1 = u8c_c2 = 0;
+ u8cc[0] = 0;
}
else
mb_utf8 = FALSE;
@@ -3904,7 +3914,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
if (enc_utf8 && (*mb_char2len)(c) > 1)
{
mb_utf8 = TRUE;
- u8c_c1 = u8c_c2 = 0;
+ u8cc[0] = 0;
}
#endif
}
@@ -3978,7 +3988,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
if (enc_utf8 && (*mb_char2len)(c) > 1)
{
mb_utf8 = TRUE;
- u8c_c1 = u8c_c2 = 0;
+ u8cc[0] = 0;
}
else
mb_utf8 = FALSE; /* don't draw as UTF-8 */
@@ -4117,7 +4127,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
if (enc_utf8 && (*mb_char2len)(c) > 1)
{
mb_utf8 = TRUE;
- u8c_c1 = u8c_c2 = 0;
+ u8cc[0] = 0;
}
else
mb_utf8 = FALSE; /* don't draw as UTF-8 */
@@ -4247,7 +4257,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
if (enc_utf8 && (*mb_char2len)(c) > 1)
{
mb_utf8 = TRUE;
- u8c_c1 = u8c_c2 = 0;
+ u8cc[0] = 0;
}
else
mb_utf8 = FALSE;
@@ -4281,8 +4291,12 @@ win_line(wp, lnum, startrow, endrow, nochange)
if (mb_utf8)
{
ScreenLinesUC[off] = mb_c;
- ScreenLinesC1[off] = u8c_c1;
- ScreenLinesC2[off] = u8c_c2;
+ for (i = 0; i < Screen_mco; ++i)
+ {
+ ScreenLinesC[i][off] = u8cc[i];
+ if (u8cc[i] == 0)
+ break;
+ }
}
else
ScreenLinesUC[off] = 0;
@@ -4512,6 +4526,30 @@ win_line(wp, lnum, startrow, endrow, nochange)
return row;
}
+#ifdef FEAT_MBYTE
+static int comp_char_differs __ARGS((int, int));
+
+/*
+ * Return if the composing characters at "off_from" and "off_to" differ.
+ */
+ static int
+comp_char_differs(off_from, off_to)
+ int off_from;
+ int off_to;
+{
+ int i;
+
+ for (i = 0; i < Screen_mco; ++i)
+ {
+ if (ScreenLinesC[i][off_from] != ScreenLinesC[i][off_to])
+ return TRUE;
+ if (ScreenLinesC[i][off_from] == 0)
+ break;
+ }
+ return FALSE;
+}
+#endif
+
/*
* Check whether the given character needs redrawing:
* - the (first byte of the) character is different
@@ -4538,10 +4576,7 @@ char_needs_redraw(off_from, off_to, cols)
|| (enc_utf8
&& (ScreenLinesUC[off_from] != ScreenLinesUC[off_to]
|| (ScreenLinesUC[off_from] != 0
- && (ScreenLinesC1[off_from]
- != ScreenLinesC1[off_to]
- || ScreenLinesC2[off_from]
- != ScreenLinesC2[off_to]))))
+ && comp_char_differs(off_from, off_to))))
#endif
))
return TRUE;
@@ -4753,8 +4788,10 @@ screen_line(row, coloff, endcol, clear_width
ScreenLinesUC[off_to] = ScreenLinesUC[off_from];
if (ScreenLinesUC[off_from] != 0)
{
- ScreenLinesC1[off_to] = ScreenLinesC1[off_from];
- ScreenLinesC2[off_to] = ScreenLinesC2[off_from];
+ int i;
+
+ for (i = 0; i < Screen_mco; ++i)
+ ScreenLinesC[i][off_to] = ScreenLinesC[i][off_from];
}
}
if (char_cells == 2)
@@ -4892,8 +4929,8 @@ screen_line(row, coloff, endcol, clear_width
c = fillchar_vsep(&hl);
if (ScreenLines[off_to] != c
# ifdef FEAT_MBYTE
- || (enc_utf8
- && ScreenLinesUC[off_to] != (c >= 0x80 ? c : 0))
+ || (enc_utf8 && (int)ScreenLinesUC[off_to]
+ != (c >= 0x80 ? c : 0))
# endif
|| ScreenAttrs[off_to] != hl)
{
@@ -4905,8 +4942,7 @@ screen_line(row, coloff, endcol, clear_width
if (c >= 0x80)
{
ScreenLinesUC[off_to] = c;
- ScreenLinesC1[off_to] = 0;
- ScreenLinesC2[off_to] = 0;
+ ScreenLinesC[0][off_to] = 0;
}
else
ScreenLinesUC[off_to] = 0;
@@ -5553,7 +5589,7 @@ get_keymap_str(wp, buf, len)
curwin = wp;
STRCPY(buf, "b:keymap_name"); /* must be writable */
++emsg_skip;
- s = p = eval_to_string(buf, NULL);
+ s = p = eval_to_string(buf, NULL, FALSE);
--emsg_skip;
curbuf = old_curbuf;
curwin = old_curwin;
@@ -5805,6 +5841,31 @@ screen_getbytes(row, col, bytes, attrp)
}
}
+#ifdef FEAT_MBYTE
+static int screen_comp_differs __ARGS((int, int*));
+
+/*
+ * Return TRUE if composing characters for screen posn "off" differs from
+ * composing characters in "u8cc".
+ */
+ static int
+screen_comp_differs(off, u8cc)
+ int off;
+ int *u8cc;
+{
+ int i;
+
+ for (i = 0; i < Screen_mco; ++i)
+ {
+ if (ScreenLinesC[i][off] != (u8char_T)u8cc[i])
+ return TRUE;
+ if (u8cc[i] == 0)
+ break;
+ }
+ return FALSE;
+}
+#endif
+
/*
* Put string '*text' on the screen at position 'row' and 'col', with
* attributes 'attr', and update ScreenLines[] and ScreenAttrs[].
@@ -5840,12 +5901,12 @@ screen_puts_len(text, len, row, col, attr)
int mbyte_blen = 1;
int mbyte_cells = 1;
int u8c = 0;
- int u8c_c1 = 0;
- int u8c_c2 = 0;
+ int u8cc[MAX_MCO];
int clear_next_cell = FALSE;
# ifdef FEAT_ARABIC
int prev_c = 0; /* previous Arabic character */
- int pc, nc, nc1, dummy;
+ int pc, nc, nc1;
+ int pcc[MAX_MCO];
# endif
#endif
@@ -5872,10 +5933,10 @@ screen_puts_len(text, len, row, col, attr)
else /* enc_utf8 */
{
if (len >= 0)
- u8c = utfc_ptr2char_len(ptr, &u8c_c1, &u8c_c2,
+ u8c = utfc_ptr2char_len(ptr, u8cc,
(int)((text + len) - ptr));
else
- u8c = utfc_ptr2char(ptr, &u8c_c1, &u8c_c2);
+ u8c = utfc_ptr2char(ptr, u8cc);
mbyte_cells = utf_char2cells(u8c);
/* Non-BMP character: display as ? or fullwidth ?. */
if (u8c >= 0x10000)
@@ -5895,10 +5956,13 @@ screen_puts_len(text, len, row, col, attr)
nc1 = NUL;
}
else
- nc = utfc_ptr2char(ptr + mbyte_blen, &nc1, &dummy);
+ {
+ nc = utfc_ptr2char(ptr + mbyte_blen, pcc);
+ nc1 = pcc[0];
+ }
pc = prev_c;
prev_c = u8c;
- u8c = arabic_shape(u8c, &c, &u8c_c1, nc, nc1, pc);
+ u8c = arabic_shape(u8c, &c, &u8cc[0], nc, nc1, pc);
}
else
prev_c = u8c;
@@ -5915,10 +5979,8 @@ screen_puts_len(text, len, row, col, attr)
&& c == 0x8e
&& ScreenLines2[off] != ptr[1])
|| (enc_utf8
- && mbyte_blen > 1
- && (ScreenLinesUC[off] != u8c
- || ScreenLinesC1[off] != u8c_c1
- || ScreenLinesC2[off] != u8c_c2))
+ && (ScreenLinesUC[off] != (u8char_T)u8c
+ || screen_comp_differs(off, u8cc)))
#endif
|| ScreenAttrs[off] != attr
|| exmode_active
@@ -5994,13 +6056,19 @@ screen_puts_len(text, len, row, col, attr)
#ifdef FEAT_MBYTE
if (enc_utf8)
{
- if (c < 0x80 && u8c_c1 == 0 && u8c_c2 == 0)
+ if (c < 0x80 && u8cc[0] == 0)
ScreenLinesUC[off] = 0;
else
{
+ int i;
+
ScreenLinesUC[off] = u8c;
- ScreenLinesC1[off] = u8c_c1;
- ScreenLinesC2[off] = u8c_c2;
+ for (i = 0; i < Screen_mco; ++i)
+ {
+ ScreenLinesC[i][off] = u8cc[i];
+ if (u8cc[i] == 0)
+ break;
+ }
}
if (mbyte_cells == 2)
{
@@ -6715,7 +6783,8 @@ screen_fill(start_row, end_row, start_col, end_col, c1, c2, attr)
{
if (ScreenLines[off] != c
#ifdef FEAT_MBYTE
- || (enc_utf8 && ScreenLinesUC[off] != (c >= 0x80 ? c : 0))
+ || (enc_utf8 && (int)ScreenLinesUC[off]
+ != (c >= 0x80 ? c : 0))
#endif
|| ScreenAttrs[off] != attr
#if defined(FEAT_GUI) || defined(UNIX)
@@ -6755,8 +6824,7 @@ screen_fill(start_row, end_row, start_col, end_col, c1, c2, attr)
if (c >= 0x80)
{
ScreenLinesUC[off] = c;
- ScreenLinesC1[off] = 0;
- ScreenLinesC2[off] = 0;
+ ScreenLinesC[0][off] = 0;
}
else
ScreenLinesUC[off] = 0;
@@ -6845,9 +6913,9 @@ screenalloc(clear)
schar_T *new_ScreenLines;
#ifdef FEAT_MBYTE
u8char_T *new_ScreenLinesUC = NULL;
- u8char_T *new_ScreenLinesC1 = NULL;
- u8char_T *new_ScreenLinesC2 = NULL;
+ u8char_T *new_ScreenLinesC[MAX_MCO];
schar_T *new_ScreenLines2 = NULL;
+ int i;
#endif
sattr_T *new_ScreenAttrs;
unsigned *new_LineOffset;
@@ -6870,6 +6938,7 @@ screenalloc(clear)
#ifdef FEAT_MBYTE
&& enc_utf8 == (ScreenLinesUC != NULL)
&& (enc_dbcs == DBCS_JPNU) == (ScreenLines2 != NULL)
+ && p_mco == Screen_mco
#endif
)
|| Rows == 0
@@ -6907,13 +6976,13 @@ screenalloc(clear)
new_ScreenLines = (schar_T *)lalloc((long_u)(
(Rows + 1) * Columns * sizeof(schar_T)), FALSE);
#ifdef FEAT_MBYTE
+ vim_memset(new_ScreenLinesC, 0, sizeof(u8char_T) * MAX_MCO);
if (enc_utf8)
{
new_ScreenLinesUC = (u8char_T *)lalloc((long_u)(
(Rows + 1) * Columns * sizeof(u8char_T)), FALSE);
- new_ScreenLinesC1 = (u8char_T *)lalloc((long_u)(
- (Rows + 1) * Columns * sizeof(u8char_T)), FALSE);
- new_ScreenLinesC2 = (u8char_T *)lalloc((long_u)(
+ for (i = 0; i < p_mco; ++i)
+ new_ScreenLinesC[i] = (u8char_T *)lalloc((long_u)(
(Rows + 1) * Columns * sizeof(u8char_T)), FALSE);
}
if (enc_dbcs == DBCS_JPNU)
@@ -6940,10 +7009,14 @@ screenalloc(clear)
}
}
+#ifdef FEAT_MBYTE
+ for (i = 0; i < p_mco; ++i)
+ if (new_ScreenLinesC[i] == NULL)
+ break;
+#endif
if (new_ScreenLines == NULL
#ifdef FEAT_MBYTE
- || (enc_utf8 && (new_ScreenLinesUC == NULL
- || new_ScreenLinesC1 == NULL || new_ScreenLinesC2 == NULL))
+ || (enc_utf8 && (new_ScreenLinesUC == NULL || i != p_mco))
|| (enc_dbcs == DBCS_JPNU && new_ScreenLines2 == NULL)
#endif
|| new_ScreenAttrs == NULL
@@ -6968,10 +7041,11 @@ screenalloc(clear)
#ifdef FEAT_MBYTE
vim_free(new_ScreenLinesUC);
new_ScreenLinesUC = NULL;
- vim_free(new_ScreenLinesC1);
- new_ScreenLinesC1 = NULL;
- vim_free(new_ScreenLinesC2);
- new_ScreenLinesC2 = NULL;
+ for (i = 0; i < p_mco; ++i)
+ {
+ vim_free(new_ScreenLinesC[i]);
+ new_ScreenLinesC[i] = NULL;
+ }
vim_free(new_ScreenLines2);
new_ScreenLines2 = NULL;
#endif
@@ -7010,9 +7084,9 @@ screenalloc(clear)
{
(void)vim_memset(new_ScreenLinesUC + new_row * Columns,
0, (size_t)Columns * sizeof(u8char_T));
- (void)vim_memset(new_ScreenLinesC1 + new_row * Columns,
- 0, (size_t)Columns * sizeof(u8char_T));
- (void)vim_memset(new_ScreenLinesC2 + new_row * Columns,
+ for (i = 0; i < p_mco; ++i)
+ (void)vim_memset(new_ScreenLinesC[i]
+ + new_row * Columns,
0, (size_t)Columns * sizeof(u8char_T));
}
if (enc_dbcs == DBCS_JPNU)
@@ -7030,23 +7104,24 @@ screenalloc(clear)
len = Columns;
#ifdef FEAT_MBYTE
/* When switching to utf-8 don't copy characters, they
- * may be invalid now. */
- if (!(enc_utf8 && ScreenLinesUC == NULL))
+ * may be invalid now. Also when p_mco changes. */
+ if (!(enc_utf8 && ScreenLinesUC == NULL)
+ && p_mco == Screen_mco)
#endif
mch_memmove(new_ScreenLines + new_LineOffset[new_row],
ScreenLines + LineOffset[old_row],
(size_t)len * sizeof(schar_T));
#ifdef FEAT_MBYTE
- if (enc_utf8 && ScreenLinesUC != NULL)
+ if (enc_utf8 && ScreenLinesUC != NULL
+ && p_mco == Screen_mco)
{
mch_memmove(new_ScreenLinesUC + new_LineOffset[new_row],
ScreenLinesUC + LineOffset[old_row],
(size_t)len * sizeof(u8char_T));
- mch_memmove(new_ScreenLinesC1 + new_LineOffset[new_row],
- ScreenLinesC1 + LineOffset[old_row],
- (size_t)len * sizeof(u8char_T));
- mch_memmove(new_ScreenLinesC2 + new_LineOffset[new_row],
- ScreenLinesC2 + LineOffset[old_row],
+ for (i = 0; i < p_mco; ++i)
+ mch_memmove(new_ScreenLinesC[i]
+ + new_LineOffset[new_row],
+ ScreenLinesC[i] + LineOffset[old_row],
(size_t)len * sizeof(u8char_T));
}
if (enc_dbcs == DBCS_JPNU && ScreenLines2 != NULL)
@@ -7069,8 +7144,9 @@ screenalloc(clear)
ScreenLines = new_ScreenLines;
#ifdef FEAT_MBYTE
ScreenLinesUC = new_ScreenLinesUC;
- ScreenLinesC1 = new_ScreenLinesC1;
- ScreenLinesC2 = new_ScreenLinesC2;
+ for (i = 0; i < p_mco; ++i)
+ ScreenLinesC[i] = new_ScreenLinesC[i];
+ Screen_mco = p_mco;
ScreenLines2 = new_ScreenLines2;
#endif
ScreenAttrs = new_ScreenAttrs;
@@ -7118,13 +7194,15 @@ screenalloc(clear)
void
free_screenlines()
{
- vim_free(ScreenLines);
#ifdef FEAT_MBYTE
+ int i;
+
vim_free(ScreenLinesUC);
- vim_free(ScreenLinesC1);
- vim_free(ScreenLinesC2);
+ for (i = 0; i < Screen_mco; ++i)
+ vim_free(ScreenLinesC[i]);
vim_free(ScreenLines2);
#endif
+ vim_free(ScreenLines);
vim_free(ScreenAttrs);
vim_free(LineOffset);
vim_free(LineWraps);
@@ -7250,12 +7328,13 @@ linecopy(to, from, wp)
# ifdef FEAT_MBYTE
if (enc_utf8)
{
+ int i;
+
mch_memmove(ScreenLinesUC + off_to, ScreenLinesUC + off_from,
wp->w_width * sizeof(u8char_T));
- mch_memmove(ScreenLinesC1 + off_to, ScreenLinesC1 + off_from,
- wp->w_width * sizeof(u8char_T));
- mch_memmove(ScreenLinesC2 + off_to, ScreenLinesC2 + off_from,
- wp->w_width * sizeof(u8char_T));
+ for (i = 0; i < p_mco; ++i)
+ mch_memmove(ScreenLinesC[i] + off_to, ScreenLinesC[i] + off_from,
+ wp->w_width * sizeof(u8char_T));
}
if (enc_dbcs == DBCS_JPNU)
mch_memmove(ScreenLines2 + off_to, ScreenLines2 + off_from,
diff --git a/src/spell.c b/src/spell.c
index ba8e66a2f..fe46006c6 100644
--- a/src/spell.c
+++ b/src/spell.c
@@ -117,6 +117,10 @@
* <sectionend> 1 byte SN_END
*
*
+ * sectionID == SN_INFO: <infotext>
+ * <infotext> N bytes free format text with spell file info (version,
+ * website, etc)
+ *
* sectionID == SN_REGION: <regionname> ...
* <regionname> 2 bytes Up to 8 region names: ca, au, etc. Lower case.
* First <regionname> is region 1.
@@ -185,7 +189,7 @@
* <compmax> 1 byte Maximum nr of words in compound word.
* <compminlen> 1 byte Minimal word length for compounding.
* <compsylmax> 1 byte Maximum nr of syllables in compound word.
- * <compflags> N bytes Flags from COMPOUNDFLAGS items, separated by
+ * <compflags> N bytes Flags from COMPOUNDRULE items, separated by
* slashes.
*
* sectionID == SN_NOBREAK: (empty, its presence is enough)
@@ -290,7 +294,7 @@
*/
#if defined(MSDOS) || defined(WIN16) || defined(WIN32) || defined(_WIN64)
-# include <io.h> /* for lseek(), must be before vim.h */
+# include "vimio.h" /* for lseek(), must be before vim.h */
#endif
#include "vim.h"
@@ -431,6 +435,8 @@ struct slang_S
char_u *sl_pbyts; /* prefix tree word bytes */
idx_T *sl_pidxs; /* prefix tree word indexes */
+ char_u *sl_info; /* infotext string or NULL */
+
char_u sl_regions[17]; /* table with up to 8 region names plus NUL */
char_u *sl_midword; /* MIDWORD string or NULL */
@@ -440,7 +446,7 @@ struct slang_S
int sl_compmax; /* COMPOUNDMAX (default: MAXWLEN) */
int sl_compminlen; /* COMPOUNDMIN (default: 0) */
int sl_compsylmax; /* COMPOUNDSYLMAX (default: MAXWLEN) */
- regprog_T *sl_compprog; /* COMPOUNDFLAGS turned into a regexp progrm
+ regprog_T *sl_compprog; /* COMPOUNDRULE turned into a regexp progrm
* (NULL when no compounding) */
char_u *sl_compstartflags; /* flags for first compound word */
char_u *sl_compallflags; /* all flags for compound words */
@@ -534,6 +540,7 @@ typedef struct langp_S
#define SN_REPSAL 12 /* REPSAL items section */
#define SN_WORDS 13 /* common words */
#define SN_NOSPLITSUGS 14 /* don't split word for suggestions */
+#define SN_INFO 15 /* info section */
#define SN_END 255 /* end of sections */
#define SNF_REQUIRED 1 /* <sectionflags>: required section */
@@ -1520,7 +1527,7 @@ find_word(mip, mode)
}
/* If the word ends the sequence of compound flags of the
- * words must match with one of the COMPOUNDFLAGS items and
+ * words must match with one of the COMPOUNDRULE items and
* the number of syllables must not be too large. */
mip->mi_compflags[mip->mi_complen] = ((unsigned)flags >> 24);
mip->mi_compflags[mip->mi_complen + 1] = NUL;
@@ -2284,6 +2291,9 @@ spell_load_lang(lang)
break;
#endif
}
+#ifdef FEAT_AUTOCMD
+ break;
+#endif
}
if (r == FAIL)
@@ -2434,6 +2444,9 @@ slang_clear(lp)
vim_free(lp->sl_prefprog);
lp->sl_prefprog = NULL;
+ vim_free(lp->sl_info);
+ lp->sl_info = NULL;
+
vim_free(lp->sl_midword);
lp->sl_midword = NULL;
@@ -2620,6 +2633,12 @@ spell_load_file(fname, lang, old_lp, silent)
res = 0;
switch (n)
{
+ case SN_INFO:
+ lp->sl_info = read_string(fd, len); /* <infotext> */
+ if (lp->sl_info == NULL)
+ goto endFAIL;
+ break;
+
case SN_REGION:
res = read_region_section(fd, lp, len);
break;
@@ -3386,7 +3405,7 @@ read_compound(fd, slang, len)
c = MAXWLEN;
slang->sl_compsylmax = c;
- /* Turn the COMPOUNDFLAGS items into a regexp pattern:
+ /* Turn the COMPOUNDRULE items into a regexp pattern:
* "a[bc]/a*b+" -> "^\(a[bc]\|a*b\+\)$".
* Inserting backslashes may double the length, "^\(\)$<Nul>" is 7 bytes.
* Conversion to utf-8 may double the size. */
@@ -4711,6 +4730,7 @@ typedef struct spellinfo_S
int si_memtot; /* runtime memory used */
int si_verbose; /* verbose messages */
int si_msg_count; /* number of words added since last message */
+ char_u *si_info; /* info text chars or NULL */
int si_region_count; /* number of regions supported (1 when there
are no regions) */
char_u si_region_name[16]; /* region names; used only if
@@ -4743,6 +4763,7 @@ typedef struct spellinfo_S
} spellinfo_T;
static afffile_T *spell_read_aff __ARGS((spellinfo_T *spin, char_u *fname));
+static int spell_info_item __ARGS((char_u *s));
static unsigned affitem2flag __ARGS((int flagtype, char_u *item, char_u *fname, int lnum));
static unsigned get_affitem __ARGS((int flagtype, char_u **pp));
static void process_compflags __ARGS((spellinfo_T *spin, afffile_T *aff, char_u *compflags));
@@ -4936,7 +4957,7 @@ spell_read_aff(spin, fname)
int compminlen = 0; /* COMPOUNDMIN value */
int compsylmax = 0; /* COMPOUNDSYLMAX value */
int compmax = 0; /* COMPOUNDMAX value */
- char_u *compflags = NULL; /* COMPOUNDFLAG and COMPOUNDFLAGS
+ char_u *compflags = NULL; /* COMPOUNDFLAG and COMPOUNDRULE
concatenated */
char_u *midword = NULL; /* MIDWORD value */
char_u *syllable = NULL; /* SYLLABLE value */
@@ -5023,8 +5044,13 @@ spell_read_aff(spin, fname)
if (itemcnt == MAXITEMCNT) /* too many items */
break;
items[itemcnt++] = p;
- while (*p > ' ') /* skip until white space or CR/NL */
- ++p;
+ /* A few items have arbitrary text argument, don't split them. */
+ if (itemcnt == 2 && spell_info_item(items[0]))
+ while (*p >= ' ' || *p == TAB) /* skip until CR/NL */
+ ++p;
+ else
+ while (*p > ' ') /* skip until white space or CR/NL */
+ ++p;
if (*p == NUL)
break;
*p++ = NUL;
@@ -5073,6 +5099,25 @@ spell_read_aff(spin, fname)
smsg((char_u *)_("FLAG after using flags in %s line %d: %s"),
fname, lnum, items[1]);
}
+ else if (spell_info_item(items[0]))
+ {
+ p = (char_u *)getroom(spin,
+ (spin->si_info == NULL ? 0 : STRLEN(spin->si_info))
+ + STRLEN(items[0])
+ + STRLEN(items[1]) + 3, FALSE);
+ if (p != NULL)
+ {
+ if (spin->si_info != NULL)
+ {
+ STRCPY(p, spin->si_info);
+ STRCAT(p, "\n");
+ }
+ STRCAT(p, items[0]);
+ STRCAT(p, " ");
+ STRCAT(p, items[1]);
+ spin->si_info = p;
+ }
+ }
else if (STRCMP(items[0], "MIDWORD") == 0 && itemcnt == 2
&& midword == NULL)
{
@@ -5125,7 +5170,7 @@ spell_read_aff(spin, fname)
else if (STRCMP(items[0], "COMPOUNDFLAG") == 0 && itemcnt == 2
&& compflags == NULL)
{
- /* Turn flag "c" into COMPOUNDFLAGS compatible string "c+",
+ /* Turn flag "c" into COMPOUNDRULE compatible string "c+",
* "Na" into "Na+", "1234" into "1234+". */
p = getroom(spin, STRLEN(items[1]) + 2, FALSE);
if (p != NULL)
@@ -5135,7 +5180,7 @@ spell_read_aff(spin, fname)
compflags = p;
}
}
- else if (STRCMP(items[0], "COMPOUNDFLAGS") == 0 && itemcnt == 2)
+ else if (STRCMP(items[0], "COMPOUNDRULE") == 0 && itemcnt == 2)
{
/* Concatenate this string to previously defined ones, using a
* slash to separate them. */
@@ -5726,6 +5771,21 @@ spell_read_aff(spin, fname)
}
/*
+ * Return TRUE if "s" is the name of an info item in the affix file.
+ */
+ static int
+spell_info_item(s)
+ char_u *s;
+{
+ return STRCMP(s, "NAME") == 0
+ || STRCMP(s, "HOME") == 0
+ || STRCMP(s, "VERSION") == 0
+ || STRCMP(s, "AUTHOR") == 0
+ || STRCMP(s, "EMAIL") == 0
+ || STRCMP(s, "COPYRIGHT") == 0;
+}
+
+/*
* Turn an affix flag name into a number, according to the FLAG type.
* returns zero for failure.
*/
@@ -7366,6 +7426,14 @@ put_bytes(fd, nr, len)
putc((int)(nr >> (i * 8)), fd);
}
+#ifdef _MSC_VER
+# if (_MSC_VER <= 1200)
+/* This line is required for VC6 without the service pack. Also see the
+ * matching #pragma below. */
+/* # pragma optimize("", off) */
+# endif
+#endif
+
/*
* Write spin->si_sugtime to file "fd".
*/
@@ -7390,6 +7458,12 @@ put_sugtime(spin, fd)
}
}
+#ifdef _MSC_VER
+# if (_MSC_VER <= 1200)
+/* # pragma optimize("", on) */
+# endif
+#endif
+
static int
#ifdef __BORLANDC__
_RTLENTRYF
@@ -7455,6 +7529,17 @@ write_vim_spell(spin, fname)
* <SECTIONS>: <section> ... <sectionend>
*/
+ /* SN_INFO: <infotext> */
+ if (spin->si_info != NULL)
+ {
+ putc(SN_INFO, fd); /* <sectionID> */
+ putc(0, fd); /* <sectionflags> */
+
+ i = STRLEN(spin->si_info);
+ put_bytes(fd, (long_u)i, 4); /* <sectionlen> */
+ fwrite(spin->si_info, (size_t)i, (size_t)1, fd); /* <infotext> */
+ }
+
/* SN_REGION: <regionname> ...
* Write the region names only if there is more than one. */
if (spin->si_region_count > 1)
@@ -14823,6 +14908,38 @@ pop:
}
#endif
+/*
+ * ":spellinfo"
+ */
+/*ARGSUSED*/
+ void
+ex_spellinfo(eap)
+ exarg_T *eap;
+{
+ int lpi;
+ langp_T *lp;
+ char_u *p;
+
+ if (no_spell_checking(curwin))
+ return;
+
+ msg_start();
+ for (lpi = 0; lpi < curbuf->b_langp.ga_len && !got_int; ++lpi)
+ {
+ lp = LANGP_ENTRY(curbuf->b_langp, lpi);
+ msg_puts((char_u *)"file: ");
+ msg_puts(lp->lp_slang->sl_fname);
+ msg_putchar('\n');
+ p = lp->lp_slang->sl_info;
+ if (p != NULL)
+ {
+ msg_puts(p);
+ msg_putchar('\n');
+ }
+ }
+ msg_end();
+}
+
#define DUMPFLAG_KEEPCASE 1 /* round 2: keep-case tree */
#define DUMPFLAG_COUNT 2 /* include word count */
#define DUMPFLAG_ICASE 4 /* ignore case when finding matches */
@@ -14902,9 +15019,9 @@ spell_dump_compl(buf, pat, ic, dir, dumpflags_arg)
dumpflags |= DUMPFLAG_ONECAP;
else if (n == WF_ALLCAP
#ifdef FEAT_MBYTE
- && STRLEN(pat) > mb_ptr2len(pat)
+ && (int)STRLEN(pat) > mb_ptr2len(pat)
#else
- && STRLEN(pat) > 1
+ && (int)STRLEN(pat) > 1
#endif
)
dumpflags |= DUMPFLAG_ALLCAP;
diff --git a/src/tag.c b/src/tag.c
index 657c44690..556f8c50b 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -12,7 +12,7 @@
*/
#if defined MSDOS || defined WIN32 || defined(_WIN64)
-# include <io.h> /* for lseek(), must be before vim.h */
+# include "vimio.h" /* for lseek(), must be before vim.h */
#endif
#include "vim.h"
diff --git a/src/testdir/test58.in b/src/testdir/test58.in
index cb891ac07..7db6a9ed2 100644
--- a/src/testdir/test58.in
+++ b/src/testdir/test58.in
@@ -390,7 +390,7 @@ Test rules for compounding.
SET ISO8859-1
COMPOUNDMIN 3
-COMPOUNDFLAGS m*
+COMPOUNDRULE m*
NEEDCOMPOUND x
3affend
@@ -416,9 +416,9 @@ FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
LOW àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
UPP ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ
-COMPOUNDFLAGS m+
-COMPOUNDFLAGS sm*e
-COMPOUNDFLAGS sm+
+COMPOUNDRULE m+
+COMPOUNDRULE sm*e
+COMPOUNDRULE sm+
COMPOUNDMIN 3
COMPOUNDMAX 3
@@ -483,7 +483,7 @@ FLAG long
NEEDAFFIX !!
-COMPOUNDFLAGS ssmm*ee
+COMPOUNDRULE ssmm*ee
NEEDCOMPOUND xx
@@ -522,7 +522,7 @@ FLAG caplong
NEEDAFFIX A!
-COMPOUNDFLAGS sMm*Ee
+COMPOUNDRULE sMm*Ee
NEEDCOMPOUND Xx
@@ -561,7 +561,7 @@ FLAG num
NEEDAFFIX 9999
-COMPOUNDFLAGS 2,77*123
+COMPOUNDRULE 2,77*123
NEEDCOMPOUND 1
diff --git a/src/testdir/test59.in b/src/testdir/test59.in
index 368191c3d..d8e0a975e 100644
--- a/src/testdir/test59.in
+++ b/src/testdir/test59.in
@@ -394,7 +394,7 @@ Test rules for compounding.
SET ISO8859-1
COMPOUNDMIN 3
-COMPOUNDFLAGS m*
+COMPOUNDRULE m*
NEEDCOMPOUND x
3affend
@@ -420,9 +420,9 @@ FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
LOW àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
UPP ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ
-COMPOUNDFLAGS m+
-COMPOUNDFLAGS sm*e
-COMPOUNDFLAGS sm+
+COMPOUNDRULE m+
+COMPOUNDRULE sm*e
+COMPOUNDRULE sm+
COMPOUNDMIN 3
COMPOUNDMAX 3
@@ -490,7 +490,7 @@ FLAG long
NEEDAFFIX !!
-COMPOUNDFLAGS ssmm*ee
+COMPOUNDRULE ssmm*ee
NEEDCOMPOUND xx
@@ -529,7 +529,7 @@ FLAG caplong
NEEDAFFIX A!
-COMPOUNDFLAGS sMm*Ee
+COMPOUNDRULE sMm*Ee
NEEDCOMPOUND Xx
@@ -572,7 +572,7 @@ FLAG num
NEEDAFFIX 9999
-COMPOUNDFLAGS 2,77*123
+COMPOUNDRULE 2,77*123
NEEDCOMPOUND 1
diff --git a/src/ui.c b/src/ui.c
index d1013efb4..34fb3d776 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -1173,7 +1173,7 @@ clip_copy_modeless_selection(both)
if (enc_dbcs != 0)
len *= 2; /* max. 2 bytes per display cell */
else if (enc_utf8)
- len *= 9; /* max. 3 bytes per display cell + 2 composing chars */
+ len *= MB_MAXBYTES;
#endif
buffer = lalloc((long_u)len, TRUE);
if (buffer == NULL) /* out of memory */
@@ -1234,6 +1234,7 @@ clip_copy_modeless_selection(both)
else if (enc_utf8)
{
int off;
+ int i;
off = LineOffset[row];
for (i = start_col; i < end_col; ++i)
@@ -1245,14 +1246,13 @@ clip_copy_modeless_selection(both)
else
{
bufp += utf_char2bytes(ScreenLinesUC[off + i], bufp);
- if (ScreenLinesC1[off + i] != 0)
+ for (i = 0; i < Screen_mco; ++i)
{
- /* Add one or two composing characters. */
- bufp += utf_char2bytes(ScreenLinesC1[off + i],
+ /* Add a composing character. */
+ if (ScreenLinesC[i][off + i] == 0)
+ break;
+ bufp += utf_char2bytes(ScreenLinesC[i][off + i],
bufp);
- if (ScreenLinesC2[off + i] != 0)
- bufp += utf_char2bytes(ScreenLinesC2[off + i],
- bufp);
}
}
/* Skip right halve of double-wide character. */
diff --git a/src/version.h b/src/version.h
index 5c288aada..134e8f5b9 100644
--- a/src/version.h
+++ b/src/version.h
@@ -36,5 +36,5 @@
#define VIM_VERSION_NODOT "vim70aa"
#define VIM_VERSION_SHORT "7.0aa"
#define VIM_VERSION_MEDIUM "7.0aa ALPHA"
-#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2006 Mar 4)"
-#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2006 Mar 4, compiled "
+#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2006 Mar 6)"
+#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2006 Mar 6, compiled "
diff --git a/src/vim.h b/src/vim.h
index 3abd65956..ff57561d9 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -93,6 +93,12 @@
# endif
#endif
+/* Visual Studio 2005 has 'deprecated' many of the standard CRT functions */
+#if _MSC_VER >= 1400
+# define _CRT_SECURE_NO_DEPRECATE
+# define _CRT_NONSTDC_NO_DEPRECATE
+#endif
+
#if defined(FEAT_GUI_W32) || defined(FEAT_GUI_W16)
# define FEAT_GUI_MSWIN
#endif
@@ -358,12 +364,20 @@ typedef unsigned char sattr_T;
/*
* The u8char_T can hold one decoded UTF-8 character.
- * Vim always use an int (32 bits) for characters most places, so that we can
- * handle 32 bit characters in the file. u8char_T is only used for
- * displaying. That should be enough, because there is no font for > 16 bits.
+ * We normally use 32 bits now, since some Asian characters don't fit in 16
+ * bits. u8char_T is only used for displaying, it could be 16 bits to save
+ * memory.
*/
#ifdef FEAT_MBYTE
-typedef unsigned short u8char_T;
+# ifdef UNICODE16
+typedef unsigned short u8char_T; /* short should be 16 bits */
+# else
+# if SIZEOF_INT >= 4
+typedef unsigned int u8char_T; /* int is 32 bits */
+# else
+typedef unsigned long u8char_T; /* long should be 32 bits or more */
+# endif
+# endif
#endif
#ifndef UNIX /* For Unix this is included in os_unix.h */
@@ -652,6 +666,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname);
#define EXPAND_COMPILER 29
#define EXPAND_USER_DEFINED 30
#define EXPAND_USER_LIST 31
+#define EXPAND_SHELLCMD 32
/* Values for exmode_active (0 is no exmode) */
#define EXMODE_NORMAL 1
@@ -676,12 +691,13 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname);
#define WILD_ESCAPE 128
/* Flags for expand_wildcards() */
-#define EW_DIR 1 /* include directory names */
-#define EW_FILE 2 /* include file names */
-#define EW_NOTFOUND 4 /* include not found names */
-#define EW_ADDSLASH 8 /* append slash to directory name */
-#define EW_KEEPALL 16 /* keep all matches */
-#define EW_SILENT 32 /* don't print "1 returned" from shell */
+#define EW_DIR 0x01 /* include directory names */
+#define EW_FILE 0x02 /* include file names */
+#define EW_NOTFOUND 0x04 /* include not found names */
+#define EW_ADDSLASH 0x08 /* append slash to directory name */
+#define EW_KEEPALL 0x10 /* keep all matches */
+#define EW_SILENT 0x20 /* don't print "1 returned" from shell */
+#define EW_EXEC 0x40 /* executable files */
/* Note: mostly EW_NOTFOUND and EW_SILENT are mutually exclusive: EW_NOTFOUND
* is used when executing commands and EW_SILENT for interactive expanding. */
@@ -1480,6 +1496,15 @@ int vim_memcmp __ARGS((void *, void *, size_t));
# endif
#endif
+#ifdef FEAT_MBYTE
+# define MAX_MCO 6 /* maximum value for 'maxcombine' */
+
+/* Maximum number of bytes in a multi-byte character. It can be one 32-bit
+ * character of up to 6 bytes, or one 16-bit character of up to three bytes
+ * plus six following composing characters of three bytes each. */
+# define MB_MAXBYTES 21
+#endif
+
/* Include option.h before structs.h, because the number of window-local and
* buffer-local options is used there. */
#include "option.h" /* options and default values */
@@ -1783,11 +1808,6 @@ typedef int proftime_T; /* dummy for function prototypes */
#endif
#ifdef FEAT_MBYTE
-/* Maximum number of bytes in a multi-byte character. It can be one 32-bit
- * character of up to 6 bytes, or one 16-bit character of up to three bytes
- * plus two following composing characters of three bytes each. */
-# define MB_MAXBYTES 9
-
/*
* Return byte length of character that starts with byte "b".
* Returns 1 for a single-byte character.
diff --git a/src/vim.rc b/src/vim.rc
index e50a9c45b..affdb9a5a 100644
--- a/src/vim.rc
+++ b/src/vim.rc
@@ -12,11 +12,11 @@
#include <winver.h>
#include "version.h"
#include "gui_w32_rc.h"
-#if defined(__BORLANDC__) || defined(__CYGWIN32__) || defined(__MINGW32__)
+// #if defined(__BORLANDC__) || defined(__CYGWIN32__) || defined(__MINGW32__)
# include <winresrc.h>
-#else
-# include <winres.h>
-#endif
+// #else
+// # include <winres.h>
+// #endif
//
// Icons
diff --git a/src/vimio.h b/src/vimio.h
new file mode 100644
index 000000000..71a52cd21
--- /dev/null
+++ b/src/vimio.h
@@ -0,0 +1,16 @@
+/* vi:set ts=8 sts=4 sw=4:
+ *
+ * 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.
+ */
+
+/* Visual Studio 2005 has 'deprecated' many of the standard CRT functions */
+#if _MSC_VER >= 1400
+# define _CRT_SECURE_NO_DEPRECATE
+# define _CRT_NONSTDC_NO_DEPRECATE
+#endif
+
+#include <io.h>
diff --git a/src/xxd/Make_mvc.mak b/src/xxd/Make_mvc.mak
index 0c9438aa1..3227f0c86 100644
--- a/src/xxd/Make_mvc.mak
+++ b/src/xxd/Make_mvc.mak
@@ -4,7 +4,10 @@
xxd: xxd.exe
xxd.exe: xxd.c
- cl /nologo -DWIN32 xxd.c /link setargv.obj
+ cl /nologo -DWIN32 xxd.c
+
+# This was for an older compiler
+# cl /nologo -DWIN32 xxd.c /link setargv.obj
clean:
- if exist xxd.obj del xxd.obj
diff --git a/src/xxd/xxd.c b/src/xxd/xxd.c
index 2b553dd6b..2b3ee9c03 100644
--- a/src/xxd/xxd.c
+++ b/src/xxd/xxd.c
@@ -58,6 +58,13 @@
* make money and share with me,
* lose money and don't ask me.
*/
+
+/* Visual Studio 2005 has 'deprecated' many of the standard CRT functions */
+#if _MSC_VER >= 1400
+# define _CRT_SECURE_NO_DEPRECATE
+# define _CRT_NONSTDC_NO_DEPRECATE
+#endif
+
#include <stdio.h>
#ifdef VAXC
# include <file.h>