Skip to content

Instantly share code, notes, and snippets.

@airblade
Created December 5, 2014 08:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save airblade/be24a108e40700933da5 to your computer and use it in GitHub Desktop.
Save airblade/be24a108e40700933da5 to your computer and use it in GitHub Desktop.
macvim failed to patch on 10.8.5
$ brew config
HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/Homebrew/homebrew.git
HEAD: db60d339c88b4021697d1857c0f4386596fb76e1
Last commit: 22 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: quad-core 64-bit ivybridge
OS X: 10.8.5-x86_64
Xcode: 5.1.1
CLT: 5.1.0.0.1.1396320587
LLVM-GCC: build 2336
Clang: 5.1 build 503
X11: N/A
System Ruby: 1.8.7-358
Perl: /usr/bin/perl
Python: /usr/local/bin/python => /usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Ruby: /Users/andy/.rbenv/shims/ruby
$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.
Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:
/Users/andy/.rbenv/shims/passenger-config
Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected header files:
/usr/local/include/node/ares.h
/usr/local/include/node/ares_version.h
/usr/local/include/node/nameser.h
/usr/local/include/node/node.h
/usr/local/include/node/node_buffer.h
/usr/local/include/node/node_internals.h
/usr/local/include/node/node_object_wrap.h
/usr/local/include/node/node_version.h
/usr/local/include/node/openssl/opensslconf.h
/usr/local/include/node/uv-private/ngx-queue.h
/usr/local/include/node/uv-private/stdint-msvc2008.h
/usr/local/include/node/uv-private/tree.h
/usr/local/include/node/uv-private/uv-bsd.h
/usr/local/include/node/uv-private/uv-darwin.h
/usr/local/include/node/uv-private/uv-linux.h
/usr/local/include/node/uv-private/uv-sunos.h
/usr/local/include/node/uv-private/uv-unix.h
/usr/local/include/node/uv-private/uv-win.h
/usr/local/include/node/uv.h
/usr/local/include/node/v8-debug.h
/usr/local/include/node/v8-preparser.h
/usr/local/include/node/v8-profiler.h
/usr/local/include/node/v8-testing.h
/usr/local/include/node/v8.h
/usr/local/include/node/v8stdint.h
/usr/local/include/node/zconf.h
/usr/local/include/node/zlib.h
Warning: You have uncommitted modifications to Homebrew
If this a surprise to you, then you should stash these modifications.
Stashing returns Homebrew to a pristine state but can be undone
should you later need to do so for some reason.
cd /usr/local/Library && git stash && git clean -d -f
Warning: Some installed formula are missing dependencies.
You should `brew install` the missing dependencies:
brew install cairo harfbuzz icu4c little-cms2 pango pixman
Run `brew missing` for more details.
$ HOMEBREW_MAKE_JOBS=1 brew install -v macvim --HEAD 2>&1
==> Cloning https://github.com/b4winckler/macvim.git
git --git-dir /Library/Caches/Homebrew/macvim--git/.git status -s
Updating /Library/Caches/Homebrew/macvim--git
git config remote.origin.url https://github.com/b4winckler/macvim.git
git config remote.origin.fetch +refs/heads/master:refs/remotes/origin/master
git fetch origin
git checkout -f master --
Already on 'master'
git reset --hard origin/master
HEAD is now at fd916f5 Fix background color of active tab for Yosemite
==> Checking out branch master
git checkout-index -a -f --prefix=/private/tmp/macvim-pPbuNK/
==> Patching
patching file Filelist
patching file nsis/gvim.nsi
patching file runtime/doc/autocmd.txt
patching file runtime/doc/diff.txt
patching file runtime/doc/editing.txt
patching file runtime/doc/eval.txt
patching file runtime/doc/helphelp.txt
patching file runtime/doc/index.txt
patching file runtime/doc/options.txt
patching file runtime/doc/spell.txt
patching file runtime/doc/tabpage.txt
patching file runtime/doc/various.txt
patching file runtime/doc/windows.txt
patching file runtime/plugin/matchparen.vim
patching file runtime/vimrc_example.vim
patching file src/INSTALLpc.txt
patching file src/MacVim/MMWindowController.m
patching file src/Make_bc3.mak
patching file src/Make_bc5.mak
patching file src/Make_cyg.mak
patching file src/Make_dice.mak
patching file src/Make_djg.mak
patching file src/Make_ivc.mak
patching file src/Make_manx.mak
patching file src/Make_ming.mak
patching file src/Make_morph.mak
patching file src/Make_mvc.mak
patching file src/Make_os2.mak
patching file src/Make_sas.mak
patching file src/Makefile
patching file src/auto/configure
patching file src/blowfish.c
patching file src/buffer.c
patching file src/charset.c
patching file src/config.h.in
patching file src/config.mk.in
patching file src/configure.in
patching file src/crypt.c
patching file src/crypt_zip.c
patching file src/diff.c
patching file src/edit.c
patching file src/eval.c
patching file src/ex_cmds.c
patching file src/ex_cmds.h
patching file src/ex_cmds2.c
patching file src/ex_docmd.c
patching file src/ex_getln.c
patching file src/feature.h
patching file src/fileio.c
patching file src/getchar.c
patching file src/globals.h
patching file src/gui_beval.c
patching file src/gui_dwrite.cpp
patching file src/gui_dwrite.h
patching file src/gui_w32.c
patching file src/gui_w48.c
patching file src/hardcopy.c
patching file src/if_py_both.h
patching file src/if_ruby.c
patching file src/macros.h
patching file src/main.c
patching file src/mbyte.c
patching file src/memline.c
patching file src/misc1.c
patching file src/misc2.c
patching file src/move.c
patching file src/normal.c
patching file src/ops.c
patching file src/option.c
patching file src/option.h
patching file src/os_mswin.c
patching file src/os_unix.c
patching file src/os_vms.c
patching file src/os_win32.c
patching file src/po/sjiscorr.c
patching file src/proto.h
patching file src/proto/blowfish.pro
patching file src/proto/crypt.pro
patching file src/proto/crypt_zip.pro
patching file src/proto/diff.pro
patching file src/proto/ex_cmds.pro
patching file src/proto/fileio.pro
patching file src/proto/getchar.pro
patching file src/proto/gui_w32.pro
patching file src/proto/misc2.pro
patching file src/proto/option.pro
patching file src/proto/os_mswin.pro
patching file src/proto/regexp.pro
patching file src/proto/term.pro
patching file src/proto/ui.pro
patching file src/regexp.c
patching file src/regexp.h
patching file src/regexp_nfa.c
patching file src/screen.c
patching file src/search.c
patching file src/spell.c
patching file src/structs.h
patching file src/syntax.c
patching file src/term.c
patching file src/testdir/Make_amiga.mak
patching file src/testdir/Make_dos.mak
patching file src/testdir/Make_ming.mak
patching file src/testdir/Make_os2.mak
patching file src/testdir/Make_vms.mms
patching file src/testdir/Makefile
patching file src/testdir/test100.in
patching file src/testdir/test101.in
patching file src/testdir/test101.ok
patching file src/testdir/test102.in
patching file src/testdir/test11.in
patching file src/testdir/test3.in
patching file src/testdir/test3.ok
patching file src/testdir/test39.in
patching file src/testdir/test4.in
patching file src/testdir/test4.ok
patching file src/testdir/test55.in
patching file src/testdir/test55.ok
patching file src/testdir/test63.in
patching file src/testdir/test63.ok
patching file src/testdir/test64.in
patching file src/testdir/test64.ok
patching file src/testdir/test71.in
patching file src/testdir/test71.ok
Hunk #1 FAILED at 4.
1 out of 1 hunk FAILED -- saving rejects to file src/testdir/test71.ok.rej
patching file src/testdir/test71a.in
Hunk #1 succeeded at 12 with fuzz 2.
patching file src/testdir/test72.in
patching file src/testdir/test72.ok
patching file src/testdir/test75.in
patching file src/testdir/test86.in
patching file src/testdir/test87.in
patching file src/testdir/test91.in
patching file src/testdir/test91.ok
patching file src/testdir/test_argument_count.in
patching file src/testdir/test_argument_count.ok
patching file src/testdir/test_breakindent.in
patching file src/testdir/test_breakindent.ok
patching file src/testdir/test_changelist.in
patching file src/testdir/test_changelist.ok
patching file src/testdir/test_close_count.in
patching file src/testdir/test_close_count.ok
patching file src/testdir/test_insertcount.in
patching file src/testdir/test_insertcount.ok
patching file src/testdir/test_listlbr.in
patching file src/testdir/test_listlbr.ok
patching file src/testdir/test_listlbr_utf8.in
patching file src/testdir/test_listlbr_utf8.ok
Hunk #1 FAILED at 12.
1 out of 1 hunk FAILED -- saving rejects to file src/testdir/test_listlbr_utf8.ok.rej
patching file src/testdir/test_mapping.in
patching file src/testdir/test_mapping.ok
patching file src/testdir/test_signs.in
patching file src/testdir/test_signs.ok
patching file src/testdir/test_utf8.in
patching file src/testdir/test_utf8.ok
patching file src/testdir/test_writefile.in
patching file src/testdir/test_writefile.ok
patching file src/ui.c
patching file src/undo.c
patching file src/version.c
patching file src/vim.h
patching file src/window.c
Error: Failure while executing: /usr/bin/patch -g 0 -f -p1
$ ls ~/Library/Logs/Homebrew/macvim/
[directory empty]
require 'formula'
# Reference: https://github.com/b4winckler/macvim/wiki/building
class Macvim < Formula
homepage 'http://code.google.com/p/macvim/'
url 'https://github.com/b4winckler/macvim/archive/snapshot-73.tar.gz'
version '7.4-73'
sha1 'b87e37fecb305a99bc268becca39f8854e3ff9f0'
revision 1
head 'https://github.com/b4winckler/macvim.git'
option "custom-icons", "Try to generate custom document icons"
option "override-system-vim", "Override system vim"
depends_on :xcode => :build
depends_on 'cscope' => :recommended
depends_on 'lua' => :optional
depends_on 'luajit' => :optional
depends_on :python => :recommended
depends_on :python3 => :optional
env :std if MacOS.version <= :snow_leopard
# Help us! We'd like to use superenv in these environments too
patch :DATA
def install
# MacVim doesn't have and required any Python package, unset PYTHONPATH.
ENV.delete('PYTHONPATH')
# Set ARCHFLAGS so the Python app (with C extension) that is
# used to create the custom icons will not try to compile in
# PPC support (which isn't needed in Homebrew-supported systems.)
ENV['ARCHFLAGS'] = "-arch #{MacOS.preferred_arch}"
# If building for 10.7 or up, make sure that CC is set to "clang".
ENV.clang if MacOS.version >= :lion
args = %W[
--with-features=huge
--enable-multibyte
--with-macarchs=#{MacOS.preferred_arch}
--enable-perlinterp
--enable-rubyinterp
--enable-tclinterp
--with-tlib=ncurses
--with-compiledby=Homebrew
--with-local-dir=#{HOMEBREW_PREFIX}
]
args << "--enable-cscope" if build.with? "cscope"
if build.with? "lua"
args << "--enable-luainterp"
args << "--with-lua-prefix=#{HOMEBREW_PREFIX}"
end
if build.with? "luajit"
args << "--enable-luainterp"
args << "--with-lua-prefix=#{HOMEBREW_PREFIX}"
args << "--with-luajit"
end
# only allow either python or python3; if the optional
# python3 is chosen, default to it, otherwise use python2
if build.with? "python3"
args << "--enable-python3interp"
elsif build.with? "python"
ENV.prepend "LDFLAGS", `python-config --ldflags`.chomp
ENV.prepend "CFLAGS", `python-config --cflags`.chomp
args << "--enable-pythoninterp"
end
# configure appends "SDKS/..." to the value of `xcode-select -print-path`,
# but this isn't correct on recent Xcode, so we need to set it manually.
# FIXME this is a bug, and it should be fixed upstream.
unless MacOS::CLT.installed?
args << "--with-developer-dir=#{MacOS::Xcode.prefix}/Platforms/MacOSX.platform/Developer"
args << "--with-macsdk=#{MacOS.version}"
end
system "./configure", *args
if build.include? "custom-icons"
# Get the custom font used by the icons
system "make", "-C", "src/MacVim/icons", "getenvy"
else
# Building custom icons fails for many users, so off by default.
inreplace "src/MacVim/icons/Makefile", "$(MAKE) -C makeicns", ""
inreplace "src/MacVim/icons/make_icons.py", "dont_create = False", "dont_create = True"
end
system "make"
prefix.install "src/MacVim/build/Release/MacVim.app"
inreplace "src/MacVim/mvim", /^# VIM_APP_DIR=\/Applications$/,
"VIM_APP_DIR=#{prefix}"
bin.install "src/MacVim/mvim"
# Create MacVim vimdiff, view, ex equivalents
executables = %w[mvimdiff mview mvimex gvim gvimdiff gview gvimex]
executables += %w[vi vim vimdiff view vimex] if build.include? "override-system-vim"
executables.each { |e| bin.install_symlink "mvim" => e }
end
def caveats
if build.with? "python" and build.with? "python3"
<<-EOS.undent
MacVim can no longer be brewed with dynamic support for both Python versions.
Only Python 3 support has been provided.
EOS
end
end
test do
# Simple test to check if MacVim was linked to Python version in $PATH
if build.with? "python"
vim_path = prefix/"MacVim.app/Contents/MacOS/Vim"
# Get linked framework using otool
otool_output = `otool -L #{vim_path} | grep -m 1 Python`.gsub(/\(.*\)/, "").strip.chomp
# Expand the link and get the python exec path
vim_framework_path = Pathname.new(otool_output).realpath.dirname.to_s.chomp
system_framework_path = `python-config --exec-prefix`.chomp
assert_equal system_framework_path, vim_framework_path
end
end
end
__END__
From 6d2f8055aca77a2a82a59263a6f79f6eb0de39c4 Mon Sep 17 00:00:00 2001
From: Limin Tang <limintang@gmail.com>
Date: Tue, 2 Dec 2014 15:40:54 -0800
Subject: [PATCH] Update to Vim 7.4.540 and fix black bars on the top and
bottom of Vim window in native full screen mode on Yosemite
---
Filelist | 11 +
nsis/gvim.nsi | 9 +-
runtime/doc/autocmd.txt | 13 +
runtime/doc/diff.txt | 32 +-
runtime/doc/editing.txt | 65 +-
runtime/doc/eval.txt | 31 +-
runtime/doc/helphelp.txt | 3 +
runtime/doc/index.txt | 1 +
runtime/doc/options.txt | 107 ++-
runtime/doc/spell.txt | 11 +
runtime/doc/tabpage.txt | 49 +-
runtime/doc/various.txt | 1 +
runtime/doc/windows.txt | 158 ++--
runtime/plugin/matchparen.vim | 26 +-
runtime/vimrc_example.vim | 9 +-
src/INSTALLpc.txt | 49 +-
src/MacVim/MMWindowController.m | 4 +-
src/Make_bc3.mak | 2 +
src/Make_bc5.mak | 2 +
src/Make_cyg.mak | 722 +---------------
src/Make_dice.mak | 8 +
src/Make_djg.mak | 2 +
src/Make_ivc.mak | 10 +
src/Make_manx.mak | 12 +
src/Make_ming.mak | 790 +-----------------
src/Make_morph.mak | 2 +
src/Make_mvc.mak | 48 +-
src/Make_os2.mak | 4 +
src/Make_sas.mak | 10 +
src/Makefile | 52 +-
src/auto/configure | 76 +-
src/blowfish.c | 307 ++++---
src/buffer.c | 52 +-
src/charset.c | 13 +-
src/config.h.in | 3 +
src/config.mk.in | 1 +
src/configure.in | 51 +-
src/crypt.c | 605 ++++++++++++++
src/crypt_zip.c | 158 ++++
src/diff.c | 14 +-
src/edit.c | 35 +-
src/eval.c | 237 ++++--
src/ex_cmds.c | 168 ++--
src/ex_cmds.h | 1591 ++++++++++++++++++++++++------------
src/ex_cmds2.c | 15 +-
src/ex_docmd.c | 759 ++++++++++++-----
src/ex_getln.c | 27 +-
src/feature.h | 7 -
src/fileio.c | 409 +++++----
src/getchar.c | 40 +-
src/globals.h | 9 +-
src/gui_beval.c | 11 +
src/gui_dwrite.cpp | 901 ++++++++++++++++++++
src/gui_dwrite.h | 85 ++
src/gui_w32.c | 232 +++++-
src/gui_w48.c | 52 +-
src/hardcopy.c | 34 +-
src/if_py_both.h | 4 +-
src/if_ruby.c | 14 +-
src/macros.h | 15 +-
src/main.c | 28 +-
src/mbyte.c | 2 +
src/memline.c | 120 ++-
src/misc1.c | 12 +-
src/misc2.c | 339 +-------
src/move.c | 12 +
src/normal.c | 24 +-
src/ops.c | 38 +-
src/option.c | 143 +++-
src/option.h | 9 +-
src/os_mswin.c | 78 +-
src/os_unix.c | 68 +-
src/os_vms.c | 2 +-
src/os_win32.c | 103 ++-
src/po/sjiscorr.c | 3 +-
src/proto.h | 2 +
src/proto/blowfish.pro | 10 +-
src/proto/crypt.pro | 26 +
src/proto/crypt_zip.pro | 5 +
src/proto/diff.pro | 2 +-
src/proto/ex_cmds.pro | 1 +
src/proto/fileio.pro | 5 +-
src/proto/getchar.pro | 1 +
src/proto/gui_w32.pro | 2 +
src/proto/misc2.pro | 11 +-
src/proto/option.pro | 2 +-
src/proto/os_mswin.pro | 1 +
src/proto/regexp.pro | 1 +
src/proto/term.pro | 2 -
src/proto/ui.pro | 2 +
src/regexp.c | 203 ++++-
src/regexp.h | 26 +-
src/regexp_nfa.c | 50 +-
src/screen.c | 59 +-
src/search.c | 46 +-
src/spell.c | 41 +-
src/structs.h | 29 +-
src/syntax.c | 31 +-
src/term.c | 136 ++-
src/testdir/Make_amiga.mak | 21 +-
src/testdir/Make_dos.mak | 22 +-
src/testdir/Make_ming.mak | 22 +-
src/testdir/Make_os2.mak | 22 +-
src/testdir/Make_vms.mms | 19 +-
src/testdir/Makefile | 26 +-
src/testdir/test100.in | 7 +-
src/testdir/test101.in | 3 +
src/testdir/test101.ok | 1 +
src/testdir/test102.in | 1 +
src/testdir/test11.in | 6 +-
src/testdir/test3.in | 8 +
src/testdir/test3.ok | 8 +
src/testdir/test39.in | 8 +
src/testdir/test39.ok | Bin 481 -> 514 bytes
src/testdir/test4.in | 3 +
src/testdir/test4.ok | 3 +
src/testdir/test55.in | 15 +
src/testdir/test55.ok | 5 +
src/testdir/test63.in | 29 +-
src/testdir/test63.ok | 2 +
src/testdir/test64.in | 13 +-
src/testdir/test64.ok | 2 +
src/testdir/test71.in | 27 +
src/testdir/test71.ok | 5 +
src/testdir/test71a.in | 4 +
src/testdir/test72.in | 29 +-
src/testdir/test72.ok | 4 +
src/testdir/test75.in | 8 +-
src/testdir/test86.in | 1 +
src/testdir/test87.in | 1 +
src/testdir/test91.in | 1 +
src/testdir/test91.ok | 4 +-
src/testdir/test_argument_count.in | 48 ++
src/testdir/test_argument_count.ok | 13 +
src/testdir/test_breakindent.in | 54 +-
src/testdir/test_breakindent.ok | 9 +
src/testdir/test_changelist.in | 22 +
src/testdir/test_changelist.ok | 1 +
src/testdir/test_close_count.in | 156 ++++
src/testdir/test_close_count.ok | 23 +
src/testdir/test_insertcount.in | 14 +
src/testdir/test_insertcount.ok | 3 +
src/testdir/test_listlbr.in | 20 +-
src/testdir/test_listlbr.ok | 11 +
src/testdir/test_listlbr_utf8.in | 11 +
src/testdir/test_listlbr_utf8.ok | 7 +
src/testdir/test_mapping.in | 16 +
src/testdir/test_mapping.ok | 2 +
src/testdir/test_signs.in | 22 +
src/testdir/test_signs.ok | 2 +
src/testdir/test_utf8.in | 18 +
src/testdir/test_utf8.ok | 4 +
src/testdir/test_writefile.in | 18 +
src/testdir/test_writefile.ok | 5 +
src/ui.c | 54 ++
src/undo.c | 690 +++++++++++-----
src/version.c | 321 ++++++++
src/vim.h | 13 +-
src/window.c | 78 +-
159 files changed, 7821 insertions(+), 3987 deletions(-)
create mode 100644 src/crypt.c
create mode 100644 src/crypt_zip.c
create mode 100644 src/gui_dwrite.cpp
create mode 100644 src/gui_dwrite.h
create mode 100644 src/proto/crypt.pro
create mode 100644 src/proto/crypt_zip.pro
create mode 100644 src/testdir/test_argument_count.in
create mode 100644 src/testdir/test_argument_count.ok
create mode 100644 src/testdir/test_changelist.in
create mode 100644 src/testdir/test_changelist.ok
create mode 100644 src/testdir/test_close_count.in
create mode 100644 src/testdir/test_close_count.ok
create mode 100644 src/testdir/test_insertcount.in
create mode 100644 src/testdir/test_insertcount.ok
create mode 100644 src/testdir/test_mapping.in
create mode 100644 src/testdir/test_mapping.ok
create mode 100644 src/testdir/test_signs.in
create mode 100644 src/testdir/test_signs.ok
create mode 100644 src/testdir/test_utf8.in
create mode 100644 src/testdir/test_utf8.ok
create mode 100644 src/testdir/test_writefile.in
create mode 100644 src/testdir/test_writefile.ok
diff --git a/Filelist b/Filelist
index 46aaa96..5223754 100644
--- a/Filelist
+++ b/Filelist
@@ -11,6 +11,8 @@ SRC_ALL = \
src/blowfish.c \
src/buffer.c \
src/charset.c \
+ src/crypt.c \
+ src/crypt_zip.c \
src/diff.c \
src/digraph.c \
src/edit.c \
@@ -80,6 +82,7 @@ SRC_ALL = \
src/xxd/xxd.c \
src/main.aap \
src/testdir/main.aap \
+ src/testdir/README.txt \
src/testdir/*.in \
src/testdir/sautest/autoload/*.vim \
src/testdir/test[0-9]*.ok \
@@ -99,10 +102,15 @@ SRC_ALL = \
src/testdir/pythonx/topmodule/submodule/subsubmodule/subsubsubmodule.py \
src/testdir/python_after/*.py \
src/testdir/python_before/*.py \
+ src/testdir/bench*.in \
+ src/testdir/bench*.vim \
+ src/testdir/samples/*.txt \
src/proto.h \
src/proto/blowfish.pro \
src/proto/buffer.pro \
src/proto/charset.pro \
+ src/proto/crypt.pro \
+ src/proto/crypt_zip.pro \
src/proto/diff.pro \
src/proto/digraph.pro \
src/proto/edit.pro \
@@ -272,6 +280,7 @@ SRC_DOS = \
src/Make_bc3.mak \
src/Make_bc5.mak \
src/Make_cyg.mak \
+ src/Make_cyg_ming.mak \
src/Make_djg.mak \
src/Make_ivc.mak \
src/Make_dvc.mak \
@@ -289,6 +298,8 @@ SRC_DOS = \
src/dosinst.h \
src/glbl_ime.cpp \
src/glbl_ime.h \
+ src/gui_dwrite.cpp \
+ src/gui_dwrite.h \
src/gui_w16.c \
src/gui_w32.c \
src/gui_w48.c \
diff --git a/nsis/gvim.nsi b/nsis/gvim.nsi
index 7b69e7d..a2d20bf 100644
--- a/nsis/gvim.nsi
+++ b/nsis/gvim.nsi
@@ -1,6 +1,6 @@
# NSIS file to create a self-installing exe for Vim.
# It requires NSIS version 2.0 or later.
-# Last Change: 2010 Jul 30
+# Last Change: 2014 Nov 5
# WARNING: if you make changes to this script, look out for $0 to be valid,
# because uninstall deletes most files in $0.
@@ -38,7 +38,7 @@ SetDatablockOptimize on
RequestExecutionLevel highest
ComponentText "This will install Vim ${VER_MAJOR}.${VER_MINOR} on your computer."
-DirText "Choose a directory to install Vim (must end in 'vim')"
+DirText "Choose a directory to install Vim (should contain 'vim')"
Icon icons\vim_16c.ico
# NSIS2 uses a different strategy with six different images in a strip...
#EnabledBitmap icons\enabled.bmp
@@ -135,11 +135,6 @@ FunctionEnd
# We only accept the directory if it ends in "vim". Using .onVerifyInstDir has
# the disadvantage that the browse dialog is difficult to use.
Function CheckInstallDir
- StrCpy $0 $INSTDIR 3 -3
- StrCmp $0 "vim" PathGood
- MessageBox MB_OK "The path must end in 'vim'."
- Abort
- PathGood:
FunctionEnd
Function .onInstSuccess
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt
index 2a8bece..079b916 100644
--- a/runtime/doc/autocmd.txt
+++ b/runtime/doc/autocmd.txt
@@ -278,6 +278,7 @@ Name triggered by ~
|ShellCmdPost| after executing a shell command
|ShellFilterPost| after filtering with a shell command
+|CmdUndefined| a user command is used but it isn't defined
|FuncUndefined| a user function is used but it isn't defined
|SpellFileMissing| a spell file is used but it can't be found
|SourcePre| before sourcing a Vim script
@@ -465,6 +466,16 @@ BufWriteCmd Before writing the whole buffer to a file.
*BufWritePost*
BufWritePost After writing the whole buffer to a file
(should undo the commands for BufWritePre).
+ *CmdUndefined*
+CmdUndefined When a user command is used but it isn't
+ defined. Useful for defining a command only
+ when it's used. The pattern is matched
+ against the command name. Both <amatch> and
+ <afile> are set to the name of the command.
+ NOTE: Autocompletion won't work until the
+ command is defined. An alternative is to
+ always define the user command and have it
+ invoke an autoloaded function. See |autoload|.
*CmdwinEnter*
CmdwinEnter After entering the command-line window.
Useful for setting options specifically for
@@ -670,6 +681,8 @@ FuncUndefined When a user function is used but it isn't
when it's used. The pattern is matched
against the function name. Both <amatch> and
<afile> are set to the name of the function.
+ NOTE: When writing Vim scripts a better
+ alternative is to use an autoloaded function.
See |autoload-functions|.
*GUIEnter*
GUIEnter After starting the GUI successfully, and after
diff --git a/runtime/doc/diff.txt b/runtime/doc/diff.txt
index 0ee5878..cc97c94 100644
--- a/runtime/doc/diff.txt
+++ b/runtime/doc/diff.txt
@@ -95,7 +95,7 @@ While already in Vim you can start diff mode in three ways.
:difft[his] Make the current window part of the diff windows. This sets
the options like for "vimdiff".
-:diffp[atch] {patchfile} *E816* *:diffp* *:diffpatch*
+:diffp[atch] {patchfile} *E816* *:diffp* *:diffpatch*
Use the current buffer, patch it with the diff found in
{patchfile} and open a buffer on the result. The options are
set as for "vimdiff".
@@ -124,13 +124,13 @@ file for a moment and come back to the same file and be in diff mode again.
*:diffo* *:diffoff*
:diffo[ff] Switch off diff mode for the current window. Resets related
- options also when 'diff' was not set.
-
+ options also when 'diff' was not set.
+
:diffo[ff]! Switch off diff mode for the current window and in all windows
- in the current tab page where 'diff' is set. Resetting
- related options only happens in a window that has 'diff' set,
- if the current window does not have 'diff' set then no options
- in it are changed.
+ in the current tab page where 'diff' is set. Resetting
+ related options only happens in a window that has 'diff' set,
+ if the current window does not have 'diff' set then no options
+ in it are changed.
The ":diffoff" command resets the relevant options to the values they had when
using |:diffsplit|, |:diffpatch| , |:diffthis|. or starting Vim in diff mode.
@@ -266,13 +266,17 @@ that the buffers will be equal within the specified range.
See below for [range].
*do*
-do Same as ":diffget" without argument or range. The "o" stands
- for "obtain" ("dg" can't be used, it could be the start of
- "dgg"!). Note: this doesn't work in Visual mode.
-
- *dp*
-dp Same as ":diffput" without argument or range.
- Note: this doesn't work in Visual mode.
+[count]do Same as ":diffget" without range. The "o" stands for "obtain"
+ ("dg" can't be used, it could be the start of "dgg"!). Note:
+ this doesn't work in Visual mode.
+ If you give a [count], it is used as the [bufspec] argument
+ for ":diffget".
+
+ *dp*
+[count]dp Same as ":diffput" without range. Note: this doesn't work in
+ Visual mode.
+ If you give a [count], it is used as the [bufspec] argument
+ for ":diffput".
When no [range] is given, the diff at the cursor position or just above it is
diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt
index 0b5f69a..4bd6f1c 100644
--- a/runtime/doc/editing.txt
+++ b/runtime/doc/editing.txt
@@ -609,7 +609,10 @@ list of the current window.
{not in Vi}
:[count]arga[dd] {name} .. *:arga* *:argadd* *E479*
- Add the {name}s to the argument list.
+:[count]arga[dd]
+ Add the {name}s to the argument list. When {name} is
+ omitted at the current buffer name to the argument
+ list.
If [count] is omitted, the {name}s are added just
after the current entry in the argument list.
Otherwise they are added after the [count]'th file.
@@ -619,7 +622,8 @@ list of the current window.
:argadd x a b x c
:0argadd x x a b c
:1argadd x a x b c
- :99argadd x a b c x
+ :$argadd x a b c x
+ :+2argadd y a b c x y
There is no check for duplicates, it is possible to
add a file to the argument list twice.
The currently edited file is not changed.
@@ -641,11 +645,19 @@ list of the current window.
< {not in Vi} {not available when compiled without the
|+listcmds| feature}
-:{range}argd[elete] Delete the {range} files from the argument list.
+:[range]argd[elete] Delete the {range} files from the argument list.
+ Example: >
+ :10,$argdel
+< Deletes arguments 10 and further, keeping 1-9. >
+ :$argd
+< Deletes just the last one. >
+ :argd
+ :.argd
+< Deletes the current argument. >
+ :%argd
+< Removes all the files from the arglist.
When the last number in the range is too high, up to
- the last argument is deleted. Example: >
- :10,1000argdel
-< Deletes arguments 10 and further, keeping 1-9.
+ the last argument is deleted.
{not in Vi} {not available when compiled without the
|+listcmds| feature}
@@ -1077,9 +1089,12 @@ The names can be in upper- or lowercase.
the last file in the argument list has not been
edited. See |:confirm| and 'confirm'. {not in Vi}
-:q[uit]! Quit without writing, also when visible buffers have
- changes. Does not exit when there are changed hidden
- buffers. Use ":qall!" to exit always.
+:q[uit]! Quit without writing, also when currently visible
+ buffers have changes. Does not exit when this is the
+ last window and there are is a changed hidden buffer.
+ In this case, the first changed hidden buffer becomes
+ the current buffer.
+ Use ":qall!" to exit always.
:cq[uit] Quit always, without writing, and return an error
code. See |:cq|. Used for Manx's QuickFix mode (see
@@ -1370,8 +1385,13 @@ lose your work. The undo file can be disabled without much disadvantage. >
Note: The text in memory is not encrypted. A system administrator may be able
to see your text while you are editing it. When filtering text with
-":!filter" or using ":w !command" the text is not encrypted, this may reveal
-it to others. The 'viminfo' file is not encrypted.
+":!filter" or using ":w !command" the text is also not encrypted, this may
+reveal it to others. The 'viminfo' file is not encrypted.
+
+You could do this to edit very secret text: >
+ :set noundofile viminfo=
+ :noswapfile edit secrets.txt
+Keep in mind that without a swap file you risk loosing your work in a crash.
WARNING: If you make a typo when entering the key and then write the file and
exit, the text will be lost!
@@ -1398,18 +1418,25 @@ To disable the encryption, reset the 'key' option to an empty value: >
:set key=
You can use the 'cryptmethod' option to select the type of encryption, use one
-of these two: >
- :setlocal cm=zip " weak method, backwards compatible
- :setlocal cm=blowfish " strong method
+of these: >
+ :setlocal cm=zip " weak method, backwards compatible
+ :setlocal cm=blowfish " method with flaws
+ :setlocal cm=blowfish2 " medium strong method
+
Do this before writing the file. When reading an encrypted file it will be
set automatically to the method used when that file was written. You can
change 'cryptmethod' before writing that file to change the method.
+
To set the default method, used for new files, use one of these in your
|vimrc| file: >
set cm=zip
- set cm=blowfish
+ set cm=blowfish2
+Use the first one if you need to be compatible with Vim 7.2 and older. Using
+"blowfish2" is highly recommended if you can use a Vim version that supports
+it.
+
The message given for reading and writing a file will show "[crypted]" when
-using zip, "[blowfish]" when using blowfish.
+using zip, "[blowfish]" when using blowfish, etc.
When writing an undo file, the same key and method will be used for the text
in the undo file. |persistent-undo|.
@@ -1444,7 +1471,7 @@ lines to "/etc/magic", "/usr/share/misc/magic" or wherever your system has the
0 string VimCrypt~ Vim encrypted file
>9 string 01 - "zip" cryptmethod
>9 string 02 - "blowfish" cryptmethod
-
+ >9 string 03 - "blowfish2" cryptmethod
Notes:
- Encryption is not possible when doing conversion with 'charconvert'.
@@ -1468,6 +1495,10 @@ Notes:
- Pkzip uses the same encryption as 'cryptmethod' "zip", and US Govt has no
objection to its export. Pkzip's public file APPNOTE.TXT describes this
algorithm in detail.
+- The implmentation of 'cryptmethod' "blowfish" has a flaw. It is possible to
+ crack the first 64 bytes of a file and in some circumstances more of the
+ file. Use of it is not recommended, but it's still the strongest method
+ supported by Vim 7.3 and 7.4. The "zip" method is even weaker.
- Vim originates from the Netherlands. That is where the sources come from.
Thus the encryption code is not exported from the USA.
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index a6f1f10..97dc0d4 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1457,10 +1457,10 @@ v:foldstart Used for 'foldtext': first line of closed fold.
Read-only in the |sandbox|. |fold-foldtext|
*v:hlsearch* *hlsearch-variable*
-v:hlsearch Variable that determines whether search highlighting is on.
- Makes sense only if 'hlsearch' is enabled which requires
- |+extra_search|. Setting this variable to zero acts the like
- |:nohlsearch| command, setting it to one acts like >
+v:hlsearch Variable that indicates whether search highlighting is on.
+ Setting it makes sense only if 'hlsearch' is enabled which
+ requires |+extra_search|. Setting this variable to zero acts
+ the like |:nohlsearch| command, setting it to one acts like >
let &hlsearch = &hlsearch
<
*v:insertmode* *insertmode-variable*
@@ -2040,7 +2040,7 @@ winrestcmd() String returns command to restore window sizes
winrestview( {dict}) none restore view of current window
winsaveview() Dict save view of current window
winwidth( {nr}) Number width of window {nr}
-writefile( {list}, {fname} [, {binary}])
+writefile( {list}, {fname} [, {flags}])
Number write list of lines to file {fname}
xor( {expr}, {expr}) Number bitwise XOR
@@ -3568,6 +3568,8 @@ gettabvar({tabnr}, {varname} [, {def}]) *gettabvar()*
Get the value of a tab-local variable {varname} in tab page
{tabnr}. |t:var|
Tabs are numbered starting with one.
+ When {varname} is empty a dictionary with all tab-local
+ variables is returned.
Note that the name without "t:" must be used.
When the tab or variable doesn't exist {def} or an empty
string is returned, there is no error message.
@@ -6086,6 +6088,12 @@ system({expr} [, {input}]) *system()* *E677*
list items converted to NULs).
Pipes are not used.
+ When prepended by |:silent| the shell will not be set to
+ cooked mode. This is meant to be used for commands that do
+ not need the user to type. It avoids stray characters showing
+ up on the screen which require |CTRL-L| to remove. >
+ :silent let f = system('ls *.vim')
+<
Note: Use |shellescape()| or |::S| with |expand()| or
|fnamemodify()| to escape special characters in a command
argument. Newlines in {expr} may cause the command to fail.
@@ -6539,14 +6547,20 @@ winwidth({nr}) *winwidth()*
:endif
<
*writefile()*
-writefile({list}, {fname} [, {binary}])
+writefile({list}, {fname} [, {flags}])
Write |List| {list} to file {fname}. Each list item is
separated with a NL. Each list item must be a String or
Number.
- When {binary} is equal to "b" binary mode is used: There will
+ When {flags} contains "b" then binary mode is used: There will
not be a NL after the last list item. An empty item at the
end does cause the last line in the file to end in a NL.
- All NL characters are replaced with a NUL character.
+
+ When {flags} contains "a" then append mode is used, lines are
+ append to the file: >
+ :call writefile(["foo"], "event.log", "a")
+ :call writefile(["bar"], "event.log", "a")
+>
+< All NL characters are replaced with a NUL character.
Inserting CR characters needs to be done before passing {list}
to writefile().
An existing file is overwritten, if possible.
@@ -6622,6 +6636,7 @@ dialog_con Compiled with console dialog support.
dialog_gui Compiled with GUI dialog support.
diff Compiled with |vimdiff| and 'diff' support.
digraphs Compiled with support for digraphs.
+directx Compiled with support for Direct-X and 'renderoptions'.
dnd Compiled with support for the "~ register |quote_~|.
dos16 16 bits DOS version of Vim.
dos32 32 bits DOS (DJGPP) version of Vim.
diff --git a/runtime/doc/helphelp.txt b/runtime/doc/helphelp.txt
index 87f095e..e7d281a 100644
--- a/runtime/doc/helphelp.txt
+++ b/runtime/doc/helphelp.txt
@@ -96,6 +96,9 @@ Help on help files *helphelp*
find a tag in a file with the same language as the
current file. See |help-translated|.
+ *:helpc* *:helpclose*
+:helpc[lose] Close one help window.
+
*:helpg* *:helpgrep*
:helpg[rep] {pattern}[@xx]
Search all help text files and make a list of lines
diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt
index 2d0eda4..ca8160d 100644
--- a/runtime/doc/index.txt
+++ b/runtime/doc/index.txt
@@ -1244,6 +1244,7 @@ tag command action ~
|:gvim| :gv[im] start the GUI
|:hardcopy| :ha[rdcopy] send text to the printer
|:help| :h[elp] open a help window
+|:helpclose| :helpc[lose] close one help window
|:helpfind| :helpf[ind] dialog to open a help window
|:helpgrep| :helpg[rep] like ":grep" but searches help files
|:helptags| :helpt[ags] generate help tags for a directory
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 2ca7829..64f2eb0 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -926,7 +926,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'backupcopy'* *'bkc'*
'backupcopy' 'bkc' string (Vi default for Unix: "yes", otherwise: "auto")
- global
+ global or local to buffer |global-local|
{not in Vi}
When writing a file and a backup is made, this option tells how it's
done. This is a comma separated list of words.
@@ -2234,10 +2234,18 @@ A jump table for the options with a short description can be found at |Q_op|.
zip PkZip compatible method. A weak kind of encryption.
Backwards compatible with Vim 7.2 and older.
*blowfish*
- blowfish Blowfish method. Strong encryption. Requires Vim 7.3
- or later, files can NOT be read by Vim 7.2 and older.
- This adds a "seed" to the file, every time you write
- the file the encrypted bytes will be different.
+ blowfish Blowfish method. Medium strong encryption but it has
+ an implementation flaw. Requires Vim 7.3 or later,
+ files can NOT be read by Vim 7.2 and older. This adds
+ a "seed" to the file, every time you write the file
+ the encrypted bytes will be different.
+ *blowfish2*
+ blowfish2 Blowfish method. Medium strong encryption. Requires
+ Vim 7.4.399 or later, files can NOT be read by Vim 7.3
+ and older. This adds a "seed" to the file, every time
+ you write the file the encrypted bytes will be
+ different. The whole undo file is encrypted, not just
+ the pieces of text.
When reading an encrypted file 'cryptmethod' will be set automatically
to the detected method of the file being read. Thus if you write it
@@ -4627,6 +4635,8 @@ A jump table for the options with a short description can be found at |Q_op|.
be able to execute Normal mode commands.
This is the opposite of the 'keymap' option, where characters are
mapped in Insert mode.
+ Also consider setting 'langnoremap' to avoid 'langmap' applies to
+ characters resulting from a mapping.
This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons.
@@ -4682,6 +4692,18 @@ A jump table for the options with a short description can be found at |Q_op|.
:source $VIMRUNTIME/menu.vim
< Warning: This deletes all menus that you defined yourself!
+ *'langnoremap'* *'lnr'*
+'langnoremap' 'lnr' boolean (default off)
+ global
+ {not in Vi}
+ {only available when compiled with the |+langmap|
+ feature}
+ When on, setting 'langmap' does not apply to characters resulting from
+ a mapping. This basically means, if you noticed that setting
+ 'langmap' disables some of your mappings, try setting this option.
+ This option defaults to off for backwards compatibility. Set it on if
+ that works for you to avoid mappings to break.
+
*'laststatus'* *'ls'*
'laststatus' 'ls' number (default 1)
global
@@ -5732,6 +5754,10 @@ A jump table for the options with a short description can be found at |Q_op|.
Note that when using the NFA engine and the pattern contains something
that is not supported the pattern will not match. This is only useful
for debugging the regexp engine.
+ Using automatic selection enables Vim to switch the engine, if the
+ default engine becomes too costly. E.g., when the NFA engine uses too
+ many states. This should prevent Vim from hanging on a combination of
+ a complex pattern with long text.
*'relativenumber'* *'rnu'* *'norelativenumber'* *'nornu'*
'relativenumber' 'rnu' boolean (default off)
@@ -5765,6 +5791,77 @@ A jump table for the options with a short description can be found at |Q_op|.
this option at the default "on". Only switch it off when working with
old Vi scripts.
+ *'renderoptions'* *'rop'*
+'renderoptions' 'rop' string (default: empty)
+ global
+ {not in Vi}
+ {only available when compiled with GUI and DIRECTX on
+ MS-Windows}
+ Select a text renderer and set its options. The options depend on the
+ renderer.
+
+ Syntax: >
+ set rop=type:{renderer}(,{name}:{value})*
+<
+ Currently, only one optional renderer is available.
+
+ render behavior ~
+ directx Vim will draw text using DirectX (DirectWrite). It makes
+ drawn glyphs more beautiful than default GDI.
+ It requires 'encoding' is "utf-8", and only works on
+ MS-Windows Vista or newer version.
+
+ Options:
+ name meaning type value ~
+ gamma gamma float 1.0 - 2.2 (maybe)
+ contrast enhancedContrast float (unknown)
+ level clearTypeLevel float (unknown)
+ geom pixelGeometry int 0 - 2 (see below)
+ renmode renderingMode int 0 - 6 (see below)
+ taamode textAntialiasMode int 0 - 3 (see below)
+
+ See this URL for detail:
+ http://msdn.microsoft.com/en-us/library/dd368190.aspx
+
+ For geom: structure of a device pixel.
+ 0 - DWRITE_PIXEL_GEOMETRY_FLAT
+ 1 - DWRITE_PIXEL_GEOMETRY_RGB
+ 2 - DWRITE_PIXEL_GEOMETRY_BGR
+
+ See this URL for detail:
+ http://msdn.microsoft.com/en-us/library/dd368114.aspx
+
+ For renmode: method of rendering glyphs.
+ 0 - DWRITE_RENDERING_MODE_DEFAULT
+ 1 - DWRITE_RENDERING_MODE_ALIASED
+ 2 - DWRITE_RENDERING_MODE_GDI_CLASSIC
+ 3 - DWRITE_RENDERING_MODE_GDI_NATURAL
+ 4 - DWRITE_RENDERING_MODE_NATURAL
+ 5 - DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC
+ 6 - DWRITE_RENDERING_MODE_OUTLINE
+
+ See this URL for detail:
+ http://msdn.microsoft.com/en-us/library/dd368118.aspx
+
+ For taamode: antialiasing mode used for drawing text.
+ 0 - D2D1_TEXT_ANTIALIAS_MODE_DEFAULT
+ 1 - D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE
+ 2 - D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE
+ 3 - D2D1_TEXT_ANTIALIAS_MODE_ALIASED
+
+ See this URL for detail:
+ http://msdn.microsoft.com/en-us/library/dd368170.aspx
+
+ Example: >
+ set encoding=utf-8
+ set gfn=Ricty_Diminished:h12:cSHIFTJIS
+ set rop=type:directx
+<
+ If select a raster font (Courier, Terminal or FixedSys) to
+ 'guifont', it fallbacks to be drawn by GDI automatically.
+
+ Other render types are currently not supported.
+
*'report'*
'report' number (default 2)
global
diff --git a/runtime/doc/spell.txt b/runtime/doc/spell.txt
index 3ffd893..e1cc6a5 100644
--- a/runtime/doc/spell.txt
+++ b/runtime/doc/spell.txt
@@ -1058,6 +1058,9 @@ this text to start with a "#" so that mistakes don't go unnoticed. Example:
SFX F 0 in [^i]n # Spion > Spionin ~
SFX F 0 nen in # Bauerin > Bauerinnen ~
+However, to avoid lots of errors in affix files written for Myspell, you can
+add the IGNOREEXTRA flag.
+
Apparently Myspell allows an affix name to appear more than once. Since this
might also be a mistake, Vim checks for an extra "S". The affix files for
Myspell that use this feature apparently have this flag. Example:
@@ -1111,6 +1114,14 @@ Specifically, the affix flags can be used for:
- CIRCUMFIX, as explained just below.
+IGNOREEXTRA *spell-IGNOREEXTRA*
+
+Normally Vim gives an error for an extra field that does not start with '#'.
+This avoids errors going unnoticed. However, some files created for Myspell
+or Hunspell may contain many entries with an extra field. Use the IGNOREEXTRA
+flag to avoid lots of errors.
+
+
CIRCUMFIX *spell-CIRCUMFIX*
The CIRCUMFIX flag means a prefix and suffix must be added at the same time.
diff --git a/runtime/doc/tabpage.txt b/runtime/doc/tabpage.txt
index 3c7ad9f..b795dbe 100644
--- a/runtime/doc/tabpage.txt
+++ b/runtime/doc/tabpage.txt
@@ -61,16 +61,25 @@ In the GUI tab pages line you can use the right mouse button to open menu.
:[count]tabe[dit] *:tabe* *:tabedit* *:tabnew*
:[count]tabnew
Open a new tab page with an empty window, after the current
- tab page. For [count] see |:tab| below.
+ tab page. If [count] is given the new tab page appears after
+ the tab page [count] otherwise the new tab page will appear
+ after the current one. >
+ :tabnew " opens tabpage after the current one
+ :.tabnew " as above
+ :+tabnew " opens tabpage after the next tab page
+ " note: it is one further than :tabnew
+ :-tabnew " opens tabpage before the current one
+ :0tabnew " opens tabpage before the first one
+ :$tabnew " opens tabpage after the last one
:[count]tabe[dit] [++opt] [+cmd] {file}
:[count]tabnew [++opt] [+cmd] {file}
Open a new tab page and edit {file}, like with |:edit|.
- For [count] see |:tab| below.
+ For [count] see |:tabnew| above.
:[count]tabf[ind] [++opt] [+cmd] {file} *:tabf* *:tabfind*
Open a new tab page and edit {file} in 'path', like with
- |:find|. For [count] see |:tab| below.
+ |:find|. For [count] see |:tabnew| above.
{not available when the |+file_in_path| feature was disabled
at compile time}
@@ -110,12 +119,18 @@ something else.
- When 'hidden' is not set, [!] is not used, a buffer has
changes, and there is no other window on this buffer.
Changes to the buffer are not written and won't get lost, so
- this is a "safe" command.
+ this is a "safe" command. >
+ :tabclose " close the current tab page
+:{count}tabc[lose][!]
:tabc[lose][!] {count}
Close tab page {count}. Fails in the same way as `:tabclose`
- above.
-
+ above. >
+ :-tabclose " close the previous tab page
+ :+tabclose " close the next tab page
+ :1tabclose " close the first tab page
+ :$tabclose " close the last tab page
+<
*:tabo* *:tabonly*
:tabo[nly][!] Close all other tab pages.
When the 'hidden' option is set, all buffers in closed windows
@@ -124,7 +139,17 @@ something else.
modified buffers are written. Otherwise, windows that have
buffers that are modified are not removed, unless the [!] is
given, then they become hidden. But modified buffers are
- never abandoned, so changes cannot get lost.
+ never abandoned, so changes cannot get lost. >
+ :tabonly " close all tab pages except the current
+
+:{count}tabo[nly][!]
+ Close all tab pages except the {count}th one. >
+ :.tabonly " one
+ :-tabonly " close all tab pages except the previous
+ " one
+ :+tabonly " close all tab pages except the next one
+ :1tabonly " close all tab pages except the first one
+ :$tabonly " close all tab pages except the last one
SWITCHING TO ANOTHER TAB PAGE:
@@ -176,7 +201,15 @@ REORDERING TAB PAGES:
:[N]tabm[ove]
Move the current tab page to after tab page N. Use zero to
make the current tab page the first one. Without N the tab
- page is made the last one.
+ page is made the last one. >
+ :-tabmove " move the tab page to the left
+ :tabmove " move the tab page to the right
+ :.tabmove " as above
+ :+tabmove " as above
+ :0tabmove " move the tab page to the begining of the tab
+ " list
+ :$tabmove " move the tab page to the end of the tab list
+<
:tabm[ove] +[N]
:tabm[ove] -[N]
diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt
index 2bdfeeb..ddc0afd 100644
--- a/runtime/doc/various.txt
+++ b/runtime/doc/various.txt
@@ -337,6 +337,7 @@ N *+dialog_con* Support for |:confirm| with console dialog.
N *+dialog_con_gui* Support for |:confirm| with GUI and console dialog.
N *+diff* |vimdiff| and 'diff'
N *+digraphs* |digraphs| *E196*
+m *+directx* Win32 GUI only: DirectX and |'renderoptions'|
*+dnd* Support for DnD into the "~ register |quote_~|.
B *+emacs_tags* |emacs-tags| files
N *+eval* expression evaluation |eval.txt|
diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt
index 4ba28a3..56cb05c 100644
--- a/runtime/doc/windows.txt
+++ b/runtime/doc/windows.txt
@@ -263,28 +263,56 @@ left of the Vim window.
Closing a window
----------------
+:q[uit]
+:{count}q[uit]
CTRL-W q *CTRL-W_q*
CTRL-W CTRL-Q *CTRL-W_CTRL-Q*
-:q[uit] Quit current window. When quitting the last window (not
- counting a help window), exit Vim.
- When 'hidden' is set, and there is only one window for the
- current buffer, it becomes hidden.
- When 'hidden' is not set, and there is only one window for the
- current buffer, and the buffer was changed, the command fails.
- (Note: CTRL-Q does not work on all terminals)
-
-:q[uit]! Quit current window. If this was the last window for a buffer,
- any changes to that buffer are lost. When quitting the last
- window (not counting help windows), exit Vim. The contents of
- the buffer are lost, even when 'hidden' is set.
+ Without {count}: Quit the current window. If {count} is
+ given quit the {count} window.
+ When quitting the last window (not counting a help window),
+ exit Vim.
+
+ When 'hidden' is set, and there is only one window for the
+ current buffer, it becomes hidden. When 'hidden' is not set,
+ and there is only one window for the current buffer, and the
+ buffer was changed, the command fails.
+
+ (Note: CTRL-Q does not
+ work on all terminals). If [count] is greater than
+ the last window number the last window will be closed: >
+ :1quit " quit the first window
+ :$quit " quit the last window
+ :9quit " quit the last window
+ " if there are less than 9 windows opened
+ :-quit " quit the previews window
+ :+quit " quit the next window
+ :+2quit " will also work as expected
+<
+:q[uit]!
+:{count}q[uit]!
+ Without {count}: Quit the current window. If {count} is
+ given quit the {count} window.
+
+ If this was the last window for a buffer, any changes to that
+ buffer are lost. When quitting the last window (not counting
+ help windows), exit Vim. The contents of the buffer are lost,
+ even when 'hidden' is set.
+
+:clo[se][!]
+:{count}clo[se][!]
CTRL-W c *CTRL-W_c* *:clo* *:close*
-:clo[se][!] Close current window. When the 'hidden' option is set, or
- when the buffer was changed and the [!] is used, the buffer
- becomes hidden (unless there is another window editing it).
+ Without {count}: Close the current window. If {count} is
+ given close the {count} window.
+
+ When the 'hidden' option is set, or when the buffer was
+ changed and the [!] is used, the buffer becomes hidden (unless
+ there is another window editing it).
+
When there is only one window in the current tab page and
there is another tab page, this closes the current tab page.
|tab-page|.
+
This command fails when: *E444*
- There is only one window on the screen.
- When 'hidden' is not set, [!] is not used, the buffer has
@@ -298,14 +326,19 @@ CTRL-W CTRL-C *CTRL-W_CTRL-C*
command.
*:hide*
-:hid[e] Quit current window, unless it is the last window on the
- screen. The buffer becomes hidden (unless there is another
- window editing it or 'bufhidden' is "unload" or "delete").
- If the window is the last one in the current tab page the tab
- page is closed. |tab-page|
- The value of 'hidden' is irrelevant for this command.
- Changes to the buffer are not written and won't get lost, so
- this is a "safe" command.
+:hid[e]
+:{count}hid[e]
+ Quit the current window, unless it is the last window on the
+ screen. For {count} see |:quit| command.
+
+ The buffer becomes hidden (unless there is another window
+ editing it or 'bufhidden' is "unload" or "delete"). If the
+ window is the last one in the current tab page the tab page is
+ closed. |tab-page|
+
+ The value of 'hidden' is irrelevant for this command. Changes
+ to the buffer are not written and won't get lost, so this is a
+ "safe" command.
:hid[e] {cmd} Execute {cmd} with 'hidden' is set. The previous value of
'hidden' is restored after {cmd} has been executed.
@@ -314,12 +347,16 @@ CTRL-W CTRL-C *CTRL-W_CTRL-C*
< This will edit "Makefile", and hide the current buffer if it
has any changes.
+:on[ly][!]
+:{count}on[ly][!]
CTRL-W o *CTRL-W_o* *E445*
CTRL-W CTRL-O *CTRL-W_CTRL-O* *:on* *:only*
-:on[ly][!] Make the current window the only one on the screen. All other
- windows are closed.
+ Make the current window the only one on the screen. All other
+ windows are closed. For {count} see |:quit| command.
+
When the 'hidden' option is set, all buffers in closed windows
become hidden.
+
When 'hidden' is not set, and the 'autowrite' option is set,
modified buffers are written. Otherwise, windows that have
buffers that are modified are not removed, unless the [!] is
@@ -989,7 +1026,11 @@ list of buffers. |unlisted-buffer|
Actually, the buffer isn't completely deleted, it is removed
from the buffer list |unlisted-buffer| and option values,
variables and mappings/abbreviations for the buffer are
- cleared.
+ cleared. Examples: >
+ :.,$-bdelete " delete buffers from the current one to
+ " last but one
+ :%bdelete " delete all buffers
+<
:bdelete[!] {bufname} *E93* *E94*
Like ":bdelete[!] [N]", but buffer given by name. Note that a
@@ -1013,7 +1054,11 @@ list of buffers. |unlisted-buffer|
Like |:bdelete|, but really delete the buffer. Everything
related to the buffer is lost. All marks in this buffer
become invalid, option settings are lost, etc. Don't use this
- unless you know what you are doing.
+ unless you know what you are doing. Examples: >
+ :.+,$bwipeout " wipe out all buffers after the current
+ " one
+ :%bwipeout " wipe out all buffers
+<
:[N]bun[load][!] *:bun* *:bunload* *E515*
:bun[load][!] [N]
@@ -1042,36 +1087,41 @@ list of buffers. |unlisted-buffer|
a number). Insert a backslash before a space in a buffer
name.
-:[N]b[uffer][!] [N] *:b* *:bu* *:buf* *:buffer* *E86*
+:[N]b[uffer][!] [+cmd] [N] *:b* *:bu* *:buf* *:buffer* *E86*
Edit buffer [N] from the buffer list. If [N] is not given,
the current buffer remains being edited. See |:buffer-!| for
[!]. This will also edit a buffer that is not in the buffer
list, without setting the 'buflisted' flag.
+ Also see ||+cmd|.
-:[N]b[uffer][!] {bufname}
+:[N]b[uffer][!] [+cmd] {bufname}
Edit buffer for {bufname} from the buffer list. See
|:buffer-!| for [!]. This will also edit a buffer that is not
in the buffer list, without setting the 'buflisted' flag.
+ Also see ||+cmd|.
-:[N]sb[uffer] [N] *:sb* *:sbuffer*
+:[N]sb[uffer] [+cmd] [N] *:sb* *:sbuffer*
Split window and edit buffer [N] from the buffer list. If [N]
is not given, the current buffer is edited. Respects the
"useopen" setting of 'switchbuf' when splitting. This will
also edit a buffer that is not in the buffer list, without
setting the 'buflisted' flag.
+ Also see ||+cmd|.
-:[N]sb[uffer] {bufname}
+:[N]sb[uffer] [+cmd] {bufname}
Split window and edit buffer for {bufname} from the buffer
list. This will also edit a buffer that is not in the buffer
list, without setting the 'buflisted' flag.
Note: If what you want to do is split the buffer, make a copy
under another name, you can do it this way: >
:w foobar | sp #
+< Also see ||+cmd|.
-:[N]bn[ext][!] [N] *:bn* *:bnext* *E87*
+:[N]bn[ext][!] [+cmd] [N] *:bn* *:bnext* *E87*
Go to [N]th next buffer in buffer list. [N] defaults to one.
Wraps around the end of the buffer list.
See |:buffer-!| for [!].
+ Also see ||+cmd|.
If you are in a help buffer, this takes you to the next help
buffer (if there is one). Similarly, if you are in a normal
(non-help) buffer, this takes you to the next normal buffer.
@@ -1079,55 +1129,61 @@ list of buffers. |unlisted-buffer|
the way when you're browsing code/text buffers. The next three
commands also work like this.
+
*:sbn* *:sbnext*
-:[N]sbn[ext] [N]
+:[N]sbn[ext] [+cmd] [N]
Split window and go to [N]th next buffer in buffer list.
Wraps around the end of the buffer list. Uses 'switchbuf'
+ Also see ||+cmd|.
-:[N]bN[ext][!] [N] *:bN* *:bNext* *:bp* *:bprevious* *E88*
-:[N]bp[revious][!] [N]
+:[N]bN[ext][!] [+cmd] [N] *:bN* *:bNext* *:bp* *:bprevious* *E88*
+:[N]bp[revious][!] [+cmd] [N]
Go to [N]th previous buffer in buffer list. [N] defaults to
one. Wraps around the start of the buffer list.
See |:buffer-!| for [!] and 'switchbuf'.
+ Also see ||+cmd|.
-:[N]sbN[ext] [N] *:sbN* *:sbNext* *:sbp* *:sbprevious*
-:[N]sbp[revious] [N]
+:[N]sbN[ext] [+cmd] [N] *:sbN* *:sbNext* *:sbp* *:sbprevious*
+:[N]sbp[revious] [+cmd] [N]
Split window and go to [N]th previous buffer in buffer list.
Wraps around the start of the buffer list.
Uses 'switchbuf'.
+ Also see ||+cmd|.
- *:br* *:brewind*
-:br[ewind][!] Go to first buffer in buffer list. If the buffer list is
+:br[ewind][!] [+cmd] *:br* *:brewind*
+ Go to first buffer in buffer list. If the buffer list is
empty, go to the first unlisted buffer.
See |:buffer-!| for [!].
- *:bf* *:bfirst*
-:bf[irst] Same as ":brewind".
+:bf[irst] [+cmd] *:bf* *:bfirst*
+ Same as |:brewind|.
+ Also see |+cmd|.
- *:sbr* *:sbrewind*
-:sbr[ewind] Split window and go to first buffer in buffer list. If the
+:sbr[ewind] [+cmd] *:sbr* *:sbrewind*
+ Split window and go to first buffer in buffer list. If the
buffer list is empty, go to the first unlisted buffer.
Respects the 'switchbuf' option.
+ Also see |+cmd|.
- *:sbf* *:sbfirst*
-:sbf[irst] Same as ":sbrewind".
+:sbf[irst] [+cmd] *:sbf* *:sbfirst*
+ Same as ":sbrewind".
- *:bl* *:blast*
-:bl[ast][!] Go to last buffer in buffer list. If the buffer list is
+:bl[ast][!] [+cmd] *:bl* *:blast*
+ Go to last buffer in buffer list. If the buffer list is
empty, go to the last unlisted buffer.
See |:buffer-!| for [!].
- *:sbl* *:sblast*
-:sbl[ast] Split window and go to last buffer in buffer list. If the
+:sbl[ast] [+cmd] *:sbl* *:sblast*
+ Split window and go to last buffer in buffer list. If the
buffer list is empty, go to the last unlisted buffer.
Respects 'switchbuf' option.
-:[N]bm[odified][!] [N] *:bm* *:bmodified* *E84*
+:[N]bm[odified][!] [+cmd] [N] *:bm* *:bmodified* *E84*
Go to [N]th next modified buffer. Note: this command also
finds unlisted buffers. If there is no modified buffer the
command fails.
-:[N]sbm[odified] [N] *:sbm* *:sbmodified*
+:[N]sbm[odified] [+cmd] [N] *:sbm* *:sbmodified*
Split window and go to [N]th next modified buffer.
Respects 'switchbuf' option.
Note: this command also finds buffers not in the buffer list.
diff --git a/runtime/plugin/matchparen.vim b/runtime/plugin/matchparen.vim
index 817ce62..a511204 100644
--- a/runtime/plugin/matchparen.vim
+++ b/runtime/plugin/matchparen.vim
@@ -1,6 +1,6 @@
" Vim plugin for showing matching parens
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2014 Jul 19
+" Last Change: 2014 Jun 17
" Exit quickly when:
" - this plugin was already loaded (or disabled)
@@ -54,15 +54,14 @@ function! s:Highlight_Matching_Pair()
let c_col = col('.')
let before = 0
- let text = getline(c_lnum)
- let c = text[c_col - 1]
+ let c = getline(c_lnum)[c_col - 1]
let plist = split(&matchpairs, '.\zs[:,]')
let i = index(plist, c)
if i < 0
" not found, in Insert mode try character before the cursor
if c_col > 1 && (mode() == 'i' || mode() == 'R')
let before = 1
- let c = text[c_col - 2]
+ let c = getline(c_lnum)[c_col - 2]
let i = index(plist, c)
endif
if i < 0
@@ -98,10 +97,17 @@ function! s:Highlight_Matching_Pair()
call cursor(c_lnum, c_col - before)
endif
- " When not in a string or comment ignore matches inside them.
+ " Build an expression that detects whether the current cursor position is in
+ " certain syntax types (string, comment, etc.), for use as searchpairpos()'s
+ " skip argument.
" We match "escape" for special items, such as lispEscapeSpecial.
- let s_skip ='synIDattr(synID(line("."), col("."), 0), "name") ' .
- \ '=~? "string\\|character\\|singlequote\\|escape\\|comment"'
+ let s_skip = '!empty(filter(map(synstack(line("."), col(".")), ''synIDattr(v:val, "name")''), ' .
+ \ '''v:val =~? "string\\|character\\|singlequote\\|escape\\|comment"''))'
+ " If executing the expression determines that the cursor is currently in
+ " one of the syntax types, then we want searchpairpos() to find the pair
+ " within those syntax types (i.e., not skip). Otherwise, the cursor is
+ " outside of the syntax types and s_skip should keep its value so we skip any
+ " matching pair inside the syntax types.
execute 'if' s_skip '| let s_skip = 0 | endif'
" Limit the search to lines visible in the window.
@@ -154,11 +160,7 @@ function! s:Highlight_Matching_Pair()
endtry
if before > 0
- if has_getcurpos
- call setpos('.', save_cursor)
- else
- call winrestview(save_cursor)
- endif
+ call winrestview(save_cursor)
endif
" If a match is found setup match highlighting.
diff --git a/runtime/vimrc_example.vim b/runtime/vimrc_example.vim
index 27a5cfc..215fd24 100644
--- a/runtime/vimrc_example.vim
+++ b/runtime/vimrc_example.vim
@@ -1,7 +1,7 @@
" An example for a vimrc file.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last change: 2014 Feb 05
+" Last change: 2014 Nov 05
"
" To use it, copy it to
" for Unix and OS/2: ~/.vimrc
@@ -95,3 +95,10 @@ if !exists(":DiffOrig")
command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis
\ | wincmd p | diffthis
endif
+
+if has('langmap') && exists('+langnoremap')
+ " Prevent that the langmap option applies to characters that result from a
+ " mapping. If unset (default), this may break plugins (but it's backward
+ " compatible).
+ set langnoremap
+endif
diff --git a/src/INSTALLpc.txt b/src/INSTALLpc.txt
index 7ba2801..24fb4f0 100644
--- a/src/INSTALLpc.txt
+++ b/src/INSTALLpc.txt
@@ -192,6 +192,30 @@ To set the environment execute the msvc2010.bat script. You can then build
Vim with Make_mvc.mak.
+Targeting Windows XP with new MSVC *new-msvc-windows-xp*
+----------------------------------
+
+Beginning with Visual C++ 2010, Microsoft changed the behavior of LINK.EXE
+so that it targets Windows 6.0 (Vista) by default. In order to override
+this, the target Windows version number needs to be passed to LINK like
+follows:
+ LINK ... /subsystem:console,5.01
+
+Make_mvc.mak now supports a macro SUBSYSTEM_VER to pass the Windows version.
+Use lines like follows to target Windows XP (assuming using Visual C++ 2012
+under 64-bit Windows):
+ set WinSdk71=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1A
+ set SDK_INCLUDE_DIR=%WinSdk71%\Include
+ set INCLUDE=%WinSdk71%\Include;%INCLUDE%
+ set LIB=%WinSdk71%\Lib;%LIB%
+ set PATH=%WinSdk71%\Bin;%PATH%
+ set CL=/D_USING_V110_SDK71_
+ nmake -f Make_mvc.mak ... WINVER=0x0501 SUBSYSTEM_VER=5.01
+
+The following Visual C++ team blog can serve as a reference page:
+ http://blogs.msdn.com/b/vcblog/archive/2012/10/08/windows-xp-targeting-with-c-in-visual-studio-2012.aspx
+
+
2. MinGW
========
@@ -204,11 +228,15 @@ at:
http://www.mingw.org/
+or you can use 'MinGW-w64' compiler.
+
+ http://mingw-w64.sourceforge.net/
+
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:\MinGW\bin;%PATH%
or on NT/2000/XP, go to the Control Panel, (Performance and Maintenance),
System, Advanced, and edit the environment from there.
@@ -216,10 +244,10 @@ System, Advanced, and edit the environment from there.
Test if gcc is on your path. From a CMD (or COMMAND on '95/98) window:
C:\> gcc --version
- 2.95.2
+ gcc (GCC) 4.8.1
- C:\> make --version
- GNU Make version 3.77 (...etc...)
+ C:\> mingw32-make --version
+ GNU Make 3.82.90 (...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).
@@ -231,7 +259,7 @@ Change directory to 'vim\src':
and you type:
- make -f Make_ming.mak gvim.exe
+ mingw32-make -f Make_ming.mak gvim.exe
After churning for a while, you will end up with 'gvim.exe' in the 'vim\src'
directory.
@@ -240,7 +268,7 @@ You should not need to do *any* editing of any files to get vim compiled this
way. If, for some reason, you want the console-mode-only version of vim (this
is NOT recommended on Win32, especially on '95/'98!!!), you can use:
- make -f Make_ming.mak GUI=no vim.exe
+ mingw32-make -f Make_ming.mak GUI=no vim.exe
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
@@ -267,8 +295,7 @@ You need to uncomment lines in Make_ming.mak to have NLS defined.
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
+With Cygnus gcc you should use the Unix Makefile instead (you need to get the
Unix archive then). Then you get a Cygwin application (feels like Vim is
running on Unix), while with Make_cyg.mak you get a Windows application (like
with the other makefiles).
@@ -292,9 +319,9 @@ your Linux (or other unix) box. To do this, you need to follow a few steps:
http://www.mingw.org/wiki/LinuxCrossMinGW
http://www.libsdl.org/extras/win32/cross/README.txt
2) Get and unpack both the Unix sources and the extra archive
- 3) in 'Make_ming.mak', set 'CROSS' to 'yes' instead of 'no'.
- Make further changes to 'Make_ming.mak' as you wish.
- If your cross-compiler prefix differs from the predefined value,
+ 3) in 'Make_cyg_ming.mak', set 'CROSS' to 'yes' instead of 'no'.
+ Make further changes to 'Make_cyg_ming.mak' and 'Make_ming.mak' as you
+ wish. If your cross-compiler prefix differs from the predefined value,
set 'CROSS_COMPILE' corresponding.
4) make -f Make_ming.mak gvim.exe
diff --git a/src/MacVim/MMWindowController.m b/src/MacVim/MMWindowController.m
index b6c6786..9841c33 100644
--- a/src/MacVim/MMWindowController.m
+++ b/src/MacVim/MMWindowController.m
@@ -1131,7 +1131,7 @@
// (There is a small delay before window is maximized but usually this is
// not noticeable on a relatively modern Mac.)
[NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) {
- [context setDuration:0.5*duration];
+ [context setDuration:duration];
[[window animator] setAlphaValue:0];
} completionHandler:^{
[window setStyleMask:([window styleMask] | NSFullScreenWindowMask)];
@@ -1140,7 +1140,7 @@
[self maximizeWindow:fullScreenOptions];
[NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) {
- [context setDuration:0.5*duration];
+ [context setDuration:duration];
[[window animator] setAlphaValue:1];
} completionHandler:^{
// Do nothing
diff --git a/src/Make_bc3.mak b/src/Make_bc3.mak
index 54c42ac..dea9e10 100644
--- a/src/Make_bc3.mak
+++ b/src/Make_bc3.mak
@@ -54,6 +54,8 @@ EXE_dependencies = \
blowfish.obj \
buffer.obj \
charset.obj \
+ crypt.obj \
+ crypt_zip.obj \
diff.obj \
digraph.obj \
edit.obj \
diff --git a/src/Make_bc5.mak b/src/Make_bc5.mak
index 5769bd6..2b759dc 100644
--- a/src/Make_bc5.mak
+++ b/src/Make_bc5.mak
@@ -580,6 +580,8 @@ vimobj = \
$(OBJDIR)\blowfish.obj \
$(OBJDIR)\buffer.obj \
$(OBJDIR)\charset.obj \
+ $(OBJDIR)\crypt.obj \
+ $(OBJDIR)\crypt_zip.obj \
$(OBJDIR)\diff.obj \
$(OBJDIR)\digraph.obj \
$(OBJDIR)\edit.obj \
diff --git a/src/Make_cyg.mak b/src/Make_cyg.mak
index f349798..828666c 100644
--- a/src/Make_cyg.mak
+++ b/src/Make_cyg.mak
@@ -1,710 +1,52 @@
#
-# Makefile for VIM on Win32, using Cygnus gcc
-# Last updated by Dan Sharp. Last Change: 2013 Dec 11
+# Makefile for VIM on Win32, using MinGW cross compiler on Cygwin
#
# Also read INSTALLpc.txt!
#
# This compiles Vim as a Windows application. If you want Vim to run as a
# Cygwin application use the Makefile (just like on Unix).
#
-# GUI no or yes: set to yes if you want the GUI version (yes)
-# PERL define to path to Perl dir to get Perl support (not defined)
-# PERL_VER define to version of Perl being used (56)
-# DYNAMIC_PERL no or yes: set to yes to load the Perl DLL dynamically (yes)
-# PYTHON define to path to Python dir to get PYTHON support (not defined)
-# PYTHON_VER define to version of Python being used (22)
-# DYNAMIC_PYTHON no or yes: use yes to load the Python DLL dynamically (yes)
-# PYTHON3 define to path to Python3 dir to get PYTHON3 support (not defined)
-# PYTHON3_VER define to version of Python3 being used (22)
-# DYNAMIC_PYTHON3 no or yes: use yes to load the Python3 DLL dynamically (yes)
-# TCL define to path to TCL dir to get TCL support (not defined)
-# TCL_VER define to version of TCL being used (83)
-# DYNAMIC_TCL no or yes: use yes to load the TCL DLL dynamically (yes)
-# RUBY define to path to Ruby dir to get Ruby support (not defined)
-# RUBY_VER define to version of Ruby being used (16)
-# RUBY_VER_LONG same, but in format with dot. (1.6)
-# You must set RUBY_VER_LONG when changing RUBY_VER.
-# You must set RUBY_API_VER version to RUBY_VER_LONG.
-# Don't set ruby API version to RUBY_VER like 191.
-# DYNAMIC_RUBY no or yes: use yes to load the Ruby DLL dynamically (yes)
-# MZSCHEME define to path to MzScheme dir to get MZSCHEME support (not defined)
-# MZSCHEME_VER define to version of MzScheme being used (209_000)
-# DYNAMIC_MZSCHEME no or yes: use yes to load the MzScheme DLLs dynamically (yes)
-# MZSCHEME_DLLS path to MzScheme DLLs (libmzgc and libmzsch), for "static" build.
-# MZSCHEME_USE_RACKET define to use "racket" instead of "mzsch".
-# LUA define to path to Lua dir to get Lua support (not defined)
-# LUA_VER define to version of Lua being used (51)
-# DYNAMIC_LUA no or yes: use yes to load the Lua DLL dynamically (yes)
-# GETTEXT no or yes: set to yes for dynamic gettext support (yes)
-# ICONV no or yes: set to yes for dynamic iconv support (yes)
-# MBYTE no or yes: set to yes to include multibyte support (yes)
-# IME no or yes: set to yes to include IME support (yes)
-# DYNAMIC_IME no or yes: set to yes to load imm32.dll dynamically (yes)
-# OLE no or yes: set to yes to make OLE gvim (no)
-# DEBUG no or yes: set to yes if you wish a DEBUGging build (no)
-# CPUNR No longer supported, use ARCH.
-# ARCH i386 through pentium4: select -march argument to compile with
-# (i386)
-# USEDLL no or yes: set to yes to use the Runtime library DLL (no)
-# For USEDLL=yes the cygwin1.dll is required to run Vim.
-# For "no" the mingw-gcc-g++ package or the mingw64-i686-gcc-g++
-# package is required to compile Vim. Or set CC to gcc-3 and add
-# -L/lib/w32api to EXTRA_LIBS.
-# POSTSCRIPT no or yes: set to yes for PostScript printing (no)
-# FEATURES TINY, SMALL, NORMAL, BIG or HUGE (BIG)
-# WINVER Lowest Win32 version to support. (0x0500)
-# CSCOPE no or yes: to include cscope interface support (yes)
-# OPTIMIZE SPACE, SPEED, or MAXSPEED: set optimization level (MAXSPEED)
-# NETBEANS no or yes: to include netbeans interface support (yes when GUI
-# is yes)
-# NBDEBUG no or yes: to include netbeans interface debugging support (no)
-# XPM define to path to XPM dir to get XPM image support (not defined)
-#>>>>> choose options:
-ifndef GUI
-GUI=yes
-endif
-
-ifndef FEATURES
-FEATURES = BIG
-endif
-
-ifndef GETTEXT
-GETTEXT = yes
-endif
-
-ifndef ICONV
-ICONV = yes
-endif
-
-ifndef MBYTE
-MBYTE = yes
-endif
-
-ifndef IME
-IME = yes
-endif
+# The old Make_cyg.mak (maintained by Dan Sharp et al.) was merged into
+# Make_cyg_ming.mak. Note: USEDLL option was removed.
+# This file contains Cygwin specific settings. Common settings are contained
+# in Make_cyg_ming.mak.
+#
+# Last updated by Ken Takata.
+# Last Change: 2014 Oct 21
-ifndef ARCH
-ARCH = i386
-endif
-ifndef WINVER
-WINVER = 0x0500
-endif
+# uncomment 'PERL' if you want a perl-enabled version
+#PERL=/cygdrive/c/perl
-ifndef CSCOPE
-CSCOPE = yes
-endif
+# uncomment 'LUA' if you want a Lua-enabled version
+#LUA=/cygdrive/c/lua
-ifndef NETBEANS
-ifeq ($(GUI),yes)
-NETBEANS = yes
-endif
-endif
+# uncomment 'MZSCHEME' if you want a MzScheme-enabled version
+#MZSCHEME=/cygdrive/d/plt
-ifndef OPTIMIZE
-OPTIMIZE = MAXSPEED
-endif
+# uncomment 'PYTHON' if you want a python-enabled version
+#PYTHON=/cygdrive/c/python20
+# uncomment 'PYTHON3' if you want a python3-enabled version
+#PYTHON3=/cygdrive/c/python31
-# Link against the shared version of libstdc++ by default. Set
-# STATIC_STDCPLUS to "yes" to link against static version instead.
-ifndef STATIC_STDCPLUS
-STATIC_STDCPLUS=no
-endif
+# uncomment 'TCL' if you want a Tcl-enabled version
+#TCL=/cygdrive/c/tcl
-### See feature.h for a list of optionals.
-### Any other defines can be included here.
+# uncomment 'RUBY' if you want a Ruby-enabled version
+#RUBY=/cygdribe/c/ruby
-DEFINES = -DWIN32 -DHAVE_PATHDEF -DFEAT_$(FEATURES) \
- -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER)
-ifeq ($(ARCH),x86-64)
-DEFINES+=-DMS_WIN64
-endif
-INCLUDES = -march=$(ARCH) -Iproto
-#>>>>> name of the compiler and linker, name of lib directory
-ifeq (yes, $(USEDLL))
-# CROSS_COMPILE is used for the gvimext DLL.
+# Use MinGW(-w64) cross compiler.
+# There are three MinGW packages in Cygwin:
+# 32-bit: mingw-gcc-g++ and mingw64-i686-gcc-g++
+# 64-bit: mingw64-x86_64-gcc-g++
+# You may also need to set 'ARCH' in Make_cyg_ming.mak.
CROSS_COMPILE = i686-pc-mingw32-
-CC = gcc
-RC = windres
-else
-# i686-pc-mingw32-gcc, i686-w64-mingw32-gcc or gcc-3 can be used.
-CROSS_COMPILE = i686-pc-mingw32-
-CC = $(CROSS_COMPILE)gcc
-RC = $(CROSS_COMPILE)windres
-endif
-
-##############################
-# DYNAMIC_PERL=yes and no both work
-##############################
-ifdef PERL
-DEFINES += -DFEAT_PERL
-INCLUDES += -I$(PERL)/lib/CORE
-EXTRA_OBJS += $(OUTDIR)/if_perl.o
-
-ifndef DYNAMIC_PERL
-DYNAMIC_PERL = yes
-endif
-
-ifndef PERL_VER
-PERL_VER = 56
-endif
-
-ifeq (yes, $(DYNAMIC_PERL))
-DEFINES += -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl$(PERL_VER).dll\"
-else
-EXTRA_LIBS += -L$(PERL)/lib/CORE -lperl$(PERL_VER)
-endif
-endif
-
-##############################
-# DYNAMIC_PYTHON=yes works.
-# DYNAMIC_PYTHON=no does not (unresolved externals on link).
-##############################
-ifdef PYTHON
-DEFINES += -DFEAT_PYTHON
-EXTRA_OBJS += $(OUTDIR)/if_python.o
-
-ifndef DYNAMIC_PYTHON
-DYNAMIC_PYTHON = yes
-endif
-
-ifndef PYTHON_VER
-PYTHON_VER = 22
-endif
-
-ifeq (yes, $(DYNAMIC_PYTHON))
-DEFINES += -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python$(PYTHON_VER).dll\"
-else
-EXTRA_LIBS += $(PYTHON)/libs/python$(PYTHON_VER).lib
-endif
-endif
-
-##############################
-# DYNAMIC_PYTHON3=yes works.
-# DYNAMIC_PYTHON3=no does not (unresolved externals on link).
-##############################
-ifdef PYTHON3
-DEFINES += -DFEAT_PYTHON3
-EXTRA_OBJS += $(OUTDIR)/if_python3.o
-
-ifndef DYNAMIC_PYTHON3
-DYNAMIC_PYTHON3 = yes
-endif
-
-ifndef PYTHON3_VER
-PYTHON3_VER = 31
-endif
-
-ifeq (yes, $(DYNAMIC_PYTHON3))
-DEFINES += -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"python$(PYTHON3_VER).dll\"
-else
-EXTRA_LIBS += $(PYTHON3)/libs/python$(PYTHON3_VER).lib
-endif
-endif
-
-##############################
-# DYNAMIC_RUBY=yes works.
-# DYNAMIC_RUBY=no does not (process exits).
-##############################
-ifdef RUBY
-
-ifndef DYNAMIC_RUBY
-DYNAMIC_RUBY=yes
-endif
-# Set default value
-ifndef RUBY_VER
-RUBY_VER = 16
-endif
-ifndef RUBY_VER_LONG
-RUBY_VER_LONG = 1.6
-endif
-ifndef RUBY_API_VER
-RUBY_API_VER = $(subst .,,$(RUBY_VER_LONG))
-endif
-
-ifndef RUBY_PLATFORM
-ifeq ($(RUBY_VER), 16)
-RUBY_PLATFORM = i586-mswin32
-else
-ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/i386-mingw32),)
-RUBY_PLATFORM = i386-mingw32
-else
-ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/x64-mingw32),)
-RUBY_PLATFORM = x64-mingw32
-else
-RUBY_PLATFORM = i386-mswin32
-endif
-endif
-endif
-endif
-
-ifndef RUBY_INSTALL_NAME
-ifeq ($(RUBY_VER), 16)
-RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_API_VER)
-else
-ifeq ($(ARCH),x86-64)
-RUBY_INSTALL_NAME = x64-msvcrt-ruby$(RUBY_API_VER)
-else
-RUBY_INSTALL_NAME = msvcrt-ruby$(RUBY_API_VER)
-endif
-endif
-endif
-
-ifeq (19, $(word 1,$(sort 19 $(RUBY_VER))))
-RUBY_19_OR_LATER = 1
-endif
-
-DEFINES += -DFEAT_RUBY
-ifneq ($(findstring w64-mingw32,$(CC)),)
-# A workaround for mingw-w64
-DEFINES += -DHAVE_STRUCT_TIMESPEC -DHAVE_STRUCT_TIMEZONE
-endif
-INCLUDES += -I$(RUBY)/lib/ruby/$(RUBY_VER_LONG)/$(RUBY_PLATFORM)
-ifdef RUBY_19_OR_LATER
-INCLUDES += -I$(RUBY)/include/ruby-$(RUBY_VER_LONG) -I$(RUBY)/include/ruby-$(RUBY_VER_LONG)/$(RUBY_PLATFORM)
-endif
-EXTRA_OBJS += $(OUTDIR)/if_ruby.o
-
-ifeq (yes, $(DYNAMIC_RUBY))
-DEFINES += -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\"
-DEFINES += -DDYNAMIC_RUBY_VER=$(RUBY_VER)
-else
-EXTRA_LIBS += $(RUBY)/lib/$(RUBY_INSTALL_NAME)
-endif
-endif
-
-##############################
-# DYNAMIC_MZSCHEME=yes works
-# DYNAMIC_MZSCHEME=no works too
-##############################
-ifdef MZSCHEME
-DEFINES += -DFEAT_MZSCHEME
-INCLUDES += -I$(MZSCHEME)/include
-EXTRA_OBJS += $(OUTDIR)/if_mzsch.o
-
-ifndef DYNAMIC_MZSCHEME
-DYNAMIC_MZSCHEME = yes
-endif
-
-ifndef MZSCHEME_VER
-MZSCHEME_VER = 209_000
-endif
-
-ifndef MZSCHEME_PRECISE_GC
-MZSCHEME_PRECISE_GC=no
-endif
-
-# for version 4.x we need to generate byte-code for Scheme base
-ifndef MZSCHEME_GENERATE_BASE
-MZSCHEME_GENERATE_BASE=no
-endif
-
-ifndef MZSCHEME_USE_RACKET
-MZSCHEME_MAIN_LIB=mzsch
-else
-MZSCHEME_MAIN_LIB=racket
-endif
-
-ifeq (yes, $(DYNAMIC_MZSCHEME))
-DEFINES += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
-else
-ifndef MZSCHEME_DLLS
-MZSCHEME_DLLS = $(MZSCHEME)
-endif
-ifeq (yes,$(MZSCHEME_PRECISE_GC))
-MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER)
-else
-MZSCHEME_LIB = -l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
-endif
-EXTRA_LIBS += -L$(MZSCHEME_DLLS) -L$(MZSCHEME_DLLS)/lib $(MZSCHEME_LIB)
-endif
-ifeq (yes,$(MZSCHEME_GENERATE_BASE))
-DEFINES += -DINCLUDE_MZSCHEME_BASE
-MZ_EXTRA_DEP += mzscheme_base.c
-endif
-ifeq (yes,$(MZSCHEME_PRECISE_GC))
-DEFINES += -DMZ_PRECISE_GC
-endif
-endif
-
-##############################
-# DYNAMIC_TCL=yes and no both work.
-##############################
-ifdef TCL
-DEFINES += -DFEAT_TCL
-INCLUDES += -I$(TCL)/include
-EXTRA_OBJS += $(OUTDIR)/if_tcl.o
-
-ifndef DYNAMIC_TCL
-DYNAMIC_TCL = yes
-endif
-
-ifndef TCL_VER
-TCL_VER = 83
-endif
-
-ifeq (yes, $(DYNAMIC_TCL))
-DEFINES += -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl$(TCL_VER).dll\"
-EXTRA_LIBS += $(TCL)/lib/tclstub$(TCL_VER).lib
-else
-EXTRA_LIBS += $(TCL)/lib/tcl$(TCL_VER).lib
-endif
-endif
-
-##############################
-# DYNAMIC_LUA=yes works.
-# DYNAMIC_LUA=no does not (unresolved externals on link).
-##############################
-ifdef LUA
-DEFINES += -DFEAT_LUA
-INCLUDES += -I$(LUA)/include
-EXTRA_OBJS += $(OUTDIR)/if_lua.o
-
-ifndef DYNAMIC_LUA
-DYNAMIC_LUA = yes
-endif
-
-ifndef LUA_VER
-LUA_VER = 51
-endif
-
-ifeq (yes, $(DYNAMIC_LUA))
-DEFINES += -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua$(LUA_VER).dll\"
-else
-EXTRA_LIBS += $(LUA)/lib/lua$(LUA_VER).lib
-endif
-endif
-
-##############################
-ifeq (yes, $(GETTEXT))
-DEFINES += -DDYNAMIC_GETTEXT
-endif
-
-##############################
-ifeq (yes, $(ICONV))
-DEFINES += -DDYNAMIC_ICONV
-endif
-
-##############################
-ifeq (yes, $(MBYTE))
-DEFINES += -DFEAT_MBYTE
-endif
-
-##############################
-ifeq (yes, $(IME))
-DEFINES += -DFEAT_MBYTE_IME
-
-ifndef DYNAMIC_IME
-DYNAMIC_IME = yes
-endif
-
-ifeq (yes, $(DYNAMIC_IME))
-DEFINES += -DDYNAMIC_IME
-else
-EXTRA_LIBS += -limm32
-endif
-endif
-
-##############################
-ifeq (yes, $(DEBUG))
-DEFINES += -DDEBUG
-INCLUDES += -g -fstack-check
-DEBUG_SUFFIX = d
-else
-
-ifeq ($(OPTIMIZE), SIZE)
-OPTFLAG = -Os
-else
-ifeq ($(OPTIMIZE), MAXSPEED)
-OPTFLAG = -O3 -fomit-frame-pointer -freg-struct-return
-else
-OPTFLAG = -O2
-endif
-endif
-
-# A bug in the GCC <= 3.2 optimizer can cause a crash. The
-# following option removes the problem optimization.
-OPTFLAG += -fno-strength-reduce
-
-INCLUDES += -s
-
-endif
-
-##############################
-# USEDLL=yes will build a Cygwin32 executable that relies on cygwin1.dll.
-# USEDLL=no will build a Mingw32 executable with no extra dll dependencies.
-##############################
-ifeq (yes, $(USEDLL))
-DEFINES += -D_MAX_PATH=256 -D__CYGWIN__
-endif
-
-##############################
-ifeq (yes, $(POSTSCRIPT))
-DEFINES += -DMSWINPS
-endif
-
-##############################
-ifeq (yes, $(CSCOPE))
-DEFINES += -DFEAT_CSCOPE
-EXTRA_OBJS += $(OUTDIR)/if_cscope.o
-endif
-
-##############################
-ifeq ($(GUI),yes)
-
-##############################
-ifeq (yes, $(NETBEANS))
-# Only allow NETBEANS for a GUI build.
-DEFINES += -DFEAT_NETBEANS_INTG
-EXTRA_OBJS += $(OUTDIR)/netbeans.o
-EXTRA_LIBS += -lwsock32
-
-ifeq (yes, $(NBDEBUG))
-DEFINES += -DNBDEBUG
-NBDEBUG_DEP = nbdebug.h nbdebug.c
-endif
-
-endif
-
-##############################
-ifdef XPM
-# Only allow XPM for a GUI build.
-DEFINES += -DFEAT_XPM_W32
-INCLUDES += -I$(XPM)/include
-EXTRA_OBJS += $(OUTDIR)/xpm_w32.o
-EXTRA_LIBS += -L$(XPM)/lib -lXpm
-endif
-
-##############################
-EXE = gvim$(DEBUG_SUFFIX).exe
-OUTDIR = gobj$(DEBUG_SUFFIX)
-DEFINES += -DFEAT_GUI_W32 -DFEAT_CLIPBOARD
-EXTRA_OBJS += $(OUTDIR)/gui.o $(OUTDIR)/gui_w32.o $(OUTDIR)/gui_beval.o $(OUTDIR)/os_w32exe.o
-EXTRA_LIBS += -mwindows -lcomctl32 -lversion
-else
-EXE = vim$(DEBUG_SUFFIX).exe
-OUTDIR = obj$(DEBUG_SUFFIX)
-LIBS += -luser32 -lgdi32 -lcomdlg32
-endif
-
-##############################
-ifeq (yes, $(OLE))
-DEFINES += -DFEAT_OLE
-EXTRA_OBJS += $(OUTDIR)/if_ole.o
-EXTRA_LIBS += -loleaut32
-ifeq (yes, $(STATIC_STDCPLUS))
-EXTRA_LIBS += -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
-else
-EXTRA_LIBS += -lstdc++
-endif
-endif
-
-##############################
-ifneq (sh.exe, $(SHELL))
-DEL = rm
-MKDIR = mkdir -p
-DIRSLASH = /
-else
-DEL = del
-MKDIR = mkdir
-DIRSLASH = \\
-endif
-
-#>>>>> end of choices
-###########################################################################
-
-INCL = vim.h globals.h option.h keymap.h macros.h ascii.h term.h os_win32.h \
- structs.h version.h
-
-CFLAGS = $(OPTFLAG) $(DEFINES) $(INCLUDES)
-
-RCFLAGS = -O coff $(DEFINES)
-
-OBJ = \
- $(OUTDIR)/blowfish.o \
- $(OUTDIR)/buffer.o \
- $(OUTDIR)/charset.o \
- $(OUTDIR)/diff.o \
- $(OUTDIR)/digraph.o \
- $(OUTDIR)/edit.o \
- $(OUTDIR)/eval.o \
- $(OUTDIR)/ex_cmds.o \
- $(OUTDIR)/ex_cmds2.o \
- $(OUTDIR)/ex_docmd.o \
- $(OUTDIR)/ex_eval.o \
- $(OUTDIR)/ex_getln.o \
- $(OUTDIR)/fileio.o \
- $(OUTDIR)/fold.o \
- $(OUTDIR)/getchar.o \
- $(OUTDIR)/hardcopy.o \
- $(OUTDIR)/hashtab.o \
- $(OUTDIR)/main.o \
- $(OUTDIR)/mark.o \
- $(OUTDIR)/memfile.o \
- $(OUTDIR)/memline.o \
- $(OUTDIR)/menu.o \
- $(OUTDIR)/message.o \
- $(OUTDIR)/misc1.o \
- $(OUTDIR)/misc2.o \
- $(OUTDIR)/move.o \
- $(OUTDIR)/mbyte.o \
- $(OUTDIR)/normal.o \
- $(OUTDIR)/ops.o \
- $(OUTDIR)/option.o \
- $(OUTDIR)/os_win32.o \
- $(OUTDIR)/os_mswin.o \
- $(OUTDIR)/winclip.o \
- $(OUTDIR)/pathdef.o \
- $(OUTDIR)/popupmnu.o \
- $(OUTDIR)/quickfix.o \
- $(OUTDIR)/regexp.o \
- $(OUTDIR)/screen.o \
- $(OUTDIR)/search.o \
- $(OUTDIR)/sha256.o \
- $(OUTDIR)/spell.o \
- $(OUTDIR)/syntax.o \
- $(OUTDIR)/tag.o \
- $(OUTDIR)/term.o \
- $(OUTDIR)/ui.o \
- $(OUTDIR)/undo.o \
- $(OUTDIR)/version.o \
- $(OUTDIR)/vimrc.o \
- $(OUTDIR)/window.o \
- $(EXTRA_OBJS)
-
-all: $(EXE) xxd/xxd.exe vimrun.exe install.exe uninstal.exe GvimExt/gvimext.dll
-
-# According to the Cygwin doc 1.2 FAQ, kernel32 should not be specified for
-# linking unless calling ld directly.
-# See /usr/doc/cygwin-doc-1.2/html/faq_toc.html#TOC93 for more information.
-$(EXE): $(OUTDIR) $(OBJ)
- $(CC) $(CFLAGS) -o $(EXE) $(OBJ) $(LIBS) -luuid -lole32 $(EXTRA_LIBS)
-
-xxd/xxd.exe: xxd/xxd.c
- $(MAKE) -C xxd -f Make_cyg.mak CC=$(CC) USEDLL=$(USEDLL)
-
-GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h
- $(MAKE) -C GvimExt -f Make_cyg.mak CROSS_COMPILE=$(CROSS_COMPILE)
-
-vimrun.exe: vimrun.c
- $(CC) $(CFLAGS) -o vimrun.exe vimrun.c $(LIBS)
-
-install.exe: dosinst.c
- $(CC) $(CFLAGS) -o install.exe dosinst.c $(LIBS) -luuid -lole32
-
-uninstal.exe: uninstal.c
- $(CC) $(CFLAGS) -o uninstal.exe uninstal.c $(LIBS)
-
-$(OUTDIR):
- $(MKDIR) $(OUTDIR)
-
-tags:
- command /c ctags *.c $(INCL)
-
-clean:
- -$(DEL) $(OUTDIR)$(DIRSLASH)*.o
- -rmdir $(OUTDIR)
- -$(DEL) $(EXE) vimrun.exe install.exe uninstal.exe
-ifdef PERL
- -$(DEL) if_perl.c
-endif
-ifdef MZSCHEME
- -$(DEL) mzscheme_base.c
-endif
- -$(DEL) pathdef.c
- $(MAKE) -C xxd -f Make_cyg.mak clean
- $(MAKE) -C GvimExt -f Make_cyg.mak clean
-
-distclean: clean
- -$(DEL) obj$(DIRSLASH)*.o
- -rmdir obj
- -$(DEL) gobj$(DIRSLASH)*.o
- -rmdir gobj
- -$(DEL) objd$(DIRSLASH)*.o
- -rmdir objd
- -$(DEL) gobjd$(DIRSLASH)*.o
- -rmdir gobjd
- -$(DEL) *.exe
-
-###########################################################################
-
-$(OUTDIR)/%.o : %.c $(INCL)
- $(CC) -c $(CFLAGS) $< -o $@
-
-$(OUTDIR)/ex_docmd.o: ex_docmd.c $(INCL) ex_cmds.h
- $(CC) -c $(CFLAGS) ex_docmd.c -o $(OUTDIR)/ex_docmd.o
-
-$(OUTDIR)/ex_eval.o: ex_eval.c $(INCL) ex_cmds.h
- $(CC) -c $(CFLAGS) ex_eval.c -o $(OUTDIR)/ex_eval.o
-
-$(OUTDIR)/gui_w32.o: gui_w32.c gui_w48.c $(INCL)
- $(CC) -c $(CFLAGS) gui_w32.c -o $(OUTDIR)/gui_w32.o
-
-$(OUTDIR)/if_cscope.o: if_cscope.c $(INCL) if_cscope.h
- $(CC) -c $(CFLAGS) if_cscope.c -o $(OUTDIR)/if_cscope.o
-
-$(OUTDIR)/if_ole.o: if_ole.cpp $(INCL)
- $(CC) -c $(CFLAGS) if_ole.cpp -o $(OUTDIR)/if_ole.o
-
-$(OUTDIR)/if_python.o : if_python.c if_py_both.h $(INCL)
- $(CC) -c $(CFLAGS) -I$(PYTHON)/include $< -o $@
-
-$(OUTDIR)/if_python3.o : if_python3.c if_py_both.h $(INCL)
- $(CC) -c $(CFLAGS) -I$(PYTHON3)/include $< -o $@
-
-if_perl.c: if_perl.xs typemap
- $(PERL)/bin/perl `cygpath -d $(PERL)/lib/ExtUtils/xsubpp` \
- -prototypes -typemap \
- `cygpath -d $(PERL)/lib/ExtUtils/typemap` if_perl.xs > $@
-
-$(OUTDIR)/if_perl.o: if_perl.c $(INCL)
-ifeq (yes, $(USEDLL))
- $(CC) -c $(CFLAGS) -I/usr/include/mingw -D__MINGW32__ if_perl.c -o $(OUTDIR)/if_perl.o
-endif
-
-$(OUTDIR)/if_ruby.o: if_ruby.c $(INCL)
-ifeq (16, $(RUBY_VER))
- $(CC) -c $(CFLAGS) -U_WIN32 if_ruby.c -o $(OUTDIR)/if_ruby.o
-endif
-
-$(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_DEP)
- $(CC) -c $(CFLAGS) netbeans.c -o $(OUTDIR)/netbeans.o
-
-$(OUTDIR)/regexp.o: regexp.c regexp_nfa.c $(INCL)
- $(CC) -c $(CFLAGS) regexp.c -o $(OUTDIR)/regexp.o
-
-$(OUTDIR)/if_mzsch.o: if_mzsch.c $(INCL) if_mzsch.h $(MZ_EXTRA_DEP)
- $(CC) -c $(CFLAGS) if_mzsch.c -o $(OUTDIR)/if_mzsch.o
-
-$(OUTDIR)/vimrc.o: vim.rc version.h gui_w32_rc.h
- $(RC) $(RCFLAGS) vim.rc -o $(OUTDIR)/vimrc.o
-
-mzscheme_base.c:
- $(MZSCHEME)/mzc --c-mods mzscheme_base.c ++lib scheme/base
+#CROSS_COMPILE = i686-w64-mingw32-
+#CROSS_COMPILE = x86_64-w64-mingw32-
-pathdef.c: $(INCL)
-ifneq (sh.exe, $(SHELL))
- @echo creating pathdef.c
- @echo '/* pathdef.c */' > pathdef.c
- @echo '#include "vim.h"' >> pathdef.c
- @echo 'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' >> pathdef.c
- @echo 'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' >> pathdef.c
- @echo 'char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)";' >> pathdef.c
- @echo 'char_u *all_lflags = (char_u *)"$(CC) -s -o $(EXE) $(LIBS) -luuid -lole32 $(EXTRA_LIBS)";' >> pathdef.c
- @echo 'char_u *compiled_user = (char_u *)"$(USERNAME)";' >> pathdef.c
- @echo 'char_u *compiled_sys = (char_u *)"$(USERDOMAIN)";' >> pathdef.c
-else
- @echo creating pathdef.c
- @echo /* pathdef.c */ > pathdef.c
- @echo #include "vim.h" >> pathdef.c
- @echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)"; >> pathdef.c
- @echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)"; >> pathdef.c
- @echo char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)"; >> pathdef.c
- @echo char_u *all_lflags = (char_u *)"$(CC) -s -o $(EXE) $(LIBS) -luuid -lole32 $(EXTRA_LIBS)"; >> pathdef.c
- @echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> pathdef.c
- @echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> pathdef.c
-endif
+# Do not change this.
+UNDER_CYGWIN = yes
+include Make_cyg_ming.mak
diff --git a/src/Make_dice.mak b/src/Make_dice.mak
index e3a8b9e..890f15d 100644
--- a/src/Make_dice.mak
+++ b/src/Make_dice.mak
@@ -29,6 +29,8 @@ SRC = \
blowfish.c \
buffer.c \
charset.c \
+ crypt.c \
+ crypt_zip.c \
diff.c \
digraph.c \
edit.c \
@@ -75,6 +77,8 @@ SRC = \
OBJ = o/blowfish.o \
o/buffer.o \
o/charset.o \
+ o/crypt.o \
+ o/crypt_zip.o \
o/diff.o \
o/digraph.o \
o/edit.o \
@@ -143,6 +147,10 @@ o/buffer.o: buffer.c $(SYMS)
o/charset.o: charset.c $(SYMS)
+o/crypt.o: crypt.c $(SYMS)
+
+o/crypt_zip.o: crypt_zip.c $(SYMS)
+
o/diff.o: diff.c $(SYMS)
o/digraph.o: digraph.c $(SYMS)
diff --git a/src/Make_djg.mak b/src/Make_djg.mak
index f2e7c82..1a92344 100644
--- a/src/Make_djg.mak
+++ b/src/Make_djg.mak
@@ -22,6 +22,8 @@ OBJ = \
obj/blowfish.o \
obj/buffer.o \
obj/charset.o \
+ obj/crypt.o \
+ obj/crypt_zip.o \
obj/diff.o \
obj/digraph.o \
obj/edit.o \
diff --git a/src/Make_ivc.mak b/src/Make_ivc.mak
index 16589ea..a891a97 100644
--- a/src/Make_ivc.mak
+++ b/src/Make_ivc.mak
@@ -213,6 +213,8 @@ LINK32_OBJS= \
"$(INTDIR)/blowfish.obj" \
"$(INTDIR)/buffer.obj" \
"$(INTDIR)/charset.obj" \
+ "$(INTDIR)/crypt.obj" \
+ "$(INTDIR)/crypt_zip.obj" \
"$(INTDIR)/diff.obj" \
"$(INTDIR)/digraph.obj" \
"$(INTDIR)/edit.obj" \
@@ -339,6 +341,14 @@ SOURCE=.\charset.c
# End Source File
# Begin Source File
+SOURCE=.\crypt.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\crypt_zip.c
+# End Source File
+# Begin Source File
+
SOURCE=.\diff.c
# End Source File
# Begin Source File
diff --git a/src/Make_manx.mak b/src/Make_manx.mak
index 101c5c6..6305cd3 100644
--- a/src/Make_manx.mak
+++ b/src/Make_manx.mak
@@ -37,6 +37,8 @@ DEL = $(SHELL) -c rm -f
SRC = blowfish.c \
buffer.c \
charset.c \
+ crypt.c \
+ crypt_zip.c \
diff.c \
digraph.c \
edit.c \
@@ -85,6 +87,8 @@ INCL = vim.h feature.h keymap.h macros.h ascii.h term.h structs.h os_amiga.h
OBJ = obj/blowfish.o \
obj/buffer.o \
obj/charset.o \
+ obj/crypt.o \
+ obj/crypt_zip.o \
obj/diff.o \
obj/digraph.o \
obj/edit.o \
@@ -131,6 +135,8 @@ OBJ = obj/blowfish.o \
PRO = proto/blowfish.pro \
proto/buffer.pro \
proto/charset.pro \
+ proto/crypt.pro \
+ proto/crypt_zip.pro \
proto/diff.pro \
proto/digraph.pro \
proto/edit.pro \
@@ -227,6 +233,12 @@ obj/buffer.o: buffer.c
obj/charset.o: charset.c
$(CCSYM) $@ charset.c
+obj/crypt.o: crypt.c
+ $(CCSYM) $@ crypt.c
+
+obj/crypt_zip.o: crypt_zip.c
+ $(CCSYM) $@ crypt_zip.c
+
obj/diff.o: diff.c
$(CCSYM) $@ diff.c
diff --git a/src/Make_ming.mak b/src/Make_ming.mak
index f7088ad..9ed1a70 100644
--- a/src/Make_ming.mak
+++ b/src/Make_ming.mak
@@ -1,191 +1,27 @@
-# Makefile for VIM on Win32
#
-# Info at http://www.mingw.org
-# Alternative x86 and 64-builds: http://mingw-w64.sourceforge.net
-# Also requires GNU make, which you can download from the same sites.
-# Get missing libraries from http://gnuwin32.sf.net.
+# Makefile for VIM on Win32, using MinGW
#
-# Tested on Win32 NT 4 and Win95.
+# Also read INSTALLpc.txt!
#
-# To make everything, just 'make -f Make_ming.mak'.
-# To make just e.g. gvim.exe, 'make -f Make_ming.mak gvim.exe'.
-# After a run, you can 'make -f Make_ming.mak clean' to clean up.
+# The old Make_ming.mak (maintained by Ron Aaron et al.) was merged into
+# Make_cyg_ming.mak.
+# This file contains MinGW specific settings. Common settings are contained
+# in Make_cyg_ming.mak.
#
-# NOTE: Sometimes 'GNU Make' will stop after building vimrun.exe -- I think
-# it's just run out of memory or something. Run again, and it will continue
-# with 'xxd'.
-#
-# "make upx" makes *compressed* versions of the 32 bit GUI and console EXEs,
-# using the excellent UPX compressor:
-# http://upx.sourceforge.net/
-# "make mpress" uses the MPRESS compressor for 32- and 64-bit EXEs:
-# http://www.matcode.com/mpress.htm
-#
-# Maintained by Ron Aaron <ronaharon@yahoo.com> et al.
-# Updated 2012 Sep 5.
-
-#>>>>> choose options:
-# set to yes for a debug build
-DEBUG=no
-# set to SIZE for size, SPEED for speed, MAXSPEED for maximum optimization
-OPTIMIZE=MAXSPEED
-# set to yes to make gvim, no for vim
-GUI=yes
-# FEATURES=[TINY | SMALL | NORMAL | BIG | HUGE]
-# Set to TINY to make minimal version (few features).
-FEATURES=BIG
-# Set to one of i386, i486, i586, i686 as the minimum target processor.
-# For amd64/x64 architecture set ARCH=x86-64 .
-ARCH=i386
-# Set to yes to cross-compile from unix; no=native Windows.
-CROSS=no
-# Set to path to iconv.h and libiconv.a to enable using 'iconv.dll'.
-#ICONV="."
-ICONV=yes
-GETTEXT=yes
-# Set to yes to include multibyte support.
-MBYTE=yes
-# Set to yes to include IME support.
-IME=yes
-DYNAMIC_IME=yes
-# Set to yes to enable writing a postscript file with :hardcopy.
-POSTSCRIPT=no
-# Set to yes to enable OLE support.
-OLE=no
-# Set the default $(WINVER) to make it work with pre-Win2k.
-ifndef WINVER
-WINVER = 0x0500
-endif
-# Set to yes to enable Cscope support.
-CSCOPE=yes
-# Set to yes to enable Netbeans support.
-NETBEANS=$(GUI)
-
-
-# Link against the shared version of libstdc++ by default. Set
-# STATIC_STDCPLUS to "yes" to link against static version instead.
-ifndef STATIC_STDCPLUS
-STATIC_STDCPLUS=no
-endif
-
-# If the user doesn't want gettext, undefine it.
-ifeq (no, $(GETTEXT))
-GETTEXT=
-endif
-# Added by E.F. Amatria <eferna1@platea.ptic.mec.es> 2001 Feb 23
-# Uncomment the first line and one of the following three if you want Native Language
-# Support. You'll need gnu_gettext.win32, a MINGW32 Windows PORT of gettext by
-# Franco Bez <franco.bez@gmx.de>. It may be found at
-# http://home.a-city.de/franco.bez/gettext/gettext_win32_en.html
-# Tested with mingw32 with GCC-2.95.2 on Win98
-# Updated 2001 Jun 9
-#GETTEXT=c:/gettext.win32.msvcrt
-#STATIC_GETTEXT=USE_STATIC_GETTEXT
-#DYNAMIC_GETTEXT=USE_GETTEXT_DLL
-#DYNAMIC_GETTEXT=USE_SAFE_GETTEXT_DLL
-SAFE_GETTEXT_DLL_OBJ = $(GETTEXT)/src/safe_gettext_dll/safe_gettext_dll.o
-# Alternatively, if you uncomment the two following lines, you get a "safe" version
-# without linking the safe_gettext_dll.o object file.
-#DYNAMIC_GETTEXT=DYNAMIC_GETTEXT
-#GETTEXT_DYNAMIC=gnu_gettext.dll
-INTLPATH=$(GETTEXT)/lib/mingw32
-INTLLIB=gnu_gettext
+# Last updated by Ken Takata.
+# Last Change: 2014 Oct 21
-# If you are using gettext-0.10.35 from http://sourceforge.net/projects/gettext
-# or gettext-0.10.37 from http://sourceforge.net/projects/mingwrep/
-# uncomment the following, but I can't build a static version with them, ?-(|
-#GETTEXT=c:/gettext-0.10.37-20010430
-#STATIC_GETTEXT=USE_STATIC_GETTEXT
-#DYNAMIC_GETTEXT=DYNAMIC_GETTEXT
-#INTLPATH=$(GETTEXT)/lib
-#INTLLIB=intl
# uncomment 'PERL' if you want a perl-enabled version
-#PERL=C:/perl
-ifdef PERL
-ifndef PERL_VER
-PERL_VER=56
-endif
-ifndef DYNAMIC_PERL
-DYNAMIC_PERL=yes
-endif
-# on Linux, for cross-compile, it's here:
-#PERLLIB=/home/ron/ActivePerl/lib
-# on NT, it's here:
-PERLLIB=$(PERL)/lib
-PERLLIBS=$(PERLLIB)/Core
-XSUBPPTRY=$(PERLLIB)/ExtUtils/xsubpp
-XSUBPP_EXISTS=$(shell perl -e "print 1 unless -e '$(XSUBPPTRY)'")
-ifeq "$(XSUBPP_EXISTS)" ""
-XSUBPP=perl $(XSUBPPTRY)
-else
-XSUBPP=xsubpp
-endif
-endif
+#PERL=c:/perl
# uncomment 'LUA' if you want a Lua-enabled version
-#LUA=/usr/local
-ifdef LUA
-ifndef DYNAMIC_LUA
-DYNAMIC_LUA=yes
-endif
-
-ifndef LUA_VER
-LUA_VER=51
-endif
-
-ifeq (no,$(DYNAMIC_LUA))
-LUA_LIB = -L$(LUA)/lib -llua
-endif
-
-endif
+#LUA=c:/lua
# uncomment 'MZSCHEME' if you want a MzScheme-enabled version
#MZSCHEME=d:/plt
-ifdef MZSCHEME
-ifndef DYNAMIC_MZSCHEME
-DYNAMIC_MZSCHEME=yes
-endif
-
-ifndef MZSCHEME_VER
-MZSCHEME_VER=205_000
-endif
-
-ifndef MZSCHEME_PRECISE_GC
-MZSCHEME_PRECISE_GC=no
-endif
-# for version 4.x we need to generate byte-code for Scheme base
-ifndef MZSCHEME_GENERATE_BASE
-MZSCHEME_GENERATE_BASE=no
-endif
-
-ifndef MZSCHEME_USE_RACKET
-MZSCHEME_MAIN_LIB=mzsch
-else
-MZSCHEME_MAIN_LIB=racket
-endif
-
-ifeq (no,$(DYNAMIC_MZSCHEME))
-ifeq (yes,$(MZSCHEME_PRECISE_GC))
-MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER)
-else
-MZSCHEME_LIB = -l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
-endif
-# the modern MinGW can dynamically link to dlls directly.
-# point MZSCHEME_DLLS to where you put libmzschXXXXXXX.dll and libgcXXXXXXX.dll
-ifndef MZSCHEME_DLLS
-MZSCHEME_DLLS=$(MZSCHEME)
-endif
-MZSCHEME_LIBDIR=-L$(MZSCHEME_DLLS) -L$(MZSCHEME_DLLS)\lib
-endif
-
-endif
-
-# Python support -- works with the ActiveState python 2.0 release (and others
-# too, probably)
-#
-# uncomment 'PYTHON' to make python-enabled version
+# uncomment 'PYTHON' if you want a python-enabled version
# Put the path to the python distro here. If cross compiling from Linux, you
# will also need to convert the header files to unix instead of dos format:
# for fil in *.h ; do vim -e -c 'set ff=unix|w|q' $fil
@@ -198,606 +34,16 @@ endif
# on my NT box, it's here:
#PYTHON=c:/python20
-ifdef PYTHON
-ifndef DYNAMIC_PYTHON
-DYNAMIC_PYTHON=yes
-endif
-
-ifndef PYTHON_VER
-PYTHON_VER=22
-endif
-
-ifeq (no,$(DYNAMIC_PYTHON))
-PYTHONLIB=-L$(PYTHON)/libs -lpython$(PYTHON_VER)
-endif
-# my include files are in 'win32inc' on Linux, and 'include' in the standard
-# NT distro (ActiveState)
-ifeq ($(CROSS),no)
-PYTHONINC=-I $(PYTHON)/include
-else
-PYTHONINC=-I $(PYTHON)/win32inc
-endif
-endif
-
-#PYTHON3: See comment for Python 2 above
-
-ifdef PYTHON3
-ifndef DYNAMIC_PYTHON3
-DYNAMIC_PYTHON3=yes
-endif
-
-ifndef PYTHON3_VER
-PYTHON3_VER=31
-endif
-
-ifeq (no,$(DYNAMIC_PYTHON3))
-PYTHON3LIB=-L$(PYTHON3)/libs -lPYTHON$(PYTHON3_VER)
-endif
+# uncomment 'PYTHON3' if you want a python3-enabled version
+#PYTHON3=c:/python31
-ifeq ($(CROSS),no)
-PYTHON3INC=-I $(PYTHON3)/include
-else
-PYTHON3INC=-I $(PYTHON3)/win32inc
-endif
-endif
-
-# TCL interface:
-# TCL=[Path to TCL directory]
-# DYNAMIC_TCL=yes (to load the TCL DLL dynamically)
-# TCL_VER=[TCL version, eg 83, 84] (default is 83)
+# uncomment 'TCL' if you want a Tcl-enabled version
#TCL=c:/tcl
-ifdef TCL
-ifndef DYNAMIC_TCL
-DYNAMIC_TCL=yes
-endif
-ifndef TCL_VER
-TCL_VER = 83
-endif
-TCLINC += -I$(TCL)/include
-endif
-
-# Ruby interface:
-# RUBY=[Path to Ruby directory]
-# DYNAMIC_RUBY=yes (to load the Ruby DLL dynamically)
-# RUBY_VER=[Ruby version, eg 16, 17] (default is 16)
-# RUBY_VER_LONG=[Ruby version, eg 1.6, 1.7] (default is 1.6)
-# You must set RUBY_VER_LONG when changing RUBY_VER.
-# You must set RUBY_API_VER version to RUBY_VER_LONG.
-# Don't set ruby API version to RUBY_VER like 191.
+# uncomment 'RUBY' if you want a Ruby-enabled version
#RUBY=c:/ruby
-ifdef RUBY
-ifndef DYNAMIC_RUBY
-DYNAMIC_RUBY=yes
-endif
-# Set default value
-ifndef RUBY_VER
-RUBY_VER = 16
-endif
-ifndef RUBY_VER_LONG
-RUBY_VER_LONG = 1.6
-endif
-ifndef RUBY_API_VER
-RUBY_API_VER = $(subst .,,$(RUBY_VER_LONG))
-endif
-
-ifndef RUBY_PLATFORM
-ifeq ($(RUBY_VER), 16)
-RUBY_PLATFORM = i586-mswin32
-else
-ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/i386-mingw32),)
-RUBY_PLATFORM = i386-mingw32
-else
-ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/x64-mingw32),)
-RUBY_PLATFORM = x64-mingw32
-else
-RUBY_PLATFORM = i386-mswin32
-endif
-endif
-endif
-endif
-
-ifndef RUBY_INSTALL_NAME
-ifeq ($(RUBY_VER), 16)
-RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_API_VER)
-else
-ifeq ($(ARCH),x86-64)
-RUBY_INSTALL_NAME = x64-msvcrt-ruby$(RUBY_API_VER)
-else
-RUBY_INSTALL_NAME = msvcrt-ruby$(RUBY_API_VER)
-endif
-endif
-endif
-
-ifeq (19, $(word 1,$(sort 19 $(RUBY_VER))))
-RUBY_19_OR_LATER = 1
-endif
-
-RUBYINC = -I $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/$(RUBY_PLATFORM)
-ifdef RUBY_19_OR_LATER
-RUBYINC += -I $(RUBY)/include/ruby-$(RUBY_VER_LONG) -I $(RUBY)/include/ruby-$(RUBY_VER_LONG)/$(RUBY_PLATFORM)
-endif
-ifeq (no, $(DYNAMIC_RUBY))
-RUBYLIB = -L$(RUBY)/lib -l$(RUBY_INSTALL_NAME)
-endif
-
-endif # RUBY
-
-# See feature.h for a list of options.
-# Any other defines can be included here.
-DEF_GUI=-DFEAT_GUI_W32 -DFEAT_CLIPBOARD
-DEFINES=-DWIN32 -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) \
- -DHAVE_PATHDEF -DFEAT_$(FEATURES)
-ifeq ($(ARCH),x86-64)
-DEFINES+=-DMS_WIN64
-endif
-ifeq ($(CROSS),yes)
-# cross-compiler prefix:
-CROSS_COMPILE = i586-pc-mingw32msvc-
-DEL = rm
-MKDIR = mkdir -p
-DIRSLASH = /
-else
-# normal (Windows) compilation:
-CROSS_COMPILE =
-ifneq (sh.exe, $(SHELL))
-DEL = rm
-MKDIR = mkdir -p
-DIRSLASH = /
-else
-DEL = del
-MKDIR = mkdir
-DIRSLASH = \\
-endif
-endif
-CC := $(CROSS_COMPILE)gcc
-WINDRES := $(CROSS_COMPILE)windres
-WINDRES_CC = $(CC)
-
-#>>>>> end of choices
-###########################################################################
-
-CFLAGS = -Iproto $(DEFINES) -pipe -w -march=$(ARCH) -Wall
-WINDRES_FLAGS = --preprocessor="$(WINDRES_CC) -E -xc" -DRC_INVOKED
-EXTRA_LIBS =
-
-ifdef GETTEXT
-DEFINES += -DHAVE_GETTEXT -DHAVE_LOCALE_H
-GETTEXTINCLUDE = $(GETTEXT)/include
-GETTEXTLIB = $(INTLPATH)
-ifeq (yes, $(GETTEXT))
-DEFINES += -DDYNAMIC_GETTEXT
-else
-ifdef DYNAMIC_GETTEXT
-DEFINES += -D$(DYNAMIC_GETTEXT)
-ifdef GETTEXT_DYNAMIC
-DEFINES += -DGETTEXT_DYNAMIC -DGETTEXT_DLL=\"$(GETTEXT_DYNAMIC)\"
-endif
-endif
-endif
-endif
-
-ifdef PERL
-CFLAGS += -I$(PERLLIBS) -DFEAT_PERL
-ifeq (yes, $(DYNAMIC_PERL))
-CFLAGS += -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl$(PERL_VER).dll\"
-EXTRA_LIBS += -L$(PERLLIBS) -lperl$(PERL_VER)
-endif
-endif
-
-ifdef LUA
-CFLAGS += -I$(LUA)/include -DFEAT_LUA
-ifeq (yes, $(DYNAMIC_LUA))
-CFLAGS += -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua$(LUA_VER).dll\"
-endif
-endif
-
-ifdef MZSCHEME
-CFLAGS += -I$(MZSCHEME)/include -DFEAT_MZSCHEME -DMZSCHEME_COLLECTS=\"$(MZSCHEME)/collects\"
-ifeq (yes, $(DYNAMIC_MZSCHEME))
-CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
-endif
-ifeq (yes, "$(MZSCHEME_DEBUG)")
-CFLAGS += -DMZSCHEME_FORCE_GC
-endif
-endif
-
-ifdef RUBY
-CFLAGS += -DFEAT_RUBY $(RUBYINC)
-ifeq (yes, $(DYNAMIC_RUBY))
-CFLAGS += -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\"
-CFLAGS += -DDYNAMIC_RUBY_VER=$(RUBY_VER)
-endif
-endif
-
-ifdef PYTHON
-CFLAGS += -DFEAT_PYTHON
-ifeq (yes, $(DYNAMIC_PYTHON))
-CFLAGS += -DDYNAMIC_PYTHON
-endif
-endif
-
-ifdef PYTHON3
-CFLAGS += -DFEAT_PYTHON3
-ifeq (yes, $(DYNAMIC_PYTHON3))
-CFLAGS += -DDYNAMIC_PYTHON3
-endif
-endif
-
-ifdef TCL
-CFLAGS += -DFEAT_TCL $(TCLINC)
-ifeq (yes, $(DYNAMIC_TCL))
-CFLAGS += -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl$(TCL_VER).dll\"
-endif
-endif
-
-ifeq ($(POSTSCRIPT),yes)
-DEFINES += -DMSWINPS
-endif
-
-ifeq (yes, $(OLE))
-DEFINES += -DFEAT_OLE
-endif
-
-ifeq ($(CSCOPE),yes)
-DEFINES += -DFEAT_CSCOPE
-endif
-
-ifeq ($(NETBEANS),yes)
-# Only allow NETBEANS for a GUI build.
-ifeq (yes, $(GUI))
-DEFINES += -DFEAT_NETBEANS_INTG
-
-ifeq ($(NBDEBUG), yes)
-DEFINES += -DNBDEBUG
-NBDEBUG_INCL = nbdebug.h
-NBDEBUG_SRC = nbdebug.c
-endif
-endif
-endif
-
-# Only allow XPM for a GUI build.
-ifeq (yes, $(GUI))
-
-ifndef XPM
-ifeq ($(ARCH),i386)
-XPM = xpm/x86
-endif
-ifeq ($(ARCH),i486)
-XPM = xpm/x86
-endif
-ifeq ($(ARCH),i586)
-XPM = xpm/x86
-endif
-ifeq ($(ARCH),i686)
-XPM = xpm/x86
-endif
-ifeq ($(ARCH),x86-64)
-XPM = xpm/x64
-endif
-endif
-ifdef XPM
-ifneq ($(XPM),no)
-CFLAGS += -DFEAT_XPM_W32 -I $(XPM)/include -I $(XPM)/../include
-endif
-endif
-
-endif
-
-ifeq ($(DEBUG),yes)
-CFLAGS += -g -fstack-check
-DEBUG_SUFFIX=d
-else
-ifeq ($(OPTIMIZE), SIZE)
-CFLAGS += -Os
-else
-ifeq ($(OPTIMIZE), MAXSPEED)
-CFLAGS += -O3
-CFLAGS += -fomit-frame-pointer -freg-struct-return
-else # SPEED
-CFLAGS += -O2
-endif
-endif
-CFLAGS += -s
-endif
-
-LIB = -lkernel32 -luser32 -lgdi32 -ladvapi32 -lcomdlg32 -lcomctl32 -lversion
-GUIOBJ = $(OUTDIR)/gui.o $(OUTDIR)/gui_w32.o $(OUTDIR)/gui_beval.o $(OUTDIR)/os_w32exe.o
-OBJ = \
- $(OUTDIR)/blowfish.o \
- $(OUTDIR)/buffer.o \
- $(OUTDIR)/charset.o \
- $(OUTDIR)/diff.o \
- $(OUTDIR)/digraph.o \
- $(OUTDIR)/edit.o \
- $(OUTDIR)/eval.o \
- $(OUTDIR)/ex_cmds.o \
- $(OUTDIR)/ex_cmds2.o \
- $(OUTDIR)/ex_docmd.o \
- $(OUTDIR)/ex_eval.o \
- $(OUTDIR)/ex_getln.o \
- $(OUTDIR)/fileio.o \
- $(OUTDIR)/fold.o \
- $(OUTDIR)/getchar.o \
- $(OUTDIR)/hardcopy.o \
- $(OUTDIR)/hashtab.o \
- $(OUTDIR)/main.o \
- $(OUTDIR)/mark.o \
- $(OUTDIR)/memfile.o \
- $(OUTDIR)/memline.o \
- $(OUTDIR)/menu.o \
- $(OUTDIR)/message.o \
- $(OUTDIR)/misc1.o \
- $(OUTDIR)/misc2.o \
- $(OUTDIR)/move.o \
- $(OUTDIR)/mbyte.o \
- $(OUTDIR)/normal.o \
- $(OUTDIR)/ops.o \
- $(OUTDIR)/option.o \
- $(OUTDIR)/os_win32.o \
- $(OUTDIR)/os_mswin.o \
- $(OUTDIR)/winclip.o \
- $(OUTDIR)/pathdef.o \
- $(OUTDIR)/popupmnu.o \
- $(OUTDIR)/quickfix.o \
- $(OUTDIR)/regexp.o \
- $(OUTDIR)/screen.o \
- $(OUTDIR)/search.o \
- $(OUTDIR)/sha256.o \
- $(OUTDIR)/spell.o \
- $(OUTDIR)/syntax.o \
- $(OUTDIR)/tag.o \
- $(OUTDIR)/term.o \
- $(OUTDIR)/ui.o \
- $(OUTDIR)/undo.o \
- $(OUTDIR)/version.o \
- $(OUTDIR)/vimrc.o \
- $(OUTDIR)/window.o
-
-ifdef PERL
-OBJ += $(OUTDIR)/if_perl.o
-endif
-ifdef LUA
-OBJ += $(OUTDIR)/if_lua.o
-endif
-ifdef MZSCHEME
-OBJ += $(OUTDIR)/if_mzsch.o
-MZSCHEME_INCL = if_mzsch.h
-ifeq (yes,$(MZSCHEME_GENERATE_BASE))
-CFLAGS += -DINCLUDE_MZSCHEME_BASE
-MZ_EXTRA_DEP += mzscheme_base.c
-endif
-ifeq (yes,$(MZSCHEME_PRECISE_GC))
-CFLAGS += -DMZ_PRECISE_GC
-endif
-endif
-ifdef PYTHON
-OBJ += $(OUTDIR)/if_python.o
-endif
-ifdef PYTHON3
-OBJ += $(OUTDIR)/if_python3.o
-endif
-ifdef RUBY
-OBJ += $(OUTDIR)/if_ruby.o
-endif
-ifdef TCL
-OBJ += $(OUTDIR)/if_tcl.o
-endif
-ifeq ($(CSCOPE),yes)
-OBJ += $(OUTDIR)/if_cscope.o
-endif
-ifeq ($(NETBEANS),yes)
-# Only allow NETBEANS for a GUI build.
-ifeq (yes, $(GUI))
-OBJ += $(OUTDIR)/netbeans.o
-LIB += -lwsock32
-endif
-endif
-ifdef XPM
-# Only allow XPM for a GUI build.
-ifeq (yes, $(GUI))
-OBJ += $(OUTDIR)/xpm_w32.o
-# You'll need libXpm.a from http://gnuwin32.sf.net
-LIB += -L$(XPM)/lib -lXpm
-endif
-endif
-
-
-ifdef MZSCHEME
-MZSCHEME_SUFFIX = Z
-endif
-
-ifeq ($(GUI),yes)
-TARGET := gvim$(DEBUG_SUFFIX).exe
-DEFINES += $(DEF_GUI)
-OBJ += $(GUIOBJ)
-LFLAGS += -mwindows
-OUTDIR = gobj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)$(ARCH)
-else
-TARGET := vim$(DEBUG_SUFFIX).exe
-OUTDIR = obj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)$(ARCH)
-endif
-
-ifdef GETTEXT
-ifneq (yes, $(GETTEXT))
-CFLAGS += -I$(GETTEXTINCLUDE)
-ifndef STATIC_GETTEXT
-LIB += -L$(GETTEXTLIB) -l$(INTLLIB)
-ifeq (USE_SAFE_GETTEXT_DLL, $(DYNAMIC_GETTEXT))
-OBJ+=$(SAFE_GETTEXT_DLL_OBJ)
-endif
-else
-LIB += -L$(GETTEXTLIB) -lintl
-endif
-endif
-endif
-
-ifdef PERL
-ifeq (no, $(DYNAMIC_PERL))
-LIB += -L$(PERLLIBS) -lperl$(PERL_VER)
-endif
-endif
-
-ifdef TCL
-LIB += -L$(TCL)/lib
-ifeq (yes, $(DYNAMIC_TCL))
-LIB += -ltclstub$(TCL_VER)
-else
-LIB += -ltcl$(TCL_VER)
-endif
-endif
-
-ifeq (yes, $(OLE))
-LIB += -loleaut32
-OBJ += $(OUTDIR)/if_ole.o
-ifeq (yes, $(STATIC_STDCPLUS))
-LIB += -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
-else
-LIB += -lstdc++
-endif
-endif
-
-ifeq (yes, $(MBYTE))
-DEFINES += -DFEAT_MBYTE
-endif
-
-ifeq (yes, $(IME))
-DEFINES += -DFEAT_MBYTE_IME
-ifeq (yes, $(DYNAMIC_IME))
-DEFINES += -DDYNAMIC_IME
-else
-LIB += -limm32
-endif
-endif
-
-ifdef ICONV
-ifneq (yes, $(ICONV))
-LIB += -L$(ICONV)
-CFLAGS += -I$(ICONV)
-endif
-DEFINES+=-DDYNAMIC_ICONV
-endif
-
-all: $(TARGET) vimrun.exe xxd/xxd.exe install.exe uninstal.exe GvimExt/gvimext.dll
-
-vimrun.exe: vimrun.c
- $(CC) $(CFLAGS) -o vimrun.exe vimrun.c $(LIB)
-
-install.exe: dosinst.c
- $(CC) $(CFLAGS) -o install.exe dosinst.c $(LIB) -lole32 -luuid
-
-uninstal.exe: uninstal.c
- $(CC) $(CFLAGS) -o uninstal.exe uninstal.c $(LIB)
-
-$(TARGET): $(OUTDIR) $(OBJ)
- $(CC) $(CFLAGS) $(LFLAGS) -o $@ $(OBJ) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB)
-
-upx: exes
- upx gvim.exe
- upx vim.exe
-
-mpress: exes
- mpress gvim.exe
- mpress vim.exe
-
-xxd/xxd.exe: xxd/xxd.c
- $(MAKE) -C xxd -f Make_ming.mak CC=$(CC)
-
-GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h
- $(MAKE) -C GvimExt -f Make_ming.mak CROSS=$(CROSS) CROSS_COMPILE=$(CROSS_COMPILE)
-
-clean:
- -$(DEL) $(OUTDIR)$(DIRSLASH)*.o
- -$(DEL) $(OUTDIR)$(DIRSLASH)*.res
- -rmdir $(OUTDIR)
- -$(DEL) *.exe
- -$(DEL) pathdef.c
-ifdef PERL
- -$(DEL) if_perl.c
-endif
-ifdef MZSCHEME
- -$(DEL) mzscheme_base.c
-endif
- $(MAKE) -C GvimExt -f Make_ming.mak clean
- $(MAKE) -C xxd -f Make_ming.mak clean
-
-###########################################################################
-INCL = vim.h feature.h os_win32.h os_dos.h ascii.h keymap.h term.h macros.h \
- structs.h regexp.h option.h ex_cmds.h proto.h globals.h farsi.h \
- gui.h
-
-$(OUTDIR)/if_python.o : if_python.c if_py_both.h $(INCL)
- $(CC) -c $(CFLAGS) $(PYTHONINC) -DDYNAMIC_PYTHON_DLL=\"python$(PYTHON_VER).dll\" $< -o $@
-
-$(OUTDIR)/if_python3.o : if_python3.c if_py_both.h $(INCL)
- $(CC) -c $(CFLAGS) $(PYTHON3INC) -DDYNAMIC_PYTHON3_DLL=\"PYTHON$(PYTHON3_VER).dll\" $< -o $@
-
-$(OUTDIR)/%.o : %.c $(INCL)
- $(CC) -c $(CFLAGS) $< -o $@
-
-$(OUTDIR)/vimrc.o: vim.rc version.h gui_w32_rc.h
- $(WINDRES) $(WINDRES_FLAGS) $(DEFINES) \
- --input-format=rc --output-format=coff -i vim.rc -o $@
-
-$(OUTDIR):
- $(MKDIR) $(OUTDIR)
-
-$(OUTDIR)/ex_docmd.o: ex_docmd.c $(INCL) ex_cmds.h
- $(CC) -c $(CFLAGS) ex_docmd.c -o $(OUTDIR)/ex_docmd.o
-
-$(OUTDIR)/ex_eval.o: ex_eval.c $(INCL) ex_cmds.h
- $(CC) -c $(CFLAGS) ex_eval.c -o $(OUTDIR)/ex_eval.o
-
-$(OUTDIR)/gui_w32.o: gui_w32.c gui_w48.c $(INCL)
- $(CC) -c $(CFLAGS) gui_w32.c -o $(OUTDIR)/gui_w32.o
-
-$(OUTDIR)/if_cscope.o: if_cscope.c $(INCL) if_cscope.h
- $(CC) -c $(CFLAGS) if_cscope.c -o $(OUTDIR)/if_cscope.o
-
-# Remove -D__IID_DEFINED__ for newer versions of the w32api
-$(OUTDIR)/if_ole.o: if_ole.cpp $(INCL)
- $(CC) $(CFLAGS) -c -o $(OUTDIR)/if_ole.o if_ole.cpp
-
-$(OUTDIR)/if_ruby.o: if_ruby.c $(INCL)
-ifeq (16, $(RUBY))
- $(CC) $(CFLAGS) -U_WIN32 -c -o $(OUTDIR)/if_ruby.o if_ruby.c
-endif
-
-if_perl.c: if_perl.xs typemap
- $(XSUBPP) -prototypes -typemap \
- $(PERLLIB)/ExtUtils/typemap if_perl.xs > $@
-
-$(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_INCL) $(NBDEBUG_SRC)
- $(CC) -c $(CFLAGS) netbeans.c -o $(OUTDIR)/netbeans.o
-
-$(OUTDIR)/regexp.o: regexp.c regexp_nfa.c $(INCL)
- $(CC) -c $(CFLAGS) regexp.c -o $(OUTDIR)/regexp.o
-
-$(OUTDIR)/if_mzsch.o: if_mzsch.c $(INCL) if_mzsch.h $(MZ_EXTRA_DEP)
- $(CC) -c $(CFLAGS) if_mzsch.c -o $(OUTDIR)/if_mzsch.o
-mzscheme_base.c:
- $(MZSCHEME)/mzc --c-mods mzscheme_base.c ++lib scheme/base
-pathdef.c: $(INCL)
-ifneq (sh.exe, $(SHELL))
- @echo creating pathdef.c
- @echo '/* pathdef.c */' > pathdef.c
- @echo '#include "vim.h"' >> pathdef.c
- @echo 'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' >> pathdef.c
- @echo 'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' >> pathdef.c
- @echo 'char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)";' >> pathdef.c
- @echo 'char_u *all_lflags = (char_u *)"$(CC) $(CFLAGS) $(LFLAGS) -o $(TARGET) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB)";' >> pathdef.c
- @echo 'char_u *compiled_user = (char_u *)"$(USERNAME)";' >> pathdef.c
- @echo 'char_u *compiled_sys = (char_u *)"$(USERDOMAIN)";' >> pathdef.c
-else
- @echo creating pathdef.c
- @echo /* pathdef.c */ > pathdef.c
- @echo #include "vim.h" >> pathdef.c
- @echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)"; >> pathdef.c
- @echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)"; >> pathdef.c
- @echo char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)"; >> pathdef.c
- @echo char_u *all_lflags = (char_u *)"$(CC) $(CFLAGS) $(LFLAGS) -o $(TARGET) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB)"; >> pathdef.c
- @echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> pathdef.c
- @echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> pathdef.c
-endif
+# Do not change this.
+UNDER_CYGWIN = no
+include Make_cyg_ming.mak
diff --git a/src/Make_morph.mak b/src/Make_morph.mak
index aa8fbd9..15a7477 100644
--- a/src/Make_morph.mak
+++ b/src/Make_morph.mak
@@ -27,6 +27,8 @@ RM = rm
SRC = blowfish.c \
buffer.c \
charset.c \
+ crypt.c \
+ crypt_zip.c \
diff.c \
digraph.c \
edit.c \
diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak
index 4a979e4..f751757 100644
--- a/src/Make_mvc.mak
+++ b/src/Make_mvc.mak
@@ -24,6 +24,9 @@
#
# GUI interface: GUI=yes (default is no)
#
+# GUI with DirectWrite(DirectX): DIRECTX=yes
+# (default is no, requires GUI=yes)
+#
# OLE interface: OLE=yes (usually with GUI=yes)
#
# Multibyte support: MBYTE=yes (default is no)
@@ -47,13 +50,14 @@
# Perl interface:
# PERL=[Path to Perl directory]
# DYNAMIC_PERL=yes (to load the Perl DLL dynamically)
-# PERL_VER=[Perl version, in the form 55 (5.005), 56 (5.6.x), etc]
+# PERL_VER=[Perl version, in the form 55 (5.005), 56 (5.6.x),
+# 510 (5.10.x), etc]
# (default is 56)
#
# Python interface:
# PYTHON=[Path to Python directory]
# DYNAMIC_PYTHON=yes (to load the Python DLL dynamically)
-# PYTHON_VER=[Python version, eg 15, 20] (default is 22)
+# PYTHON_VER=[Python version, eg 22, 23, ..., 27] (default is 22)
#
# Python3 interface:
# PYTHON3=[Path to Python3 directory]
@@ -63,11 +67,13 @@
# Ruby interface:
# RUBY=[Path to Ruby directory]
# DYNAMIC_RUBY=yes (to load the Ruby DLL dynamically)
-# RUBY_VER=[Ruby version, eg 16, 17] (default is 18)
-# RUBY_VER_LONG=[Ruby version, eg 1.6, 1.7] (default is 1.8)
+# RUBY_VER=[Ruby version, eg 18, 19, 20] (default is 18)
+# RUBY_VER_LONG=[Ruby version, eg 1.8, 1.9.1, 2.0.0] (default is 1.8)
# You must set RUBY_VER_LONG when change RUBY_VER.
-# You must set RUBY_API_VER to RUBY_VER_LONG.
-# Don't set ruby API version to RUBY_VER like 191.
+# RUBY_API_VER is derived from RUBY_VER_LONG.
+# Note: If you use Ruby 1.9.3, set as follows:
+# RUBY_VER=19
+# RUBY_VER_LONG=1.9.1 (not 1.9.3, because the API version is 1.9.1.)
#
# Tcl interface:
# TCL=[Path to Tcl directory]
@@ -168,6 +174,9 @@ OBJDIR = .\ObjG
!else
OBJDIR = .\ObjC
!endif
+!if "$(DIRECTX)" == "yes"
+OBJDIR = $(OBJDIR)X
+!endif
!if "$(OLE)" == "yes"
OBJDIR = $(OBJDIR)O
!endif
@@ -292,6 +301,13 @@ NBDEBUG_SRC = nbdebug.c
NETBEANS_LIB = WSock32.lib
!endif
+# DirectWrite(DirectX)
+!if "$(DIRECTX)" == "yes"
+DIRECTX_DEFS = -DFEAT_DIRECTX -DDYNAMIC_DIRECTX
+DIRECTX_INCL = gui_dwrite.h
+DIRECTX_OBJ = $(OUTDIR)\gui_dwrite.obj
+!endif
+
!ifndef XPM
# XPM is not set, use the included xpm files, depending on the architecture.
!if "$(CPU)" == "AMD64"
@@ -534,6 +550,8 @@ OBJ = \
$(OUTDIR)\blowfish.obj \
$(OUTDIR)\buffer.obj \
$(OUTDIR)\charset.obj \
+ $(OUTDIR)\crypt.obj \
+ $(OUTDIR)\crypt_zip.obj \
$(OUTDIR)\diff.obj \
$(OUTDIR)\digraph.obj \
$(OUTDIR)\edit.obj \
@@ -642,6 +660,16 @@ GUI_LIB = \
SUBSYSTEM = console
!endif
+!if "$(SUBSYSTEM_VER)" != ""
+SUBSYSTEM = $(SUBSYSTEM),$(SUBSYSTEM_VER)
+!endif
+
+!if "$(GUI)" == "yes" && "$(DIRECTX)" == "yes"
+CFLAGS = $(CFLAGS) $(DIRECTX_DEFS)
+GUI_INCL = $(GUI_INCL) $(DIRECTX_INCL)
+GUI_OBJ = $(GUI_OBJ) $(DIRECTX_OBJ)
+!endif
+
# iconv.dll library (dynamically loaded)
!ifndef ICONV
ICONV = yes
@@ -1073,6 +1101,10 @@ $(OUTDIR)/buffer.obj: $(OUTDIR) buffer.c $(INCL)
$(OUTDIR)/charset.obj: $(OUTDIR) charset.c $(INCL)
+$(OUTDIR)/crypt.obj: $(OUTDIR) crypt.c $(INCL)
+
+$(OUTDIR)/crypt_zip.obj: $(OUTDIR) crypt_zip.c $(INCL)
+
$(OUTDIR)/diff.obj: $(OUTDIR) diff.c $(INCL)
$(OUTDIR)/digraph.obj: $(OUTDIR) digraph.c $(INCL)
@@ -1107,6 +1139,8 @@ $(OUTDIR)/gui_beval.obj: $(OUTDIR) gui_beval.c $(INCL) $(GUI_INCL)
$(OUTDIR)/gui_w32.obj: $(OUTDIR) gui_w32.c gui_w48.c $(INCL) $(GUI_INCL)
+$(OUTDIR)/gui_dwrite.obj: $(OUTDIR) gui_dwrite.cpp $(INCL) $(GUI_INCL)
+
$(OUTDIR)/if_cscope.obj: $(OUTDIR) if_cscope.c $(INCL)
$(OUTDIR)/if_lua.obj: $(OUTDIR) if_lua.c $(INCL)
@@ -1257,6 +1291,8 @@ proto.h: \
proto/blowfish.pro \
proto/buffer.pro \
proto/charset.pro \
+ proto/crypt.pro \
+ proto/crypt_zip.pro \
proto/diff.pro \
proto/digraph.pro \
proto/edit.pro \
diff --git a/src/Make_os2.mak b/src/Make_os2.mak
index 42dbdb3..cd62d1c 100644
--- a/src/Make_os2.mak
+++ b/src/Make_os2.mak
@@ -42,6 +42,8 @@ OBJ = \
blowfish.o \
buffer.o \
charset.o \
+ crypt.o \
+ crypt_zip.o \
diff.o \
digraph.o \
edit.o \
@@ -117,6 +119,8 @@ os_unix.o: os_unix.c $(INCL)
blowfish.o: blowfish.c $(INCL)
buffer.o: buffer.c $(INCL)
charset.o: charset.c $(INCL)
+crypt.o: crypt.c $(INCL)
+crypt_zip.o: crypt_zip.c $(INCL)
diff.o: diff.c $(INCL)
digraph.o: digraph.c $(INCL)
edit.o: edit.c $(INCL)
diff --git a/src/Make_sas.mak b/src/Make_sas.mak
index bf57c0d..49dcb6b 100644
--- a/src/Make_sas.mak
+++ b/src/Make_sas.mak
@@ -92,6 +92,8 @@ SRC = \
blowfish.c \
buffer.c \
charset.c \
+ crypt.c \
+ crypt_zip.c \
diff.c \
digraph.c \
edit.c \
@@ -139,6 +141,8 @@ OBJ = \
blowfish.o \
buffer.o \
charset.o \
+ crypt.o \
+ crypt_zip.o \
diff.o \
digraph.o \
edit.o \
@@ -186,6 +190,8 @@ PRO = \
proto/blowfish.pro \
proto/buffer.pro \
proto/charset.pro \
+ proto/crypt.pro \
+ proto/crypt_zip.pro \
proto/diff.pro \
proto/digraph.pro \
proto/edit.pro \
@@ -290,6 +296,10 @@ buffer.o: buffer.c
proto/buffer.pro: buffer.c
charset.o: charset.c
proto/charset.pro: charset.c
+crypt.o: crypt.c
+proto/crypt.pro: crypt.c
+crypt_zip.o: crypt_zip.c
+proto/crypt_zip.pro: crypt_zip.c
diff.o: diff.c
proto/diff.pro: diff.c
digraph.o: digraph.c
diff --git a/src/Makefile b/src/Makefile
index 5a3affb..4840844 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1447,6 +1447,8 @@ BASIC_SRC = \
blowfish.c \
buffer.c \
charset.c \
+ crypt.c \
+ crypt_zip.c \
diff.c \
digraph.c \
edit.c \
@@ -1536,6 +1538,8 @@ OBJ_COMMON = \
objects/buffer.o \
objects/blowfish.o \
objects/charset.o \
+ objects/crypt.o \
+ objects/crypt_zip.o \
objects/diff.o \
objects/digraph.o \
objects/edit.o \
@@ -1605,6 +1609,8 @@ PRO_AUTO = \
blowfish.pro \
buffer.pro \
charset.pro \
+ crypt.pro \
+ crypt_zip.pro \
diff.pro \
digraph.pro \
edit.pro \
@@ -1769,10 +1775,11 @@ xxd/xxd$(EXEEXT): xxd/xxd.c
languages:
@if test -n "$(MAKEMO)" -a -f $(PODIR)/Makefile; then \
cd $(PODIR); \
- CC="$(CC)" $(MAKE) prefix=$(DESTDIR)$(prefix); \
+ CC="$(CC)" $(MAKE) prefix=$(DESTDIR)$(prefix); \
fi
-@if test -n "$(MAKEMO)" -a -f $(PODIR)/Makefile; then \
- cd $(PODIR); CC="$(CC)" $(MAKE) prefix=$(DESTDIR)$(prefix) converted; \
+ cd $(PODIR); \
+ CC="$(CC)" $(MAKE) prefix=$(DESTDIR)$(prefix) converted; \
fi
# Update the *.po files for changes in the sources. Only run manually.
@@ -1788,13 +1795,12 @@ update-po:
proto: $(PRO_AUTO) $(PRO_MANUAL)
# Filter out arguments that cproto doesn't support.
-# Don't pass "-pthread" to cproto, it sees it as a list of individual flags.
-# Don't pass "-fstack-protector" to cproto, for the same reason.
-# Don't pass "-g" to cproto.
+# Don't pass "-pthread", "-fwrapv" and similar arguments to cproto, it sees
+# them as a list of individual flags.
# The -E"gcc -E" argument must be separate to avoid problems with shell
# quoting.
CPROTO = cproto $(PROTO_FLAGS) -DPROTO \
- `echo '$(LINT_CFLAGS)' | sed -e 's/-pthread//g' -e 's/-fstack-protector//g' -e 's/\ -g\ / /g'`
+ `echo '$(LINT_CFLAGS)' | sed -e 's/ -[a-z-]\+//g'`
### Would be nice if this would work for "normal" make.
### Currently it only works for (Free)BSD make.
@@ -1888,6 +1894,9 @@ test check:
cd testdir; $(MAKE) -f Makefile $(GUI_TESTTARGET) VIMPROG=../$(VIMTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE)
$(MAKE) -f Makefile unittest
+benchmark:
+ cd testdir; $(MAKE) -f Makefile benchmark VIMPROG=../$(VIMTARGET) SCRIPTSOURCE=../$(SCRIPTSOURCE)
+
unittesttargets:
$(MAKE) -f Makefile $(UNITTEST_TARGETS)
@@ -1897,10 +1906,23 @@ unittest unittests: $(UNITTEST_TARGETS)
done
# Run individual test, assuming that Vim was already compiled.
-test1 test2 test3 test4 test5 test6 test7 test8 test9 \
+test1 \
+ test_argument_count \
test_autoformat_join \
+ test_breakindent \
+ test_changelist \
+ test_close_count \
test_eval \
+ test_insertcount \
+ test_listlbr \
+ test_listlbr_utf8 \
+ test_mapping \
test_options \
+ test_qf_title \
+ test_signs \
+ test_utf8 \
+ test_writefile \
+ test2 test3 test4 test5 test6 test7 test8 test9 \
test10 test11 test12 test13 test14 test15 test16 test17 test18 test19 \
test20 test21 test22 test23 test24 test25 test26 test27 test28 test29 \
test30 test31 test32 test33 test34 test35 test36 test37 test38 test39 \
@@ -2484,7 +2506,7 @@ auto/if_perl.c: if_perl.xs
$(PERL) $(PERLSITELIB)/ExtUtils/xsubpp -prototypes -typemap \
$(PERLLIB)/ExtUtils/typemap if_perl.xs >> $@; \
else \
- $(PERL) $(PERLLIB)/ExtUtils/xsubpp -prototypes -typemap \
+ $(PERL) $(PERL_XSUBPP) -prototypes -typemap \
$(PERLLIB)/ExtUtils/typemap if_perl.xs >> $@; \
fi
@@ -2533,6 +2555,12 @@ objects/buffer.o: buffer.c
objects/charset.o: charset.c
$(CCC) -o $@ charset.c
+objects/crypt.o: crypt.c
+ $(CCC) -o $@ crypt.c
+
+objects/crypt_zip.o: crypt_zip.c
+ $(CCC) -o $@ crypt_zip.c
+
objects/diff.o: diff.c
$(CCC) -o $@ diff.c
@@ -2897,6 +2925,14 @@ objects/charset.o: charset.c vim.h auto/config.h feature.h os_unix.h auto/osdef.
ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \
gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \
arabic.h
+objects/crypt.o: crypt.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \
+ ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \
+ gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \
+ arabic.h
+objects/crypt_zip.o: crypt_zip.c vim.h auto/config.h feature.h os_unix.h \
+ auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \
+ regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \
+ globals.h farsi.h arabic.h
objects/diff.o: diff.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \
ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \
gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \
diff --git a/src/auto/configure b/src/auto/configure
index bda88c6..4a69ecd 100755
--- a/src/auto/configure
+++ b/src/auto/configure
@@ -688,6 +688,7 @@ PERL_PRO
PERL_OBJ
PERL_SRC
shrpenv
+vi_cv_perl_xsubpp
vi_cv_perlsitelib
vi_cv_perllib
vi_cv_path_perl
@@ -5647,6 +5648,14 @@ $as_echo "OK" >&6; }
vi_cv_perlsitelib=`$vi_cv_path_perl -MConfig -e 'print $Config{sitelibexp}'`
+ vi_cv_perl_extutils=unknown_perl_extutils_path
+ for extutils_rel_path in ExtUtils vendor_perl/ExtUtils; do
+ xsubpp_path="$vi_cv_perllib/$extutils_rel_path/xsubpp"
+ if test -f "$xsubpp_path"; then
+ vi_cv_perl_xsubpp="$xsubpp_path"
+ fi
+ done
+
perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
-e 'ccflags;perl_inc;print"\n"' | sed -e 's/-fno[^ ]*//'`
perllibs=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed -e 'ldopts' | \
@@ -5767,6 +5776,10 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_pythoninterp" >&5
$as_echo "$enable_pythoninterp" >&6; }
if test "$enable_pythoninterp" = "yes" -o "$enable_pythoninterp" = "dynamic"; then
+ if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
+ as_fn_error $? "cannot use Python with tiny or small features" "$LINENO" 5
+ fi
+
for ac_prog in python2 python
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
@@ -6090,6 +6103,10 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_python3interp" >&5
$as_echo "$enable_python3interp" >&6; }
if test "$enable_python3interp" = "yes" -o "$enable_python3interp" = "dynamic"; then
+ if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
+ as_fn_error $? "cannot use Python with tiny or small features" "$LINENO" 5
+ fi
+
for ac_prog in python3 python
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
@@ -6975,6 +6992,10 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_rubyinterp" >&5
$as_echo "$enable_rubyinterp" >&6; }
if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then
+ if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
+ as_fn_error $? "cannot use Ruby with tiny or small features" "$LINENO" 5
+ fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking --with-ruby-command argument" >&5
$as_echo_n "checking --with-ruby-command argument... " >&6; }
@@ -12809,16 +12830,15 @@ $as_echo "$vim_cv_memcpy_handles_overlap" >&6; }
fi
-
-if test "$enable_multibyte" = "yes"; then
+if test "x$with_x" = "xyes"; then
cflags_save=$CFLAGS
- ldflags_save=$LDFLAGS
- if test "x$x_includes" != "xNONE" ; then
- CFLAGS="$CFLAGS -I$x_includes"
- LDFLAGS="$X_LIBS $LDFLAGS -lX11"
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether X_LOCALE needed" >&5
+ libs_save=$LIBS
+ LIBS="$LIBS $X_LIBS $GUI_LIB_LOC $GUI_X_LIBS $X_PRE_LIBS $X_LIB $X_EXTRA_LIBS"
+ CFLAGS="$CFLAGS $X_CFLAGS"
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether X_LOCALE needed" >&5
$as_echo_n "checking whether X_LOCALE needed... " >&6; }
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <X11/Xlocale.h>
int
@@ -12851,7 +12871,7 @@ _ACEOF
if ac_fn_c_try_link "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
- $as_echo "#define X_LOCALE 1" >>confdefs.h
+ $as_echo "#define X_LOCALE 1" >>confdefs.h
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
@@ -12864,9 +12884,41 @@ else
$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Xutf8SetWMProperties() can be used" >&5
+$as_echo_n "checking whether Xutf8SetWMProperties() can be used... " >&6; }
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char Xutf8SetWMProperties ();
+int
+main ()
+{
+return Xutf8SetWMProperties ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ $as_echo "#define HAVE_XUTF8SETWMPROPERTIES 1" >>confdefs.h
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
CFLAGS=$cflags_save
- LDFLAGS=$ldflags_save
+ LIBS=$libs_save
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _xpg4_setrunelocale in -lxpg4" >&5
@@ -13052,7 +13104,7 @@ rm -f core conftest.err conftest.$ac_objext \
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: msgfmt not found - disabled" >&5
$as_echo "msgfmt not found - disabled" >&6; };
fi
- if test $have_gettext = "yes"; then
+ if test $have_gettext = "yes" -a "x$features" != "xtiny" -a "x$features" != "xsmall"; then
$as_echo "#define HAVE_GETTEXT 1" >>confdefs.h
MAKEMO=yes
diff --git a/src/blowfish.c b/src/blowfish.c
index 3d9ba55..6bf2482 100644
--- a/src/blowfish.c
+++ b/src/blowfish.c
@@ -9,17 +9,25 @@
* Blowfish encryption for Vim; in Blowfish cipher feedback mode.
* Contributed by Mohsin Ahmed, http://www.cs.albany.edu/~mosh
* Based on http://www.schneier.com/blowfish.html by Bruce Schneier.
+ *
+ * There are two variants:
+ * - The old one "blowfish" has a flaw which makes it much easier to crack the
+ * key. To see this, make a text file with one line of 1000 "x" characters
+ * and write it encrypted. Use "xxd" to inspect the bytes in the file. You
+ * will see that a block of 8 bytes repeats 8 times.
+ * - The new one "blowfish2" is better. It uses an 8 byte CFB to avoid the
+ * repeats.
*/
#include "vim.h"
-#if defined(FEAT_CRYPT)
+#if defined(FEAT_CRYPT) || defined(PROTO)
#define ARRAY_LENGTH(A) (sizeof(A)/sizeof(A[0]))
#define BF_BLOCK 8
#define BF_BLOCK_MASK 7
-#define BF_CFB_LEN (8*(BF_BLOCK))
+#define BF_MAX_CFB_LEN (8 * BF_BLOCK)
typedef union {
UINT32_T ul[2];
@@ -37,14 +45,26 @@ typedef union {
# endif
#endif
-static void bf_e_block __ARGS((UINT32_T *p_xl, UINT32_T *p_xr));
-static void bf_e_cblock __ARGS((char_u *block));
-static int bf_check_tables __ARGS((UINT32_T a_ipa[18], UINT32_T a_sbi[4][256], UINT32_T val));
+/* The state of encryption, referenced by cryptstate_T. */
+typedef struct {
+ UINT32_T pax[18]; /* P-array */
+ UINT32_T sbx[4][256]; /* S-boxes */
+ int randbyte_offset;
+ int update_offset;
+ char_u cfb_buffer[BF_MAX_CFB_LEN]; /* up to 64 bytes used */
+ int cfb_len; /* size of cfb_buffer actually used */
+} bf_state_T;
+
+
+static void bf_e_block __ARGS((bf_state_T *state, UINT32_T *p_xl, UINT32_T *p_xr));
+static void bf_e_cblock __ARGS((bf_state_T *state, char_u *block));
+static int bf_check_tables __ARGS((UINT32_T pax[18], UINT32_T sbx[4][256], UINT32_T val));
static int bf_self_test __ARGS((void));
+static void bf_key_init __ARGS((bf_state_T *state, char_u *password, char_u *salt, int salt_len));
+static void bf_cfb_init __ARGS((bf_state_T *state, char_u *seed, int seed_len));
/* Blowfish code */
-static UINT32_T pax[18];
-static UINT32_T ipa[18] = {
+static UINT32_T pax_init[18] = {
0x243f6a88u, 0x85a308d3u, 0x13198a2eu,
0x03707344u, 0xa4093822u, 0x299f31d0u,
0x082efa98u, 0xec4e6c89u, 0x452821e6u,
@@ -53,8 +73,7 @@ static UINT32_T ipa[18] = {
0xb5470917u, 0x9216d5d9u, 0x8979fb1bu
};
-static UINT32_T sbx[4][256];
-static UINT32_T sbi[4][256] = {
+static UINT32_T sbx_init[4][256] = {
{0xd1310ba6u, 0x98dfb5acu, 0x2ffd72dbu, 0xd01adfb7u,
0xb8e1afedu, 0x6a267e96u, 0xba7c9045u, 0xf12c7f99u,
0x24a19947u, 0xb3916cf7u, 0x0801f2e2u, 0x858efc16u,
@@ -314,33 +333,40 @@ static UINT32_T sbi[4][256] = {
}
};
-
#define F1(i) \
- xl ^= pax[i]; \
- xr ^= ((sbx[0][xl >> 24] + \
- sbx[1][(xl & 0xFF0000) >> 16]) ^ \
- sbx[2][(xl & 0xFF00) >> 8]) + \
- sbx[3][xl & 0xFF];
+ xl ^= bfs->pax[i]; \
+ xr ^= ((bfs->sbx[0][xl >> 24] + \
+ bfs->sbx[1][(xl & 0xFF0000) >> 16]) ^ \
+ bfs->sbx[2][(xl & 0xFF00) >> 8]) + \
+ bfs->sbx[3][xl & 0xFF];
#define F2(i) \
- xr ^= pax[i]; \
- xl ^= ((sbx[0][xr >> 24] + \
- sbx[1][(xr & 0xFF0000) >> 16]) ^ \
- sbx[2][(xr & 0xFF00) >> 8]) + \
- sbx[3][xr & 0xFF];
-
+ xr ^= bfs->pax[i]; \
+ xl ^= ((bfs->sbx[0][xr >> 24] + \
+ bfs->sbx[1][(xr & 0xFF0000) >> 16]) ^ \
+ bfs->sbx[2][(xr & 0xFF00) >> 8]) + \
+ bfs->sbx[3][xr & 0xFF];
static void
-bf_e_block(p_xl, p_xr)
+bf_e_block(bfs, p_xl, p_xr)
+ bf_state_T *bfs;
UINT32_T *p_xl;
UINT32_T *p_xr;
{
- UINT32_T temp, xl = *p_xl, xr = *p_xr;
-
- F1(0) F2(1) F1(2) F2(3) F1(4) F2(5) F1(6) F2(7)
- F1(8) F2(9) F1(10) F2(11) F1(12) F2(13) F1(14) F2(15)
- xl ^= pax[16];
- xr ^= pax[17];
+ UINT32_T temp;
+ UINT32_T xl = *p_xl;
+ UINT32_T xr = *p_xr;
+
+ F1(0) F2(1)
+ F1(2) F2(3)
+ F1(4) F2(5)
+ F1(6) F2(7)
+ F1(8) F2(9)
+ F1(10) F2(11)
+ F1(12) F2(13)
+ F1(14) F2(15)
+ xl ^= bfs->pax[16];
+ xr ^= bfs->pax[17];
temp = xl;
xl = xr;
xr = temp;
@@ -348,22 +374,6 @@ bf_e_block(p_xl, p_xr)
*p_xr = xr;
}
-#if 0 /* not used */
- static void
-bf_d_block(p_xl, p_xr)
- UINT32_T *p_xl;
- UINT32_T *p_xr;
-{
- UINT32_T temp, xl = *p_xl, xr = *p_xr;
- F1(17) F2(16) F1(15) F2(14) F1(13) F2(12) F1(11) F2(10)
- F1(9) F2(8) F1(7) F2(6) F1(5) F2(4) F1(3) F2(2)
- xl ^= pax[1];
- xr ^= pax[0];
- temp = xl; xl = xr; xr = temp;
- *p_xl = xl; *p_xr = xr;
-}
-#endif
-
#ifdef WORDS_BIGENDIAN
# define htonl2(x) \
@@ -374,7 +384,8 @@ bf_d_block(p_xl, p_xr)
#endif
static void
-bf_e_cblock(block)
+bf_e_cblock(bfs, block)
+ bf_state_T *bfs;
char_u *block;
{
block8 bk;
@@ -382,35 +393,22 @@ bf_e_cblock(block)
memcpy(bk.uc, block, 8);
htonl2(bk.ul[0]);
htonl2(bk.ul[1]);
- bf_e_block(&bk.ul[0], &bk.ul[1]);
+ bf_e_block(bfs, &bk.ul[0], &bk.ul[1]);
htonl2(bk.ul[0]);
htonl2(bk.ul[1]);
memcpy(block, bk.uc, 8);
}
-#if 0 /* not used */
- void
-bf_d_cblock(block)
- char_u *block;
-{
- block8 bk;
- memcpy(bk.uc, block, 8);
- htonl2(bk.ul[0]); htonl2(bk.ul[1]);
- bf_d_block(&bk.ul[0], &bk.ul[1]);
- htonl2(bk.ul[0]); htonl2(bk.ul[1]);
- memcpy(block, bk.uc, 8);
-}
-#endif
-
/*
* Initialize the crypt method using "password" as the encryption key and
* "salt[salt_len]" as the salt.
*/
- void
-bf_key_init(password, salt, salt_len)
- char_u *password;
- char_u *salt;
- int salt_len;
+ static void
+bf_key_init(bfs, password, salt, salt_len)
+ bf_state_T *bfs;
+ char_u *password;
+ char_u *salt;
+ int salt_len;
{
int i, j, keypos = 0;
unsigned u;
@@ -418,7 +416,7 @@ bf_key_init(password, salt, salt_len)
char_u *key;
int keylen;
- /* Process the key 1000 times.
+ /* Process the key 1001 times.
* See http://en.wikipedia.org/wiki/Key_strengthening. */
key = sha256_key(password, salt, salt_len);
for (i = 0; i < 1000; i++)
@@ -437,52 +435,54 @@ bf_key_init(password, salt, salt_len)
key[i] = u;
}
- mch_memmove(sbx, sbi, 4 * 4 * 256);
+ /* Use "key" to initialize the P-array ("pax") and S-boxes ("sbx") of
+ * Blowfish. */
+ mch_memmove(bfs->sbx, sbx_init, 4 * 4 * 256);
for (i = 0; i < 18; ++i)
{
val = 0;
for (j = 0; j < 4; ++j)
val = (val << 8) | key[keypos++ % keylen];
- pax[i] = ipa[i] ^ val;
+ bfs->pax[i] = pax_init[i] ^ val;
}
data_l = data_r = 0;
for (i = 0; i < 18; i += 2)
{
- bf_e_block(&data_l, &data_r);
- pax[i + 0] = data_l;
- pax[i + 1] = data_r;
+ bf_e_block(bfs, &data_l, &data_r);
+ bfs->pax[i + 0] = data_l;
+ bfs->pax[i + 1] = data_r;
}
for (i = 0; i < 4; ++i)
{
for (j = 0; j < 256; j += 2)
{
- bf_e_block(&data_l, &data_r);
- sbx[i][j + 0] = data_l;
- sbx[i][j + 1] = data_r;
+ bf_e_block(bfs, &data_l, &data_r);
+ bfs->sbx[i][j + 0] = data_l;
+ bfs->sbx[i][j + 1] = data_r;
}
}
}
/*
- * BF Self test for corrupted tables or instructions
+ * Blowfish self-test for corrupted tables or instructions.
*/
static int
-bf_check_tables(a_ipa, a_sbi, val)
- UINT32_T a_ipa[18];
- UINT32_T a_sbi[4][256];
+bf_check_tables(pax, sbx, val)
+ UINT32_T pax[18];
+ UINT32_T sbx[4][256];
UINT32_T val;
{
int i, j;
UINT32_T c = 0;
for (i = 0; i < 18; i++)
- c ^= a_ipa[i];
+ c ^= pax[i];
for (i = 0; i < 4; i++)
for (j = 0; j < 256; j++)
- c ^= a_sbi[i][j];
+ c ^= sbx[i][j];
return c == val;
}
@@ -520,6 +520,10 @@ bf_self_test()
int err = 0;
block8 bk;
UINT32_T ui = 0xffffffffUL;
+ bf_state_T state;
+
+ vim_memset(&state, 0, sizeof(bf_state_T));
+ state.cfb_len = BF_MAX_CFB_LEN;
/* We can't simply use sizeof(UINT32_T), it would generate a compiler
* warning. */
@@ -528,21 +532,21 @@ bf_self_test()
EMSG(_("E820: sizeof(uint32_t) != 4"));
}
- if (!bf_check_tables(ipa, sbi, 0x6ffa520a))
+ if (!bf_check_tables(pax_init, sbx_init, 0x6ffa520a))
err++;
bn = ARRAY_LENGTH(bf_test_data);
for (i = 0; i < bn; i++)
{
- bf_key_init((char_u *)(bf_test_data[i].password),
+ bf_key_init(&state, (char_u *)(bf_test_data[i].password),
bf_test_data[i].salt,
(int)STRLEN(bf_test_data[i].salt));
- if (!bf_check_tables(pax, sbx, bf_test_data[i].keysum))
+ if (!bf_check_tables(state.pax, state.sbx, bf_test_data[i].keysum))
err++;
/* Don't modify bf_test_data[i].plaintxt, self test is idempotent. */
memcpy(bk.uc, bf_test_data[i].plaintxt, 8);
- bf_e_cblock(bk.uc);
+ bf_e_cblock(&state, bk.uc);
if (memcmp(bk.uc, bf_test_data[i].cryptxt, 8) != 0)
{
if (err == 0 && memcmp(bk.uc, bf_test_data[i].badcryptxt, 8) == 0)
@@ -554,43 +558,43 @@ bf_self_test()
return err > 0 ? FAIL : OK;
}
-/* Cipher feedback mode. */
-static int randbyte_offset = 0;
-static int update_offset = 0;
-static char_u cfb_buffer[BF_CFB_LEN]; /* 64 bytes */
+/*
+ * CFB: Cipher Feedback Mode.
+ */
/*
- * Initialize with seed "iv[iv_len]".
+ * Initialize with seed "seed[seed_len]".
*/
- void
-bf_cfb_init(iv, iv_len)
- char_u *iv;
- int iv_len;
+ static void
+bf_cfb_init(bfs, seed, seed_len)
+ bf_state_T *bfs;
+ char_u *seed;
+ int seed_len;
{
int i, mi;
- randbyte_offset = update_offset = 0;
- vim_memset(cfb_buffer, 0, BF_CFB_LEN);
- if (iv_len > 0)
+ bfs->randbyte_offset = bfs->update_offset = 0;
+ vim_memset(bfs->cfb_buffer, 0, bfs->cfb_len);
+ if (seed_len > 0)
{
- mi = iv_len > BF_CFB_LEN ? iv_len : BF_CFB_LEN;
+ mi = seed_len > bfs->cfb_len ? seed_len : bfs->cfb_len;
for (i = 0; i < mi; i++)
- cfb_buffer[i % BF_CFB_LEN] ^= iv[i % iv_len];
+ bfs->cfb_buffer[i % bfs->cfb_len] ^= seed[i % seed_len];
}
}
-#define BF_CFB_UPDATE(c) { \
- cfb_buffer[update_offset] ^= (char_u)c; \
- if (++update_offset == BF_CFB_LEN) \
- update_offset = 0; \
+#define BF_CFB_UPDATE(bfs, c) { \
+ bfs->cfb_buffer[bfs->update_offset] ^= (char_u)c; \
+ if (++bfs->update_offset == bfs->cfb_len) \
+ bfs->update_offset = 0; \
}
-#define BF_RANBYTE(t) { \
- if ((randbyte_offset & BF_BLOCK_MASK) == 0) \
- bf_e_cblock(&cfb_buffer[randbyte_offset]); \
- t = cfb_buffer[randbyte_offset]; \
- if (++randbyte_offset == BF_CFB_LEN) \
- randbyte_offset = 0; \
+#define BF_RANBYTE(bfs, t) { \
+ if ((bfs->randbyte_offset & BF_BLOCK_MASK) == 0) \
+ bf_e_cblock(bfs, &(bfs->cfb_buffer[bfs->randbyte_offset])); \
+ t = bfs->cfb_buffer[bfs->randbyte_offset]; \
+ if (++bfs->randbyte_offset == bfs->cfb_len) \
+ bfs->randbyte_offset = 0; \
}
/*
@@ -598,90 +602,69 @@ bf_cfb_init(iv, iv_len)
* "from" and "to" can be equal to encrypt in place.
*/
void
-bf_crypt_encode(from, len, to)
+crypt_blowfish_encode(state, from, len, to)
+ cryptstate_T *state;
char_u *from;
size_t len;
char_u *to;
{
+ bf_state_T *bfs = state->method_state;
size_t i;
int ztemp, t;
for (i = 0; i < len; ++i)
{
ztemp = from[i];
- BF_RANBYTE(t);
- BF_CFB_UPDATE(ztemp);
+ BF_RANBYTE(bfs, t);
+ BF_CFB_UPDATE(bfs, ztemp);
to[i] = t ^ ztemp;
}
}
/*
- * Decrypt "ptr[len]" in place.
+ * Decrypt "from[len]" into "to[len]".
*/
void
-bf_crypt_decode(ptr, len)
- char_u *ptr;
- long len;
+crypt_blowfish_decode(state, from, len, to)
+ cryptstate_T *state;
+ char_u *from;
+ size_t len;
+ char_u *to;
{
- char_u *p;
+ bf_state_T *bfs = state->method_state;
+ size_t i;
int t;
- for (p = ptr; p < ptr + len; ++p)
+ for (i = 0; i < len; ++i)
{
- BF_RANBYTE(t);
- *p ^= t;
- BF_CFB_UPDATE(*p);
+ BF_RANBYTE(bfs, t);
+ to[i] = from[i] ^ t;
+ BF_CFB_UPDATE(bfs, to[i]);
}
}
-/*
- * Initialize the encryption keys and the random header according to
- * the given password.
- */
void
-bf_crypt_init_keys(passwd)
- char_u *passwd; /* password string with which to modify keys */
+crypt_blowfish_init(state, key, salt, salt_len, seed, seed_len)
+ cryptstate_T *state;
+ char_u* key;
+ char_u* salt;
+ int salt_len;
+ char_u* seed;
+ int seed_len;
{
- char_u *p;
+ bf_state_T *bfs = (bf_state_T *)alloc_clear(sizeof(bf_state_T));
- for (p = passwd; *p != NUL; ++p)
- {
- BF_CFB_UPDATE(*p);
- }
-}
+ state->method_state = bfs;
-static int save_randbyte_offset;
-static int save_update_offset;
-static char_u save_cfb_buffer[BF_CFB_LEN];
-static UINT32_T save_pax[18];
-static UINT32_T save_sbx[4][256];
+ /* "blowfish" uses a 64 byte buffer, causing it to repeat 8 byte groups 8
+ * times. "blowfish2" uses a 8 byte buffer to avoid repeating. */
+ bfs->cfb_len = state->method_nr == CRYPT_M_BF ? BF_MAX_CFB_LEN : BF_BLOCK;
-/*
- * Save the current crypt state. Can only be used once before
- * bf_crypt_restore().
- */
- void
-bf_crypt_save()
-{
- save_randbyte_offset = randbyte_offset;
- save_update_offset = update_offset;
- mch_memmove(save_cfb_buffer, cfb_buffer, BF_CFB_LEN);
- mch_memmove(save_pax, pax, 4 * 18);
- mch_memmove(save_sbx, sbx, 4 * 4 * 256);
-}
+ if (blowfish_self_test() == FAIL)
+ return;
-/*
- * Restore the current crypt state. Can only be used after
- * bf_crypt_save().
- */
- void
-bf_crypt_restore()
-{
- randbyte_offset = save_randbyte_offset;
- update_offset = save_update_offset;
- mch_memmove(cfb_buffer, save_cfb_buffer, BF_CFB_LEN);
- mch_memmove(pax, save_pax, 4 * 18);
- mch_memmove(sbx, save_sbx, 4 * 4 * 256);
+ bf_key_init(bfs, key, salt, salt_len);
+ bf_cfb_init(bfs, seed, seed_len);
}
/*
diff --git a/src/buffer.c b/src/buffer.c
index 03ddb5f..fec43d2 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -28,9 +28,9 @@
#include "vim.h"
#if defined(FEAT_CMDL_COMPL) || defined(FEAT_LISTCMDS) || defined(FEAT_EVAL) || defined(FEAT_PERL)
-static char_u *buflist_match __ARGS((regprog_T *prog, buf_T *buf));
+static char_u *buflist_match __ARGS((regmatch_T *rmp, buf_T *buf, int ignore_case));
# define HAVE_BUFLIST_MATCH
-static char_u *fname_match __ARGS((regprog_T *prog, char_u *name));
+static char_u *fname_match __ARGS((regmatch_T *rmp, char_u *name, int ignore_case));
#endif
static void buflist_setfpos __ARGS((buf_T *buf, win_T *win, linenr_T lnum, colnr_T col, int copy_options));
static wininfo_T *find_wininfo __ARGS((buf_T *buf, int skip_diff_buffer));
@@ -2005,6 +2005,7 @@ free_buf_options(buf, free_p_ff)
#ifdef FEAT_LISP
clear_string_option(&buf->b_p_lw);
#endif
+ clear_string_option(&buf->b_p_bkc);
}
/*
@@ -2223,7 +2224,6 @@ buflist_findpat(pattern, pattern_end, unlisted, diffmode, curtab_only)
int curtab_only; /* find buffers in current tab only */
{
buf_T *buf;
- regprog_T *prog;
int match = -1;
int find_listed;
char_u *pat;
@@ -2268,14 +2268,16 @@ buflist_findpat(pattern, pattern_end, unlisted, diffmode, curtab_only)
{
for (attempt = 0; attempt <= 3; ++attempt)
{
+ regmatch_T regmatch;
+
/* may add '^' and '$' */
if (toggledollar)
*patend = (attempt < 2) ? NUL : '$'; /* add/remove '$' */
p = pat;
if (*p == '^' && !(attempt & 1)) /* add/remove '^' */
++p;
- prog = vim_regcomp(p, p_magic ? RE_MAGIC : 0);
- if (prog == NULL)
+ regmatch.regprog = vim_regcomp(p, p_magic ? RE_MAGIC : 0);
+ if (regmatch.regprog == NULL)
{
vim_free(pat);
return -1;
@@ -2286,7 +2288,7 @@ buflist_findpat(pattern, pattern_end, unlisted, diffmode, curtab_only)
#ifdef FEAT_DIFF
&& (!diffmode || diff_mode_buf(buf))
#endif
- && buflist_match(prog, buf) != NULL)
+ && buflist_match(&regmatch, buf, FALSE) != NULL)
{
if (curtab_only)
{
@@ -2313,7 +2315,7 @@ buflist_findpat(pattern, pattern_end, unlisted, diffmode, curtab_only)
match = buf->b_fnum; /* remember first match */
}
- vim_regfree(prog);
+ vim_regfree(regmatch.regprog);
if (match >= 0) /* found one match */
break;
}
@@ -2355,7 +2357,6 @@ ExpandBufnames(pat, num_file, file, options)
int round;
char_u *p;
int attempt;
- regprog_T *prog;
char_u *patc;
*num_file = 0; /* return values in case of FAIL */
@@ -2379,10 +2380,12 @@ ExpandBufnames(pat, num_file, file, options)
*/
for (attempt = 0; attempt <= 1; ++attempt)
{
+ regmatch_T regmatch;
+
if (attempt > 0 && patc == pat)
break; /* there was no anchor, no need to try again */
- prog = vim_regcomp(patc + attempt * 11, RE_MAGIC);
- if (prog == NULL)
+ regmatch.regprog = vim_regcomp(patc + attempt * 11, RE_MAGIC);
+ if (regmatch.regprog == NULL)
{
if (patc != pat)
vim_free(patc);
@@ -2400,7 +2403,7 @@ ExpandBufnames(pat, num_file, file, options)
{
if (!buf->b_p_bl) /* skip unlisted buffers */
continue;
- p = buflist_match(prog, buf);
+ p = buflist_match(&regmatch, buf, p_wic);
if (p != NULL)
{
if (round == 1)
@@ -2422,14 +2425,14 @@ ExpandBufnames(pat, num_file, file, options)
*file = (char_u **)alloc((unsigned)(count * sizeof(char_u *)));
if (*file == NULL)
{
- vim_regfree(prog);
+ vim_regfree(regmatch.regprog);
if (patc != pat)
vim_free(patc);
return FAIL;
}
}
}
- vim_regfree(prog);
+ vim_regfree(regmatch.regprog);
if (count) /* match(es) found, break here */
break;
}
@@ -2448,16 +2451,17 @@ ExpandBufnames(pat, num_file, file, options)
* Check for a match on the file name for buffer "buf" with regprog "prog".
*/
static char_u *
-buflist_match(prog, buf)
- regprog_T *prog;
+buflist_match(rmp, buf, ignore_case)
+ regmatch_T *rmp;
buf_T *buf;
+ int ignore_case; /* when TRUE ignore case, when FALSE use 'fic' */
{
char_u *match;
/* First try the short file name, then the long file name. */
- match = fname_match(prog, buf->b_sfname);
+ match = fname_match(rmp, buf->b_sfname, ignore_case);
if (match == NULL)
- match = fname_match(prog, buf->b_ffname);
+ match = fname_match(rmp, buf->b_ffname, ignore_case);
return match;
}
@@ -2467,25 +2471,25 @@ buflist_match(prog, buf)
* Return "name" when there is a match, NULL when not.
*/
static char_u *
-fname_match(prog, name)
- regprog_T *prog;
+fname_match(rmp, name, ignore_case)
+ regmatch_T *rmp;
char_u *name;
+ int ignore_case; /* when TRUE ignore case, when FALSE use 'fic' */
{
char_u *match = NULL;
char_u *p;
- regmatch_T regmatch;
if (name != NULL)
{
- regmatch.regprog = prog;
- regmatch.rm_ic = p_fic; /* ignore case when 'fileignorecase' is set */
- if (vim_regexec(&regmatch, name, (colnr_T)0))
+ /* Ignore case when 'fileignorecase' or the argument is set. */
+ rmp->rm_ic = p_fic || ignore_case;
+ if (vim_regexec(rmp, name, (colnr_T)0))
match = name;
else
{
/* Replace $(HOME) with '~' and try matching again. */
p = home_replace_save(NULL, name);
- if (p != NULL && vim_regexec(&regmatch, p, (colnr_T)0))
+ if (p != NULL && vim_regexec(rmp, p, (colnr_T)0))
match = name;
vim_free(p);
}
diff --git a/src/charset.c b/src/charset.c
index e7aabe7..e9745c0 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1185,6 +1185,14 @@ win_lbr_chartabsize(wp, line, s, col, headp)
col -= W_WIDTH(wp);
numberextra = W_WIDTH(wp) - (numberextra - win_col_off2(wp));
if (numberextra > 0)
+ col %= numberextra;
+ if (*p_sbr != NUL)
+ {
+ colnr_T sbrlen = (colnr_T)MB_CHARLEN(p_sbr);
+ if (col >= sbrlen)
+ col -= sbrlen;
+ }
+ if (numberextra > 0)
col = col % numberextra;
}
if (col == 0 || col + size > (colnr_T)W_WIDTH(wp))
@@ -1195,10 +1203,7 @@ win_lbr_chartabsize(wp, line, s, col, headp)
if (wp->w_p_bri)
added += get_breakindent_win(wp, line);
- if (tab_corr)
- size += (added / wp->w_buffer->b_p_ts) * wp->w_buffer->b_p_ts;
- else
- size += added;
+ size += added;
if (col != 0)
added = 0;
}
diff --git a/src/config.h.in b/src/config.h.in
index 7f16e62..b8168a5 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -446,3 +446,6 @@
/* Define if we have AvailabilityMacros.h on Mac OS X */
#undef HAVE_AVAILABILITYMACROS_H
+
+/* Define if Xutf8SetWMProperties() is in an X library. */
+#undef HAVE_XUTF8SETWMPROPERTIES
diff --git a/src/config.mk.in b/src/config.mk.in
index a8bd68d..5f06064 100644
--- a/src/config.mk.in
+++ b/src/config.mk.in
@@ -55,6 +55,7 @@ MZSCHEME_MZC = @MZSCHEME_MZC@
PERL = @vi_cv_path_perl@
PERLLIB = @vi_cv_perllib@
PERLSITELIB = @vi_cv_perlsitelib@
+PERL_XSUBPP = @vi_cv_perl_xsubpp@
PERL_LIBS = @PERL_LIBS@
SHRPENV = @shrpenv@
PERL_SRC = @PERL_SRC@
diff --git a/src/configure.in b/src/configure.in
index 16a7daa..7758c34 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -949,6 +949,14 @@ if test "$enable_perlinterp" = "yes" -o "$enable_perlinterp" = "dynamic"; then
vi_cv_perlsitelib=`$vi_cv_path_perl -MConfig -e 'print $Config{sitelibexp}'`
AC_SUBST(vi_cv_perllib)
AC_SUBST(vi_cv_perlsitelib)
+ vi_cv_perl_extutils=unknown_perl_extutils_path
+ for extutils_rel_path in ExtUtils vendor_perl/ExtUtils; do
+ xsubpp_path="$vi_cv_perllib/$extutils_rel_path/xsubpp"
+ if test -f "$xsubpp_path"; then
+ vi_cv_perl_xsubpp="$xsubpp_path"
+ fi
+ done
+ AC_SUBST(vi_cv_perl_xsubpp)
dnl Remove "-fno-something", it breaks using cproto.
perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
-e 'ccflags;perl_inc;print"\n"' | sed -e 's/-fno[[^ ]]*//'`
@@ -1057,6 +1065,10 @@ AC_ARG_ENABLE(pythoninterp,
[enable_pythoninterp="no"])
AC_MSG_RESULT($enable_pythoninterp)
if test "$enable_pythoninterp" = "yes" -o "$enable_pythoninterp" = "dynamic"; then
+ if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
+ AC_MSG_ERROR([cannot use Python with tiny or small features])
+ fi
+
dnl -- find the python executable
AC_PATH_PROGS(vi_cv_path_python, python2 python)
if test "X$vi_cv_path_python" != "X"; then
@@ -1269,6 +1281,10 @@ AC_ARG_ENABLE(python3interp,
[enable_python3interp="no"])
AC_MSG_RESULT($enable_python3interp)
if test "$enable_python3interp" = "yes" -o "$enable_python3interp" = "dynamic"; then
+ if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
+ AC_MSG_ERROR([cannot use Python with tiny or small features])
+ fi
+
dnl -- find the python3 executable
AC_PATH_PROGS(vi_cv_path_python3, python3 python)
if test "X$vi_cv_path_python3" != "X"; then
@@ -1746,6 +1762,10 @@ AC_ARG_ENABLE(rubyinterp,
[enable_rubyinterp="no"])
AC_MSG_RESULT($enable_rubyinterp)
if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then
+ if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
+ AC_MSG_ERROR([cannot use Ruby with tiny or small features])
+ fi
+
AC_MSG_CHECKING(--with-ruby-command argument)
AC_SUBST(vi_cv_path_ruby)
AC_ARG_WITH(ruby-command, [ --with-ruby-command=RUBY name of the Ruby command (default: ruby)],
@@ -3782,21 +3802,24 @@ fi
dnl Check for multibyte locale functions
dnl Find out if _Xsetlocale() is supported by libX11.
dnl Check if X_LOCALE should be defined.
-
-if test "$enable_multibyte" = "yes"; then
+if test "x$with_x" = "xyes"; then
cflags_save=$CFLAGS
- ldflags_save=$LDFLAGS
- if test "x$x_includes" != "xNONE" ; then
- CFLAGS="$CFLAGS -I$x_includes"
- LDFLAGS="$X_LIBS $LDFLAGS -lX11"
- AC_MSG_CHECKING(whether X_LOCALE needed)
- AC_TRY_COMPILE([#include <X11/Xlocale.h>],,
- AC_TRY_LINK_FUNC([_Xsetlocale], [AC_MSG_RESULT(yes)
- AC_DEFINE(X_LOCALE)], AC_MSG_RESULT(no)),
- AC_MSG_RESULT(no))
- fi
+ libs_save=$LIBS
+ LIBS="$LIBS $X_LIBS $GUI_LIB_LOC $GUI_X_LIBS $X_PRE_LIBS $X_LIB $X_EXTRA_LIBS"
+ CFLAGS="$CFLAGS $X_CFLAGS"
+
+ AC_MSG_CHECKING(whether X_LOCALE needed)
+ AC_TRY_COMPILE([#include <X11/Xlocale.h>],,
+ AC_TRY_LINK_FUNC([_Xsetlocale], [AC_MSG_RESULT(yes)
+ AC_DEFINE(X_LOCALE)], AC_MSG_RESULT(no)),
+ AC_MSG_RESULT(no))
+
+ AC_MSG_CHECKING(whether Xutf8SetWMProperties() can be used)
+ AC_TRY_LINK_FUNC([Xutf8SetWMProperties], [AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_XUTF8SETWMPROPERTIES)], AC_MSG_RESULT(no))
+
CFLAGS=$cflags_save
- LDFLAGS=$ldflags_save
+ LIBS=$libs_save
fi
dnl Link with xpg4, it is said to make Korean locale working
@@ -3878,7 +3901,7 @@ if test "$enable_nls" = "yes"; then
else
AC_MSG_RESULT([msgfmt not found - disabled]);
fi
- if test $have_gettext = "yes"; then
+ if test $have_gettext = "yes" -a "x$features" != "xtiny" -a "x$features" != "xsmall"; then
AC_DEFINE(HAVE_GETTEXT)
MAKEMO=yes
AC_SUBST(MAKEMO)
diff --git a/src/crypt.c b/src/crypt.c
new file mode 100644
index 0000000..f25a2c4
--- /dev/null
+++ b/src/crypt.c
@@ -0,0 +1,605 @@
+/* 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.
+ */
+
+/*
+ * crypt.c: Generic encryption support.
+ */
+#include "vim.h"
+
+#if defined(FEAT_CRYPT) || defined(PROTO)
+/*
+ * Optional encryption support.
+ * Mohsin Ahmed, mosh@sasi.com, 1998-09-24
+ * Based on zip/crypt sources.
+ * Refactored by David Leadbeater, 2014.
+ *
+ * NOTE FOR USA: Since 2000 exporting this code from the USA is allowed to
+ * most countries. There are a few exceptions, but that still should not be a
+ * problem since this code was originally created in Europe and India.
+ *
+ * Blowfish addition originally made by Mohsin Ahmed,
+ * http://www.cs.albany.edu/~mosh 2010-03-14
+ * Based on blowfish by Bruce Schneier (http://www.schneier.com/blowfish.html)
+ * and sha256 by Christophe Devine.
+ */
+
+typedef struct {
+ char *name; /* encryption name as used in 'cryptmethod' */
+ char *magic; /* magic bytes stored in file header */
+ int salt_len; /* length of salt, or 0 when not using salt */
+ int seed_len; /* length of seed, or 0 when not using salt */
+ int works_inplace; /* encryption/decryption can be done in-place */
+ int whole_undofile; /* whole undo file is encrypted */
+
+ /* Optional function pointer for a self-test. */
+ int (* self_test_fn)();
+
+ /* Function pointer for initializing encryption/decription. */
+ void (* init_fn)(cryptstate_T *state, char_u *key,
+ char_u *salt, int salt_len, char_u *seed, int seed_len);
+
+ /* Function pointers for encoding/decoding from one buffer into another.
+ * Optional, however, these or the _buffer ones should be configured. */
+ void (*encode_fn)(cryptstate_T *state, char_u *from, size_t len,
+ char_u *to);
+ void (*decode_fn)(cryptstate_T *state, char_u *from, size_t len,
+ char_u *to);
+
+ /* Function pointers for encoding and decoding, can buffer data if needed.
+ * Optional (however, these or the above should be configured). */
+ long (*encode_buffer_fn)(cryptstate_T *state, char_u *from, size_t len,
+ char_u **newptr);
+ long (*decode_buffer_fn)(cryptstate_T *state, char_u *from, size_t len,
+ char_u **newptr);
+
+ /* Function pointers for in-place encoding and decoding, used for
+ * crypt_*_inplace(). "from" and "to" arguments will be equal.
+ * These may be the same as decode_fn and encode_fn above, however an
+ * algorithm may implement them in a way that is not interchangeable with
+ * the crypt_(en|de)code() interface (for example because it wishes to add
+ * padding to files).
+ * This method is used for swap and undo files which have a rigid format.
+ */
+ void (*encode_inplace_fn)(cryptstate_T *state, char_u *p1, size_t len,
+ char_u *p2);
+ void (*decode_inplace_fn)(cryptstate_T *state, char_u *p1, size_t len,
+ char_u *p2);
+} cryptmethod_T;
+
+/* index is method_nr of cryptstate_T, CRYPT_M_* */
+static cryptmethod_T cryptmethods[CRYPT_M_COUNT] = {
+ /* PK_Zip; very weak */
+ {
+ "zip",
+ "VimCrypt~01!",
+ 0,
+ 0,
+ TRUE,
+ FALSE,
+ NULL,
+ crypt_zip_init,
+ crypt_zip_encode, crypt_zip_decode,
+ NULL, NULL,
+ crypt_zip_encode, crypt_zip_decode,
+ },
+
+ /* Blowfish/CFB + SHA-256 custom key derivation; implementation issues. */
+ {
+ "blowfish",
+ "VimCrypt~02!",
+ 8,
+ 8,
+ TRUE,
+ FALSE,
+ blowfish_self_test,
+ crypt_blowfish_init,
+ crypt_blowfish_encode, crypt_blowfish_decode,
+ NULL, NULL,
+ crypt_blowfish_encode, crypt_blowfish_decode,
+ },
+
+ /* Blowfish/CFB + SHA-256 custom key derivation; fixed. */
+ {
+ "blowfish2",
+ "VimCrypt~03!",
+ 8,
+ 8,
+ TRUE,
+ TRUE,
+ blowfish_self_test,
+ crypt_blowfish_init,
+ crypt_blowfish_encode, crypt_blowfish_decode,
+ NULL, NULL,
+ crypt_blowfish_encode, crypt_blowfish_decode,
+ },
+};
+
+#define CRYPT_MAGIC_LEN 12 /* cannot change */
+static char crypt_magic_head[] = "VimCrypt~";
+
+/*
+ * Return int value for crypt method name.
+ * 0 for "zip", the old method. Also for any non-valid value.
+ * 1 for "blowfish".
+ * 2 for "blowfish2".
+ */
+ int
+crypt_method_nr_from_name(name)
+ char_u *name;
+{
+ int i;
+
+ for (i = 0; i < CRYPT_M_COUNT; ++i)
+ if (STRCMP(name, cryptmethods[i].name) == 0)
+ return i;
+ return 0;
+}
+
+/*
+ * Get the crypt method used for a file from "ptr[len]", the magic text at the
+ * start of the file.
+ * Returns -1 when no encryption used.
+ */
+ int
+crypt_method_nr_from_magic(ptr, len)
+ char *ptr;
+ int len;
+{
+ int i;
+
+ if (len < CRYPT_MAGIC_LEN)
+ return -1;
+
+ for (i = 0; i < CRYPT_M_COUNT; i++)
+ if (memcmp(ptr, cryptmethods[i].magic, CRYPT_MAGIC_LEN) == 0)
+ return i;
+
+ i = (int)STRLEN(crypt_magic_head);
+ if (len >= i && memcmp(ptr, crypt_magic_head, i) == 0)
+ EMSG(_("E821: File is encrypted with unknown method"));
+
+ return -1;
+}
+
+/*
+ * Return TRUE if the crypt method for "method_nr" can be done in-place.
+ */
+ int
+crypt_works_inplace(state)
+ cryptstate_T *state;
+{
+ return cryptmethods[state->method_nr].works_inplace;
+}
+
+/*
+ * Get the crypt method for buffer "buf" as a number.
+ */
+ int
+crypt_get_method_nr(buf)
+ buf_T *buf;
+{
+ return crypt_method_nr_from_name(*buf->b_p_cm == NUL ? p_cm : buf->b_p_cm);
+}
+
+/*
+ * Return TRUE when the buffer uses an encryption method that encrypts the
+ * whole undo file, not only the text.
+ */
+ int
+crypt_whole_undofile(method_nr)
+ int method_nr;
+{
+ return cryptmethods[method_nr].whole_undofile;
+}
+
+/*
+ * Get crypt method specifc length of the file header in bytes.
+ */
+ int
+crypt_get_header_len(method_nr)
+ int method_nr;
+{
+ return CRYPT_MAGIC_LEN
+ + cryptmethods[method_nr].salt_len
+ + cryptmethods[method_nr].seed_len;
+}
+
+/*
+ * Set the crypt method for buffer "buf" to "method_nr" using the int value as
+ * returned by crypt_method_nr_from_name().
+ */
+ void
+crypt_set_cm_option(buf, method_nr)
+ buf_T *buf;
+ int method_nr;
+{
+ free_string_option(buf->b_p_cm);
+ buf->b_p_cm = vim_strsave((char_u *)cryptmethods[method_nr].name);
+}
+
+/*
+ * If the crypt method for the current buffer has a self-test, run it and
+ * return OK/FAIL.
+ */
+ int
+crypt_self_test()
+{
+ int method_nr = crypt_get_method_nr(curbuf);
+
+ if (cryptmethods[method_nr].self_test_fn == NULL)
+ return OK;
+ return cryptmethods[method_nr].self_test_fn();
+}
+
+/*
+ * Allocate a crypt state and initialize it.
+ */
+ cryptstate_T *
+crypt_create(method_nr, key, salt, salt_len, seed, seed_len)
+ int method_nr;
+ char_u *key;
+ char_u *salt;
+ int salt_len;
+ char_u *seed;
+ int seed_len;
+{
+ cryptstate_T *state = (cryptstate_T *)alloc((int)sizeof(cryptstate_T));
+
+ state->method_nr = method_nr;
+ cryptmethods[method_nr].init_fn(state, key, salt, salt_len, seed, seed_len);
+ return state;
+}
+
+/*
+ * Allocate a crypt state from a file header and initialize it.
+ * Assumes that header contains at least the number of bytes that
+ * crypt_get_header_len() returns for "method_nr".
+ */
+ cryptstate_T *
+crypt_create_from_header(method_nr, key, header)
+ int method_nr;
+ char_u *key;
+ char_u *header;
+{
+ char_u *salt = NULL;
+ char_u *seed = NULL;
+ int salt_len = cryptmethods[method_nr].salt_len;
+ int seed_len = cryptmethods[method_nr].seed_len;
+
+ if (salt_len > 0)
+ salt = header + CRYPT_MAGIC_LEN;
+ if (seed_len > 0)
+ seed = header + CRYPT_MAGIC_LEN + salt_len;
+
+ return crypt_create(method_nr, key, salt, salt_len, seed, seed_len);
+}
+
+/*
+ * Read the crypt method specific header data from "fp".
+ * Return an allocated cryptstate_T or NULL on error.
+ */
+ cryptstate_T *
+crypt_create_from_file(fp, key)
+ FILE *fp;
+ char_u *key;
+{
+ int method_nr;
+ int header_len;
+ char magic_buffer[CRYPT_MAGIC_LEN];
+ char_u *buffer;
+ cryptstate_T *state;
+
+ if (fread(magic_buffer, CRYPT_MAGIC_LEN, 1, fp) != 1)
+ return NULL;
+ method_nr = crypt_method_nr_from_magic(magic_buffer, CRYPT_MAGIC_LEN);
+ if (method_nr < 0)
+ return NULL;
+
+ header_len = crypt_get_header_len(method_nr);
+ if ((buffer = alloc(header_len)) == NULL)
+ return NULL;
+ mch_memmove(buffer, magic_buffer, CRYPT_MAGIC_LEN);
+ if (header_len > CRYPT_MAGIC_LEN
+ && fread(buffer + CRYPT_MAGIC_LEN,
+ header_len - CRYPT_MAGIC_LEN, 1, fp) != 1)
+ {
+ vim_free(buffer);
+ return NULL;
+ }
+
+ state = crypt_create_from_header(method_nr, key, buffer);
+ vim_free(buffer);
+ return state;
+}
+
+/*
+ * Allocate a cryptstate_T for writing and initialize it with "key".
+ * Allocates and fills in the header and stores it in "header", setting
+ * "header_len". The header may include salt and seed, depending on
+ * cryptmethod. Caller must free header.
+ * Returns the state or NULL on failure.
+ */
+ cryptstate_T *
+crypt_create_for_writing(method_nr, key, header, header_len)
+ int method_nr;
+ char_u *key;
+ char_u **header;
+ int *header_len;
+{
+ int len = crypt_get_header_len(method_nr);
+ char_u *salt = NULL;
+ char_u *seed = NULL;
+ int salt_len = cryptmethods[method_nr].salt_len;
+ int seed_len = cryptmethods[method_nr].seed_len;
+ cryptstate_T *state;
+
+ *header_len = len;
+ *header = alloc(len);
+ if (*header == NULL)
+ return NULL;
+
+ mch_memmove(*header, cryptmethods[method_nr].magic, CRYPT_MAGIC_LEN);
+ if (salt_len > 0 || seed_len > 0)
+ {
+ if (salt_len > 0)
+ salt = *header + CRYPT_MAGIC_LEN;
+ if (seed_len > 0)
+ seed = *header + CRYPT_MAGIC_LEN + salt_len;
+
+ /* TODO: Should this be crypt method specific? (Probably not worth
+ * it). sha2_seed is pretty bad for large amounts of entropy, so make
+ * that into something which is suitable for anything. */
+ sha2_seed(salt, salt_len, seed, seed_len);
+ }
+
+ state = crypt_create(method_nr, key, salt, salt_len, seed, seed_len);
+ if (state == NULL)
+ {
+ vim_free(*header);
+ *header = NULL;
+ }
+ return state;
+}
+
+/*
+ * Free the crypt state.
+ */
+ void
+crypt_free_state(state)
+ cryptstate_T *state;
+{
+ vim_free(state->method_state);
+ vim_free(state);
+}
+
+/*
+ * Encode "from[len]" and store the result in a newly allocated buffer, which
+ * is stored in "newptr".
+ * Return number of bytes in "newptr", 0 for need more or -1 on error.
+ */
+ long
+crypt_encode_alloc(state, from, len, newptr)
+ cryptstate_T *state;
+ char_u *from;
+ size_t len;
+ char_u **newptr;
+{
+ cryptmethod_T *method = &cryptmethods[state->method_nr];
+
+ if (method->encode_buffer_fn != NULL)
+ /* Has buffer function, pass through. */
+ return method->encode_buffer_fn(state, from, len, newptr);
+ if (len == 0)
+ /* Not buffering, just return EOF. */
+ return (long)len;
+
+ *newptr = alloc((long)len);
+ if (*newptr == NULL)
+ return -1;
+ method->encode_fn(state, from, len, *newptr);
+ return (long)len;
+}
+
+/*
+ * Decrypt "ptr[len]" and store the result in a newly allocated buffer, which
+ * is stored in "newptr".
+ * Return number of bytes in "newptr", 0 for need more or -1 on error.
+ */
+ long
+crypt_decode_alloc(state, ptr, len, newptr)
+ cryptstate_T *state;
+ char_u *ptr;
+ long len;
+ char_u **newptr;
+{
+ cryptmethod_T *method = &cryptmethods[state->method_nr];
+
+ if (method->decode_buffer_fn != NULL)
+ /* Has buffer function, pass through. */
+ return method->decode_buffer_fn(state, ptr, len, newptr);
+
+ if (len == 0)
+ /* Not buffering, just return EOF. */
+ return len;
+
+ *newptr = alloc(len);
+ if (*newptr == NULL)
+ return -1;
+ method->decode_fn(state, ptr, len, *newptr);
+ return len;
+}
+
+/*
+ * Encrypting "from[len]" into "to[len]".
+ */
+ void
+crypt_encode(state, from, len, to)
+ cryptstate_T *state;
+ char_u *from;
+ size_t len;
+ char_u *to;
+{
+ cryptmethods[state->method_nr].encode_fn(state, from, len, to);
+}
+
+/*
+ * decrypting "from[len]" into "to[len]".
+ */
+ void
+crypt_decode(state, from, len, to)
+ cryptstate_T *state;
+ char_u *from;
+ size_t len;
+ char_u *to;
+{
+ cryptmethods[state->method_nr].decode_fn(state, from, len, to);
+}
+
+/*
+ * Simple inplace encryption, modifies "buf[len]" in place.
+ */
+ void
+crypt_encode_inplace(state, buf, len)
+ cryptstate_T *state;
+ char_u *buf;
+ size_t len;
+{
+ cryptmethods[state->method_nr].encode_inplace_fn(state, buf, len, buf);
+}
+
+/*
+ * Simple inplace decryption, modifies "buf[len]" in place.
+ */
+ void
+crypt_decode_inplace(state, buf, len)
+ cryptstate_T *state;
+ char_u *buf;
+ size_t len;
+{
+ cryptmethods[state->method_nr].decode_inplace_fn(state, buf, len, buf);
+}
+
+/*
+ * Free an allocated crypt key. Clear the text to make sure it doesn't stay
+ * in memory anywhere.
+ */
+ void
+crypt_free_key(key)
+ char_u *key;
+{
+ char_u *p;
+
+ if (key != NULL)
+ {
+ for (p = key; *p != NUL; ++p)
+ *p = 0;
+ vim_free(key);
+ }
+}
+
+/*
+ * Check the crypt method and give a warning if it's outdated.
+ */
+ void
+crypt_check_method(method)
+ int method;
+{
+ if (method < CRYPT_M_BF2)
+ {
+ msg_scroll = TRUE;
+ MSG(_("Warning: Using a weak encryption method; see :help 'cm'"));
+ }
+}
+
+ void
+crypt_check_current_method()
+{
+ crypt_check_method(crypt_get_method_nr(curbuf));
+}
+
+/*
+ * Ask the user for a crypt key.
+ * When "store" is TRUE, the new key is stored in the 'key' option, and the
+ * 'key' option value is returned: Don't free it.
+ * When "store" is FALSE, the typed key is returned in allocated memory.
+ * Returns NULL on failure.
+ */
+ char_u *
+crypt_get_key(store, twice)
+ int store;
+ int twice; /* Ask for the key twice. */
+{
+ char_u *p1, *p2 = NULL;
+ int round;
+
+ for (round = 0; ; ++round)
+ {
+ cmdline_star = TRUE;
+ cmdline_row = msg_row;
+ p1 = getcmdline_prompt(NUL, round == 0
+ ? (char_u *)_("Enter encryption key: ")
+ : (char_u *)_("Enter same key again: "), 0, EXPAND_NOTHING,
+ NULL);
+ cmdline_star = FALSE;
+
+ if (p1 == NULL)
+ break;
+
+ if (round == twice)
+ {
+ if (p2 != NULL && STRCMP(p1, p2) != 0)
+ {
+ MSG(_("Keys don't match!"));
+ crypt_free_key(p1);
+ crypt_free_key(p2);
+ p2 = NULL;
+ round = -1; /* do it again */
+ continue;
+ }
+
+ if (store)
+ {
+ set_option_value((char_u *)"key", 0L, p1, OPT_LOCAL);
+ crypt_free_key(p1);
+ p1 = curbuf->b_p_key;
+ }
+ break;
+ }
+ p2 = p1;
+ }
+
+ /* since the user typed this, no need to wait for return */
+ if (msg_didout)
+ msg_putchar('\n');
+ need_wait_return = FALSE;
+ msg_didout = FALSE;
+
+ crypt_free_key(p2);
+ return p1;
+}
+
+
+/*
+ * Append a message to IObuff for the encryption/decryption method being used.
+ */
+ void
+crypt_append_msg(buf)
+ buf_T *buf;
+{
+ if (crypt_get_method_nr(buf) == 0)
+ STRCAT(IObuff, _("[crypted]"));
+ else
+ {
+ STRCAT(IObuff, "[");
+ STRCAT(IObuff, *buf->b_p_cm == NUL ? p_cm : buf->b_p_cm);
+ STRCAT(IObuff, "]");
+ }
+}
+
+#endif /* FEAT_CRYPT */
diff --git a/src/crypt_zip.c b/src/crypt_zip.c
new file mode 100644
index 0000000..571f3ec
--- /dev/null
+++ b/src/crypt_zip.c
@@ -0,0 +1,158 @@
+/* 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.
+ */
+
+/*
+ * crypt_zip.c: Zip encryption support.
+ */
+#include "vim.h"
+
+#if defined(FEAT_CRYPT) || defined(PROTO)
+/*
+ * Optional encryption support.
+ * Mohsin Ahmed, mosh@sasi.com, 98-09-24
+ * Based on zip/crypt sources.
+ *
+ * NOTE FOR USA: Since 2000 exporting this code from the USA is allowed to
+ * most countries. There are a few exceptions, but that still should not be a
+ * problem since this code was originally created in Europe and India.
+ */
+
+/* Need a type that should be 32 bits. 64 also works but wastes space. */
+# if VIM_SIZEOF_INT >= 4
+typedef unsigned int u32_T; /* int is at least 32 bits */
+# else
+typedef unsigned long u32_T; /* long should be 32 bits or more */
+# endif
+
+/* The state of encryption, referenced by cryptstate_T. */
+typedef struct {
+ u32_T keys[3];
+} zip_state_T;
+
+
+static void make_crc_tab __ARGS((void));
+
+static u32_T crc_32_table[256];
+
+/*
+ * Fill the CRC table, if not done already.
+ */
+ static void
+make_crc_tab()
+{
+ u32_T s, t, v;
+ static int done = FALSE;
+
+ if (done)
+ return;
+ for (t = 0; t < 256; t++)
+ {
+ v = t;
+ for (s = 0; s < 8; s++)
+ v = (v >> 1) ^ ((v & 1) * (u32_T)0xedb88320L);
+ crc_32_table[t] = v;
+ }
+ done = TRUE;
+}
+
+#define CRC32(c, b) (crc_32_table[((int)(c) ^ (b)) & 0xff] ^ ((c) >> 8))
+
+/*
+ * Return the next byte in the pseudo-random sequence.
+ */
+#define DECRYPT_BYTE_ZIP(keys, t) { \
+ short_u temp = (short_u)keys[2] | 2; \
+ t = (int)(((unsigned)(temp * (temp ^ 1U)) >> 8) & 0xff); \
+}
+
+/*
+ * Update the encryption keys with the next byte of plain text.
+ */
+#define UPDATE_KEYS_ZIP(keys, c) { \
+ keys[0] = CRC32(keys[0], (c)); \
+ keys[1] += keys[0] & 0xff; \
+ keys[1] = keys[1] * 134775813L + 1; \
+ keys[2] = CRC32(keys[2], (int)(keys[1] >> 24)); \
+}
+
+/*
+ * Initialize for encryption/decryption.
+ */
+ void
+crypt_zip_init(state, key, salt, salt_len, seed, seed_len)
+ cryptstate_T *state;
+ char_u *key;
+ char_u *salt UNUSED;
+ int salt_len UNUSED;
+ char_u *seed UNUSED;
+ int seed_len UNUSED;
+{
+ char_u *p;
+ zip_state_T *zs;
+
+ zs = (zip_state_T *)alloc(sizeof(zip_state_T));
+ state->method_state = zs;
+
+ make_crc_tab();
+ zs->keys[0] = 305419896L;
+ zs->keys[1] = 591751049L;
+ zs->keys[2] = 878082192L;
+ for (p = key; *p != NUL; ++p)
+ {
+ UPDATE_KEYS_ZIP(zs->keys, (int)*p);
+ }
+}
+
+/*
+ * Encrypt "from[len]" into "to[len]".
+ * "from" and "to" can be equal to encrypt in place.
+ */
+ void
+crypt_zip_encode(state, from, len, to)
+ cryptstate_T *state;
+ char_u *from;
+ size_t len;
+ char_u *to;
+{
+ zip_state_T *zs = state->method_state;
+ size_t i;
+ int ztemp, t;
+
+ for (i = 0; i < len; ++i)
+ {
+ ztemp = from[i];
+ DECRYPT_BYTE_ZIP(zs->keys, t);
+ UPDATE_KEYS_ZIP(zs->keys, ztemp);
+ to[i] = t ^ ztemp;
+ }
+}
+
+/*
+ * Decrypt "from[len]" into "to[len]".
+ */
+ void
+crypt_zip_decode(state, from, len, to)
+ cryptstate_T *state;
+ char_u *from;
+ size_t len;
+ char_u *to;
+{
+ zip_state_T *zs = state->method_state;
+ size_t i;
+ short_u temp;
+
+ for (i = 0; i < len; ++i)
+ {
+ temp = (short_u)zs->keys[2] | 2;
+ temp = (int)(((unsigned)(temp * (temp ^ 1U)) >> 8) & 0xff);
+ UPDATE_KEYS_ZIP(zs->keys, to[i] = from[i] ^ temp);
+ }
+}
+
+#endif /* FEAT_CRYPT */
diff --git a/src/diff.c b/src/diff.c
index 98b791a..caee6e5 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -2107,12 +2107,20 @@ diff_infold(wp, lnum)
* "dp" and "do" commands.
*/
void
-nv_diffgetput(put)
+nv_diffgetput(put, count)
int put;
+ long count;
{
exarg_T ea;
+ char_u buf[30];
- ea.arg = (char_u *)"";
+ if (count == 0)
+ ea.arg = (char_u *)"";
+ else
+ {
+ vim_snprintf((char *)buf, 30, "%ld", count);
+ ea.arg = buf;
+ }
if (put)
ea.cmdidx = CMD_diffput;
else
@@ -2325,7 +2333,7 @@ ex_diffgetput(eap)
end_skip = 0;
}
- buf_empty = FALSE;
+ buf_empty = bufempty();
added = 0;
for (i = 0; i < count; ++i)
{
diff --git a/src/edit.c b/src/edit.c
index a72ea8b..5f005a1 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -4050,7 +4050,7 @@ expand_by_function(type, base)
goto theend;
}
curwin->w_cursor = pos; /* restore the cursor position */
- check_cursor();
+ validate_cursor();
if (!equalpos(curwin->w_cursor, pos))
{
EMSG(_(e_compldel));
@@ -5288,7 +5288,7 @@ ins_complete(c)
return FAIL;
}
curwin->w_cursor = pos; /* restore the cursor position */
- check_cursor();
+ validate_cursor();
if (!equalpos(curwin->w_cursor, pos))
{
EMSG(_(e_compldel));
@@ -6146,6 +6146,12 @@ internal_format(textwidth, second_indent, flags, format_only, c)
int no_leader = FALSE;
int do_comments = (flags & INSCHAR_DO_COM);
#endif
+#ifdef FEAT_LINEBREAK
+ int has_lbr = curwin->w_p_lbr;
+
+ /* make sure win_lbr_chartabsize() counts correctly */
+ curwin->w_p_lbr = FALSE;
+#endif
/*
* When 'ai' is off we don't want a space under the cursor to be
@@ -6498,6 +6504,9 @@ internal_format(textwidth, second_indent, flags, format_only, c)
if (save_char != NUL) /* put back space after cursor */
pchar_cursor(save_char);
+#ifdef FEAT_LINEBREAK
+ curwin->w_p_lbr = has_lbr;
+#endif
if (!format_only && haveto_redraw)
{
update_topline();
@@ -6783,13 +6792,19 @@ stop_arrow()
{
if (arrow_used)
{
+ Insstart = curwin->w_cursor; /* new insertion starts here */
+ if (Insstart.col > Insstart_orig.col && !ins_need_undo)
+ /* Don't update the original insert position when moved to the
+ * right, except when nothing was inserted yet. */
+ update_Insstart_orig = FALSE;
+ Insstart_textlen = (colnr_T)linetabsize(ml_get_curline());
+
if (u_save_cursor() == OK)
{
arrow_used = FALSE;
ins_need_undo = FALSE;
}
- Insstart = curwin->w_cursor; /* new insertion starts here */
- Insstart_textlen = (colnr_T)linetabsize(ml_get_curline());
+
ai_col = 0;
#ifdef FEAT_VREPLACE
if (State & VREPLACE_FLAG)
@@ -6916,8 +6931,14 @@ stop_insert(end_insert_pos, esc, nomove)
}
if (curwin->w_cursor.lnum != tpos.lnum)
curwin->w_cursor = tpos;
- else if (cc != NUL)
- ++curwin->w_cursor.col; /* put cursor back on the NUL */
+ else
+ {
+ /* reset tpos, could have been invalidated in the loop above */
+ tpos = curwin->w_cursor;
+ tpos.col++;
+ if (cc != NUL && gchar_pos(&tpos) == NUL)
+ ++curwin->w_cursor.col; /* put cursor back on the NUL */
+ }
/* <C-S-Right> may have started Visual mode, adjust the position for
* deleted characters. */
@@ -8404,7 +8425,7 @@ ins_esc(count, cmdchar, nomove)
(void)start_redo_ins();
if (cmdchar == 'r' || cmdchar == 'v')
- stuffReadbuff(ESC_STR); /* no ESC in redo buffer */
+ stuffRedoReadbuff(ESC_STR); /* no ESC in redo buffer */
++RedrawingDisabled;
disabled_redraw = TRUE;
return FALSE; /* repeat the insert */
diff --git a/src/eval.c b/src/eval.c
index 254de32..2cbe24a 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -554,6 +554,7 @@ static void f_getcharmod __ARGS((typval_T *argvars, typval_T *rettv));
static void f_getcmdline __ARGS((typval_T *argvars, typval_T *rettv));
static void f_getcmdpos __ARGS((typval_T *argvars, typval_T *rettv));
static void f_getcmdtype __ARGS((typval_T *argvars, typval_T *rettv));
+static void f_getcmdwintype __ARGS((typval_T *argvars, typval_T *rettv));
static void f_getcwd __ARGS((typval_T *argvars, typval_T *rettv));
static void f_getfontname __ARGS((typval_T *argvars, typval_T *rettv));
static void f_getfperm __ARGS((typval_T *argvars, typval_T *rettv));
@@ -2944,6 +2945,23 @@ set_var_lval(lp, endp, rettv, copy, op)
;
else if (lp->ll_range)
{
+ listitem_T *ll_li = lp->ll_li;
+ int ll_n1 = lp->ll_n1;
+
+ /*
+ * Check whether any of the list items is locked
+ */
+ for (ri = rettv->vval.v_list->lv_first; ri != NULL; )
+ {
+ if (tv_check_lock(ll_li->li_tv.v_lock, lp->ll_name))
+ return;
+ ri = ri->li_next;
+ if (ri == NULL || (!lp->ll_empty2 && lp->ll_n2 == ll_n1))
+ break;
+ ll_li = ll_li->li_next;
+ ++ll_n1;
+ }
+
/*
* Assign the List values to the list items.
*/
@@ -3350,11 +3368,11 @@ set_context_for_expression(xp, arg, cmdidx)
got_eq = TRUE;
xp->xp_context = EXPAND_EXPRESSION;
}
- else if (c == '<'
+ else if ((c == '<' || c == '#')
&& xp->xp_context == EXPAND_FUNCTIONS
&& vim_strchr(xp->xp_pattern, '(') == NULL)
{
- /* Function name can start with "<SNR>" */
+ /* Function name can start with "<SNR>" and contain '#'. */
break;
}
else if (cmdidx != CMD_let || got_eq)
@@ -3645,6 +3663,17 @@ do_unlet_var(lp, name_end, forceit)
else if (lp->ll_range)
{
listitem_T *li;
+ listitem_T *ll_li = lp->ll_li;
+ int ll_n1 = lp->ll_n1;
+
+ while (ll_li != NULL && (lp->ll_empty2 || lp->ll_n2 >= ll_n1))
+ {
+ li = ll_li->li_next;
+ if (tv_check_lock(ll_li->li_tv.v_lock, lp->ll_name))
+ return FAIL;
+ ll_li = li;
+ ++ll_n1;
+ }
/* Delete a range of List items. */
while (lp->ll_li != NULL && (lp->ll_empty2 || lp->ll_n2 >= lp->ll_n1))
@@ -7985,6 +8014,7 @@ static struct fst
{"getcmdline", 0, 0, f_getcmdline},
{"getcmdpos", 0, 0, f_getcmdpos},
{"getcmdtype", 0, 0, f_getcmdtype},
+ {"getcmdwintype", 0, 0, f_getcmdwintype},
{"getcurpos", 0, 0, f_getcurpos},
{"getcwd", 0, 0, f_getcwd},
{"getfontname", 0, 1, f_getfontname},
@@ -10691,18 +10721,20 @@ filter_map(argvars, rettv, map)
{
if (!HASHITEM_EMPTY(hi))
{
+ int r;
+
--todo;
di = HI2DI(hi);
if (tv_check_lock(di->di_tv.v_lock,
(char_u *)_(arg_errmsg)))
break;
vimvars[VV_KEY].vv_str = vim_strsave(di->di_key);
- if (filter_map_one(&di->di_tv, expr, map, &rem) == FAIL
- || did_emsg)
+ r = filter_map_one(&di->di_tv, expr, map, &rem);
+ clear_tv(&vimvars[VV_KEY].vv_tv);
+ if (r == FAIL || did_emsg)
break;
if (!map && rem)
dictitem_remove(d, di);
- clear_tv(&vimvars[VV_KEY].vv_tv);
}
}
hash_unlock(ht);
@@ -10753,6 +10785,7 @@ filter_map_one(tv, expr, map, remp)
if (*s != NUL) /* check for trailing chars after expr */
{
EMSG2(_(e_invexpr2), s);
+ clear_tv(&rettv);
goto theend;
}
if (map)
@@ -11511,6 +11544,26 @@ f_getcmdtype(argvars, rettv)
}
/*
+ * "getcmdwintype()" function
+ */
+ static void
+f_getcmdwintype(argvars, rettv)
+ typval_T *argvars UNUSED;
+ typval_T *rettv;
+{
+ rettv->v_type = VAR_STRING;
+ rettv->vval.v_string = NULL;
+#ifdef FEAT_CMDWIN
+ rettv->vval.v_string = alloc(2);
+ if (rettv->vval.v_string != NULL)
+ {
+ rettv->vval.v_string[0] = cmdwin_type;
+ rettv->vval.v_string[1] = NUL;
+ }
+#endif
+}
+
+/*
* "getcwd()" function
*/
static void
@@ -11966,6 +12019,8 @@ f_getreg(argvars, rettv)
rettv->v_type = VAR_LIST;
rettv->vval.v_list = (list_T *)get_reg_contents(regname,
(arg2 ? GREG_EXPR_SRC : 0) | GREG_LIST);
+ if (rettv->vval.v_list != NULL)
+ ++rettv->vval.v_list->lv_refcount;
}
else
{
@@ -12029,7 +12084,8 @@ f_gettabvar(argvars, rettv)
typval_T *argvars;
typval_T *rettv;
{
- tabpage_T *tp;
+ win_T *oldcurwin;
+ tabpage_T *tp, *oldtabpage;
dictitem_T *v;
char_u *varname;
int done = FALSE;
@@ -12041,13 +12097,23 @@ f_gettabvar(argvars, rettv)
tp = find_tabpage((int)get_tv_number_chk(&argvars[0], NULL));
if (tp != NULL && varname != NULL)
{
- /* look up the variable */
- v = find_var_in_ht(&tp->tp_vars->dv_hashtab, 0, varname, FALSE);
- if (v != NULL)
+ /* Set tp to be our tabpage, temporarily. Also set the window to the
+ * first window in the tabpage, otherwise the window is not valid. */
+ if (switch_win(&oldcurwin, &oldtabpage, tp->tp_firstwin, tp, TRUE)
+ == OK)
{
- copy_tv(&v->di_tv, rettv);
- done = TRUE;
+ /* look up the variable */
+ /* Let gettabvar({nr}, "") return the "t:" dictionary. */
+ v = find_var_in_ht(&tp->tp_vars->dv_hashtab, 't', varname, FALSE);
+ if (v != NULL)
+ {
+ copy_tv(&v->di_tv, rettv);
+ done = TRUE;
+ }
}
+
+ /* restore previous notion of curwin */
+ restore_win(oldcurwin, oldtabpage, TRUE);
}
if (!done && argvars[2].v_type != VAR_UNKNOWN)
@@ -12182,22 +12248,24 @@ getwinvar(argvars, rettv, off)
{
/* Set curwin to be our win, temporarily. Also set the tabpage,
* otherwise the window is not valid. */
- switch_win(&oldcurwin, &oldtabpage, win, tp, TRUE);
-
- if (*varname == '&') /* window-local-option */
- {
- if (get_option_tv(&varname, rettv, 1) == OK)
- done = TRUE;
- }
- else
+ if (switch_win(&oldcurwin, &oldtabpage, win, tp, TRUE) == OK)
{
- /* Look up the variable. */
- /* Let getwinvar({nr}, "") return the "w:" dictionary. */
- v = find_var_in_ht(&win->w_vars->dv_hashtab, 'w', varname, FALSE);
- if (v != NULL)
+ if (*varname == '&') /* window-local-option */
{
- copy_tv(&v->di_tv, rettv);
- done = TRUE;
+ if (get_option_tv(&varname, rettv, 1) == OK)
+ done = TRUE;
+ }
+ else
+ {
+ /* Look up the variable. */
+ /* Let getwinvar({nr}, "") return the "w:" dictionary. */
+ v = find_var_in_ht(&win->w_vars->dv_hashtab, 'w',
+ varname, FALSE);
+ if (v != NULL)
+ {
+ copy_tv(&v->di_tv, rettv);
+ done = TRUE;
+ }
}
}
@@ -12450,6 +12518,9 @@ f_has(argvars, rettv)
#ifdef FEAT_DIGRAPHS
"digraphs",
#endif
+#ifdef FEAT_DIRECTX
+ "directx",
+#endif
#ifdef FEAT_DND
"dnd",
#endif
@@ -17218,34 +17289,33 @@ setwinvar(argvars, rettv, off)
if (win != NULL && varname != NULL && varp != NULL)
{
#ifdef FEAT_WINDOWS
- if (switch_win(&save_curwin, &save_curtab, win, tp, TRUE) == FAIL)
- return;
+ if (switch_win(&save_curwin, &save_curtab, win, tp, TRUE) == OK)
#endif
-
- if (*varname == '&')
{
- long numval;
- char_u *strval;
- int error = FALSE;
-
- ++varname;
- numval = get_tv_number_chk(varp, &error);
- strval = get_tv_string_buf_chk(varp, nbuf);
- if (!error && strval != NULL)
- set_option_value(varname, numval, strval, OPT_LOCAL);
- }
- else
- {
- winvarname = alloc((unsigned)STRLEN(varname) + 3);
- if (winvarname != NULL)
+ if (*varname == '&')
+ {
+ long numval;
+ char_u *strval;
+ int error = FALSE;
+
+ ++varname;
+ numval = get_tv_number_chk(varp, &error);
+ strval = get_tv_string_buf_chk(varp, nbuf);
+ if (!error && strval != NULL)
+ set_option_value(varname, numval, strval, OPT_LOCAL);
+ }
+ else
{
- STRCPY(winvarname, "w:");
- STRCPY(winvarname + 2, varname);
- set_var(winvarname, varp, TRUE);
- vim_free(winvarname);
+ winvarname = alloc((unsigned)STRLEN(varname) + 3);
+ if (winvarname != NULL)
+ {
+ STRCPY(winvarname, "w:");
+ STRCPY(winvarname + 2, varname);
+ set_var(winvarname, varp, TRUE);
+ vim_free(winvarname);
+ }
}
}
-
#ifdef FEAT_WINDOWS
restore_win(save_curwin, save_curtab, TRUE);
#endif
@@ -17385,16 +17455,38 @@ item_compare(s1, s2)
const void *s2;
{
sortItem_T *si1, *si2;
+ typval_T *tv1, *tv2;
char_u *p1, *p2;
- char_u *tofree1, *tofree2;
+ char_u *tofree1 = NULL, *tofree2 = NULL;
int res;
char_u numbuf1[NUMBUFLEN];
char_u numbuf2[NUMBUFLEN];
si1 = (sortItem_T *)s1;
si2 = (sortItem_T *)s2;
- p1 = tv2string(&si1->item->li_tv, &tofree1, numbuf1, 0);
- p2 = tv2string(&si2->item->li_tv, &tofree2, numbuf2, 0);
+ tv1 = &si1->item->li_tv;
+ tv2 = &si2->item->li_tv;
+ /* tv2string() puts quotes around a string and allocates memory. Don't do
+ * that for string variables. Use a single quote when comparing with a
+ * non-string to do what the docs promise. */
+ if (tv1->v_type == VAR_STRING)
+ {
+ if (tv2->v_type != VAR_STRING || item_compare_numeric)
+ p1 = (char_u *)"'";
+ else
+ p1 = tv1->vval.v_string;
+ }
+ else
+ p1 = tv2string(tv1, &tofree1, numbuf1, 0);
+ if (tv2->v_type == VAR_STRING)
+ {
+ if (tv1->v_type != VAR_STRING || item_compare_numeric)
+ p2 = (char_u *)"'";
+ else
+ p2 = tv2->vval.v_string;
+ }
+ else
+ p2 = tv2string(tv2, &tofree2, numbuf2, 0);
if (p1 == NULL)
p1 = (char_u *)"";
if (p2 == NULL)
@@ -17414,8 +17506,8 @@ item_compare(s1, s2)
res = n1 == n2 ? 0 : n1 > n2 ? 1 : -1;
}
- /* When the result would be zero, compare the pointers themselves. Makes
- * the sort stable. */
+ /* When the result would be zero, compare the item indexes. Makes the
+ * sort stable. */
if (res == 0 && !item_compare_keep_zero)
res = si1->idx > si2->idx ? 1 : -1;
@@ -18547,6 +18639,7 @@ get_cmd_output_as_rettv(argvars, rettv, retlist)
int err = FALSE;
FILE *fd;
list_T *list = NULL;
+ int flags = SHELL_SILENT;
rettv->v_type = VAR_STRING;
rettv->vval.v_string = NULL;
@@ -18578,13 +18671,16 @@ get_cmd_output_as_rettv(argvars, rettv, retlist)
}
else
{
+ size_t len;
+
p = get_tv_string_buf_chk(&argvars[1], buf);
if (p == NULL)
{
fclose(fd);
goto errret; /* type error; errmsg already given */
}
- if (fwrite(p, STRLEN(p), 1, fd) != 1)
+ len = STRLEN(p);
+ if (len > 0 && fwrite(p, len, 1, fd) != 1)
err = TRUE;
}
if (fclose(fd) != 0)
@@ -18596,6 +18692,11 @@ get_cmd_output_as_rettv(argvars, rettv, retlist)
}
}
+ /* Omit SHELL_COOKED when invoked with ":silent". Avoids that the shell
+ * echoes typeahead, that messes up the display. */
+ if (!msg_silent)
+ flags += SHELL_COOKED;
+
if (retlist)
{
int len;
@@ -18605,8 +18706,7 @@ get_cmd_output_as_rettv(argvars, rettv, retlist)
char_u *end;
int i;
- res = get_cmd_output(get_tv_string(&argvars[0]), infile,
- SHELL_SILENT | SHELL_COOKED, &len);
+ res = get_cmd_output(get_tv_string(&argvars[0]), infile, flags, &len);
if (res == NULL)
goto errret;
@@ -18647,8 +18747,7 @@ get_cmd_output_as_rettv(argvars, rettv, retlist)
}
else
{
- res = get_cmd_output(get_tv_string(&argvars[0]), infile,
- SHELL_SILENT | SHELL_COOKED, NULL);
+ res = get_cmd_output(get_tv_string(&argvars[0]), infile, flags, NULL);
#ifdef USE_CR
/* translate <CR> into <NL> */
if (res != NULL)
@@ -19510,7 +19609,7 @@ f_winrestview(argvars, rettv)
# endif
changed_window_setting();
- if (curwin->w_topline == 0)
+ if (curwin->w_topline <= 0)
curwin->w_topline = 1;
if (curwin->w_topline > curbuf->b_ml.ml_line_count)
curwin->w_topline = curbuf->b_ml.ml_line_count;
@@ -19623,6 +19722,7 @@ f_writefile(argvars, rettv)
typval_T *rettv;
{
int binary = FALSE;
+ int append = FALSE;
char_u *fname;
FILE *fd;
int ret = 0;
@@ -19638,14 +19738,19 @@ f_writefile(argvars, rettv)
if (argvars[0].vval.v_list == NULL)
return;
- if (argvars[2].v_type != VAR_UNKNOWN
- && STRCMP(get_tv_string(&argvars[2]), "b") == 0)
- binary = TRUE;
+ if (argvars[2].v_type != VAR_UNKNOWN)
+ {
+ if (vim_strchr(get_tv_string(&argvars[2]), 'b') != NULL)
+ binary = TRUE;
+ if (vim_strchr(get_tv_string(&argvars[2]), 'a') != NULL)
+ append = TRUE;
+ }
/* Always open the file in binary mode, library functions have a mind of
* their own about CR-LF conversion. */
fname = get_tv_string(&argvars[1]);
- if (*fname == NUL || (fd = mch_fopen((char *)fname, WRITEBIN)) == NULL)
+ if (*fname == NUL || (fd = mch_fopen((char *)fname,
+ append ? APPENDBIN : WRITEBIN)) == NULL)
{
EMSG2(_(e_notcreate), *fname == NUL ? (char_u *)_("<empty>") : fname);
ret = -1;
@@ -24688,7 +24793,7 @@ repeat:
p = alloc(_MAX_PATH + 1);
if (p != NULL)
{
- if (GetLongPathName(*fnamep, p, MAXPATHL))
+ if (GetLongPathName(*fnamep, p, _MAX_PATH))
{
vim_free(*bufp);
*bufp = *fnamep = p;
@@ -25010,6 +25115,7 @@ do_string_sub(str, pat, sub, flags)
int i;
int do_all;
char_u *tail;
+ char_u *end;
garray_T ga;
char_u *ret;
char_u *save_cpo;
@@ -25028,6 +25134,7 @@ do_string_sub(str, pat, sub, flags)
if (regmatch.regprog != NULL)
{
tail = str;
+ end = str + STRLEN(str);
while (vim_regexec_nl(&regmatch, str, (colnr_T)(tail - str)))
{
/* Skip empty match except for first match. */
@@ -25054,7 +25161,7 @@ do_string_sub(str, pat, sub, flags)
* - The text after the match.
*/
sublen = vim_regsub(&regmatch, sub, tail, FALSE, TRUE, FALSE);
- if (ga_grow(&ga, (int)(STRLEN(tail) + sublen -
+ if (ga_grow(&ga, (int)((end - tail) + sublen -
(regmatch.endp[0] - regmatch.startp[0]))) == FAIL)
{
ga_clear(&ga);
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 62621bf..86dab47 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -34,6 +34,7 @@ static int
_RTLENTRYF
#endif
help_compare __ARGS((const void *s1, const void *s2));
+static void prepare_help_buffer __ARGS((void));
/*
* ":ascii" and "ga".
@@ -3531,71 +3532,15 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin)
oldbuf = (flags & ECMD_OLDBUF);
}
- if ((flags & ECMD_SET_HELP) || keep_help_flag)
- {
- char_u *p;
-
- curbuf->b_help = TRUE;
-#ifdef FEAT_QUICKFIX
- set_string_option_direct((char_u *)"buftype", -1,
- (char_u *)"help", OPT_FREE|OPT_LOCAL, 0);
-#endif
-
- /*
- * Always set these options after jumping to a help tag, because the
- * user may have an autocommand that gets in the way.
- * Accept all ASCII chars for keywords, except ' ', '*', '"', '|', and
- * latin1 word characters (for translated help files).
- * Only set it when needed, buf_init_chartab() is some work.
- */
- p =
-#ifdef EBCDIC
- (char_u *)"65-255,^*,^|,^\"";
-#else
- (char_u *)"!-~,^*,^|,^\",192-255";
-#endif
- if (STRCMP(curbuf->b_p_isk, p) != 0)
- {
- set_string_option_direct((char_u *)"isk", -1, p,
- OPT_FREE|OPT_LOCAL, 0);
- check_buf_options(curbuf);
- (void)buf_init_chartab(curbuf, FALSE);
- }
-
- curbuf->b_p_ts = 8; /* 'tabstop' is 8 */
- curwin->w_p_list = FALSE; /* no list mode */
-
- curbuf->b_p_ma = FALSE; /* not modifiable */
- curbuf->b_p_bin = FALSE; /* reset 'bin' before reading file */
- curwin->w_p_nu = 0; /* no line numbers */
- curwin->w_p_rnu = 0; /* no relative line numbers */
- RESET_BINDING(curwin); /* no scroll or cursor binding */
-#ifdef FEAT_ARABIC
- curwin->w_p_arab = FALSE; /* no arabic mode */
-#endif
-#ifdef FEAT_RIGHTLEFT
- curwin->w_p_rl = FALSE; /* help window is left-to-right */
-#endif
-#ifdef FEAT_FOLDING
- curwin->w_p_fen = FALSE; /* No folding in the help window */
-#endif
-#ifdef FEAT_DIFF
- curwin->w_p_diff = FALSE; /* No 'diff' */
-#endif
-#ifdef FEAT_SPELL
- curwin->w_p_spell = FALSE; /* No spell checking */
-#endif
-
#ifdef FEAT_AUTOCMD
- buf = curbuf;
+ buf = curbuf;
#endif
- set_buflisted(FALSE);
+ if ((flags & ECMD_SET_HELP) || keep_help_flag)
+ {
+ prepare_help_buffer();
}
else
{
-#ifdef FEAT_AUTOCMD
- buf = curbuf;
-#endif
/* Don't make a buffer listed if it's a help buffer. Useful when
* using CTRL-O to go back to a help file. */
if (!curbuf->b_help)
@@ -4011,11 +3956,19 @@ ex_append(eap)
eap->nextcmd = p;
}
else
+ {
+ int save_State = State;
+
+ /* Set State to avoid the cursor shape to be set to INSERT mode
+ * when getline() returns. */
+ State = CMDLINE;
theline = eap->getline(
#ifdef FEAT_EVAL
eap->cstack->cs_looplevel > 0 ? -1 :
#endif
NUL, eap->cookie, indent);
+ State = save_State;
+ }
lines_left = Rows - 1;
if (theline == NULL)
break;
@@ -5514,7 +5467,15 @@ ex_global(eap)
smsg((char_u *)_("Pattern not found: %s"), pat);
}
else
+ {
+#ifdef FEAT_CLIPBOARD
+ start_global_changes();
+#endif
global_exe(cmd);
+#ifdef FEAT_CLIPBOARD
+ end_global_changes();
+#endif
+ }
ml_clearmarked(); /* clear rest of the marks */
vim_regfree(regmatch.regprog);
@@ -5883,6 +5844,26 @@ erret:
vim_free(tag);
}
+/*
+ * ":helpclose": Close one help window
+ */
+ void
+ex_helpclose(eap)
+ exarg_T *eap UNUSED;
+{
+#if defined(FEAT_WINDOWS)
+ win_T *win;
+
+ FOR_ALL_WINDOWS(win)
+ {
+ if (win->w_buffer->b_help)
+ {
+ win_close(win, FALSE);
+ return;
+ }
+ }
+#endif
+}
#if defined(FEAT_MULTI_LANG) || defined(PROTO)
/*
@@ -6186,6 +6167,73 @@ find_help_tags(arg, num_matches, matches, keep_lang)
}
/*
+ * Called when starting to edit a buffer for a help file.
+ */
+ static void
+prepare_help_buffer()
+{
+ char_u *p;
+
+ curbuf->b_help = TRUE;
+#ifdef FEAT_QUICKFIX
+ set_string_option_direct((char_u *)"buftype", -1,
+ (char_u *)"help", OPT_FREE|OPT_LOCAL, 0);
+#endif
+
+ /*
+ * Always set these options after jumping to a help tag, because the
+ * user may have an autocommand that gets in the way.
+ * Accept all ASCII chars for keywords, except ' ', '*', '"', '|', and
+ * latin1 word characters (for translated help files).
+ * Only set it when needed, buf_init_chartab() is some work.
+ */
+ p =
+#ifdef EBCDIC
+ (char_u *)"65-255,^*,^|,^\"";
+#else
+ (char_u *)"!-~,^*,^|,^\",192-255";
+#endif
+ if (STRCMP(curbuf->b_p_isk, p) != 0)
+ {
+ set_string_option_direct((char_u *)"isk", -1, p, OPT_FREE|OPT_LOCAL, 0);
+ check_buf_options(curbuf);
+ (void)buf_init_chartab(curbuf, FALSE);
+ }
+
+#ifdef FEAT_FOLDING
+ /* Don't use the global foldmethod.*/
+ set_string_option_direct((char_u *)"fdm", -1, (char_u *)"manual",
+ OPT_FREE|OPT_LOCAL, 0);
+#endif
+
+ curbuf->b_p_ts = 8; /* 'tabstop' is 8 */
+ curwin->w_p_list = FALSE; /* no list mode */
+
+ curbuf->b_p_ma = FALSE; /* not modifiable */
+ curbuf->b_p_bin = FALSE; /* reset 'bin' before reading file */
+ curwin->w_p_nu = 0; /* no line numbers */
+ curwin->w_p_rnu = 0; /* no relative line numbers */
+ RESET_BINDING(curwin); /* no scroll or cursor binding */
+#ifdef FEAT_ARABIC
+ curwin->w_p_arab = FALSE; /* no arabic mode */
+#endif
+#ifdef FEAT_RIGHTLEFT
+ curwin->w_p_rl = FALSE; /* help window is left-to-right */
+#endif
+#ifdef FEAT_FOLDING
+ curwin->w_p_fen = FALSE; /* No folding in the help window */
+#endif
+#ifdef FEAT_DIFF
+ curwin->w_p_diff = FALSE; /* No 'diff' */
+#endif
+#ifdef FEAT_SPELL
+ curwin->w_p_spell = FALSE; /* No spell checking */
+#endif
+
+ set_buflisted(FALSE);
+}
+
+/*
* After reading a help file: May cleanup a help buffer when syntax
* highlighting is not used.
*/
diff --git a/src/ex_cmds.h b/src/ex_cmds.h
index 4558c8b..25f50a7 100644
--- a/src/ex_cmds.h
+++ b/src/ex_cmds.h
@@ -58,6 +58,14 @@
#define WORD1 (EXTRA | NOSPC) /* one extra word allowed */
#define FILE1 (FILES | NOSPC) /* 1 file allowed, defaults to current file */
+/* values for cmd_addr_type */
+#define ADDR_LINES 0
+#define ADDR_WINDOWS 1
+#define ADDR_ARGUMENTS 2
+#define ADDR_LOADED_BUFFERS 3
+#define ADDR_UNLOADED_BUFFERS 4
+#define ADDR_TABS 5
+
#ifndef DO_DECLARE_EXCMD
typedef struct exarg exarg_T;
#endif
@@ -74,7 +82,7 @@ typedef struct exarg exarg_T;
# undef EX /* just in case */
#endif
#ifdef DO_DECLARE_EXCMD
-# define EX(a, b, c, d) {(char_u *)b, c, (long_u)(d)}
+# define EX(a, b, c, d, e) {(char_u *)b, c, (long_u)(d), e}
typedef void (*ex_func_T) __ARGS((exarg_T *eap));
@@ -83,1066 +91,1594 @@ static struct cmdname
char_u *cmd_name; /* name of the command */
ex_func_T cmd_func; /* function for this command */
long_u cmd_argt; /* flags declared above */
+ int cmd_addr_type; /* flag for address type */
}
# if defined(FEAT_GUI_W16)
_far
# endif
cmdnames[] =
#else
-# define EX(a, b, c, d) a
+# define EX(a, b, c, d, e) a
enum CMD_index
#endif
{
EX(CMD_append, "append", ex_append,
- BANG|RANGE|ZEROR|TRLBAR|CMDWIN|MODIFY),
+ BANG|RANGE|ZEROR|TRLBAR|CMDWIN|MODIFY,
+ ADDR_LINES),
EX(CMD_abbreviate, "abbreviate", ex_abbreviate,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_abclear, "abclear", ex_abclear,
- EXTRA|TRLBAR|CMDWIN),
+ EXTRA|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_aboveleft, "aboveleft", ex_wrongmodifier,
- NEEDARG|EXTRA|NOTRLCOM),
+ NEEDARG|EXTRA|NOTRLCOM,
+ ADDR_LINES),
EX(CMD_all, "all", ex_all,
- BANG|RANGE|NOTADR|COUNT|TRLBAR),
+ BANG|RANGE|NOTADR|COUNT|TRLBAR,
+ ADDR_LINES),
EX(CMD_amenu, "amenu", ex_menu,
- RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_anoremenu, "anoremenu", ex_menu,
- RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_args, "args", ex_args,
- BANG|FILES|EDITCMD|ARGOPT|TRLBAR),
+ BANG|FILES|EDITCMD|ARGOPT|TRLBAR,
+ ADDR_LINES),
EX(CMD_argadd, "argadd", ex_argadd,
- BANG|NEEDARG|RANGE|NOTADR|ZEROR|FILES|TRLBAR),
+ BANG|NEEDARG|RANGE|NOTADR|ZEROR|FILES|TRLBAR,
+ ADDR_ARGUMENTS),
EX(CMD_argdelete, "argdelete", ex_argdelete,
- BANG|RANGE|NOTADR|FILES|TRLBAR),
+ BANG|RANGE|NOTADR|FILES|TRLBAR,
+ ADDR_ARGUMENTS),
EX(CMD_argdo, "argdo", ex_listdo,
- BANG|NEEDARG|EXTRA|NOTRLCOM),
+ BANG|NEEDARG|EXTRA|NOTRLCOM,
+ ADDR_LINES),
EX(CMD_argedit, "argedit", ex_argedit,
- BANG|NEEDARG|RANGE|NOTADR|FILE1|EDITCMD|ARGOPT|TRLBAR),
+ BANG|NEEDARG|RANGE|NOTADR|FILE1|EDITCMD|ARGOPT|TRLBAR,
+ ADDR_ARGUMENTS),
EX(CMD_argglobal, "argglobal", ex_args,
- BANG|FILES|EDITCMD|ARGOPT|TRLBAR),
+ BANG|FILES|EDITCMD|ARGOPT|TRLBAR,
+ ADDR_LINES),
EX(CMD_arglocal, "arglocal", ex_args,
- BANG|FILES|EDITCMD|ARGOPT|TRLBAR),
+ BANG|FILES|EDITCMD|ARGOPT|TRLBAR,
+ ADDR_LINES),
EX(CMD_argument, "argument", ex_argument,
- BANG|RANGE|NOTADR|COUNT|EXTRA|EDITCMD|ARGOPT|TRLBAR),
+ BANG|RANGE|NOTADR|COUNT|EXTRA|EDITCMD|ARGOPT|TRLBAR,
+ ADDR_ARGUMENTS),
EX(CMD_ascii, "ascii", do_ascii,
- TRLBAR|SBOXOK|CMDWIN),
+ TRLBAR|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_autocmd, "autocmd", ex_autocmd,
- BANG|EXTRA|NOTRLCOM|USECTRLV|CMDWIN),
+ BANG|EXTRA|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_augroup, "augroup", ex_autocmd,
- BANG|WORD1|TRLBAR|CMDWIN),
+ BANG|WORD1|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_aunmenu, "aunmenu", ex_menu,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_buffer, "buffer", ex_buffer,
- BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|TRLBAR),
+ BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|EDITCMD|TRLBAR,
+ ADDR_UNLOADED_BUFFERS),
EX(CMD_bNext, "bNext", ex_bprevious,
- BANG|RANGE|NOTADR|COUNT|TRLBAR),
+ BANG|RANGE|NOTADR|COUNT|EDITCMD|TRLBAR,
+ ADDR_LINES),
EX(CMD_ball, "ball", ex_buffer_all,
- RANGE|NOTADR|COUNT|TRLBAR),
+ RANGE|NOTADR|COUNT|TRLBAR,
+ ADDR_LINES),
EX(CMD_badd, "badd", ex_edit,
- NEEDARG|FILE1|EDITCMD|TRLBAR|CMDWIN),
+ NEEDARG|FILE1|EDITCMD|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_bdelete, "bdelete", ex_bunload,
- BANG|RANGE|NOTADR|BUFNAME|COUNT|EXTRA|TRLBAR),
+ BANG|RANGE|NOTADR|BUFNAME|COUNT|EXTRA|TRLBAR,
+ ADDR_LOADED_BUFFERS),
EX(CMD_behave, "behave", ex_behave,
- NEEDARG|WORD1|TRLBAR|CMDWIN),
+ NEEDARG|WORD1|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_belowright, "belowright", ex_wrongmodifier,
- NEEDARG|EXTRA|NOTRLCOM),
+ NEEDARG|EXTRA|NOTRLCOM,
+ ADDR_LINES),
EX(CMD_bfirst, "bfirst", ex_brewind,
- BANG|RANGE|NOTADR|TRLBAR),
+ BANG|RANGE|NOTADR|EDITCMD|TRLBAR,
+ ADDR_LINES),
EX(CMD_blast, "blast", ex_blast,
- BANG|RANGE|NOTADR|TRLBAR),
+ BANG|RANGE|NOTADR|EDITCMD|TRLBAR,
+ ADDR_LINES),
EX(CMD_bmodified, "bmodified", ex_bmodified,
- BANG|RANGE|NOTADR|COUNT|TRLBAR),
+ BANG|RANGE|NOTADR|COUNT|EDITCMD|TRLBAR,
+ ADDR_LINES),
EX(CMD_bnext, "bnext", ex_bnext,
- BANG|RANGE|NOTADR|COUNT|TRLBAR),
+ BANG|RANGE|NOTADR|COUNT|EDITCMD|TRLBAR,
+ ADDR_LINES),
EX(CMD_botright, "botright", ex_wrongmodifier,
- NEEDARG|EXTRA|NOTRLCOM),
+ NEEDARG|EXTRA|NOTRLCOM,
+ ADDR_LINES),
EX(CMD_bprevious, "bprevious", ex_bprevious,
- BANG|RANGE|NOTADR|COUNT|TRLBAR),
+ BANG|RANGE|NOTADR|COUNT|EDITCMD|TRLBAR,
+ ADDR_LINES),
EX(CMD_brewind, "brewind", ex_brewind,
- BANG|RANGE|NOTADR|TRLBAR),
+ BANG|RANGE|NOTADR|EDITCMD|TRLBAR,
+ ADDR_LINES),
EX(CMD_break, "break", ex_break,
- TRLBAR|SBOXOK|CMDWIN),
+ TRLBAR|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_breakadd, "breakadd", ex_breakadd,
- EXTRA|TRLBAR|CMDWIN),
+ EXTRA|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_breakdel, "breakdel", ex_breakdel,
- EXTRA|TRLBAR|CMDWIN),
+ EXTRA|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_breaklist, "breaklist", ex_breaklist,
- EXTRA|TRLBAR|CMDWIN),
+ EXTRA|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_browse, "browse", ex_wrongmodifier,
- NEEDARG|EXTRA|NOTRLCOM|CMDWIN),
+ NEEDARG|EXTRA|NOTRLCOM|CMDWIN,
+ ADDR_LINES),
EX(CMD_buffers, "buffers", buflist_list,
- BANG|TRLBAR|CMDWIN),
+ BANG|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_bufdo, "bufdo", ex_listdo,
- BANG|NEEDARG|EXTRA|NOTRLCOM),
+ BANG|NEEDARG|EXTRA|NOTRLCOM,
+ ADDR_LINES),
EX(CMD_bunload, "bunload", ex_bunload,
- BANG|RANGE|NOTADR|BUFNAME|COUNT|EXTRA|TRLBAR),
+ BANG|RANGE|NOTADR|BUFNAME|COUNT|EXTRA|TRLBAR,
+ ADDR_LOADED_BUFFERS),
EX(CMD_bwipeout, "bwipeout", ex_bunload,
- BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|TRLBAR),
+ BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|TRLBAR,
+ ADDR_UNLOADED_BUFFERS),
EX(CMD_change, "change", ex_change,
- BANG|WHOLEFOLD|RANGE|COUNT|TRLBAR|CMDWIN|MODIFY),
+ BANG|WHOLEFOLD|RANGE|COUNT|TRLBAR|CMDWIN|MODIFY,
+ ADDR_LINES),
EX(CMD_cNext, "cNext", ex_cnext,
- RANGE|NOTADR|COUNT|TRLBAR|BANG),
+ RANGE|NOTADR|COUNT|TRLBAR|BANG,
+ ADDR_LINES),
EX(CMD_cNfile, "cNfile", ex_cnext,
- RANGE|NOTADR|COUNT|TRLBAR|BANG),
+ RANGE|NOTADR|COUNT|TRLBAR|BANG,
+ ADDR_LINES),
EX(CMD_cabbrev, "cabbrev", ex_abbreviate,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_cabclear, "cabclear", ex_abclear,
- EXTRA|TRLBAR|CMDWIN),
+ EXTRA|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_caddbuffer, "caddbuffer", ex_cbuffer,
- RANGE|NOTADR|WORD1|TRLBAR),
+ RANGE|NOTADR|WORD1|TRLBAR,
+ ADDR_LINES),
EX(CMD_caddexpr, "caddexpr", ex_cexpr,
- NEEDARG|WORD1|NOTRLCOM|TRLBAR),
+ NEEDARG|WORD1|NOTRLCOM|TRLBAR,
+ ADDR_LINES),
EX(CMD_caddfile, "caddfile", ex_cfile,
- TRLBAR|FILE1),
+ TRLBAR|FILE1,
+ ADDR_LINES),
EX(CMD_call, "call", ex_call,
- RANGE|NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN),
+ RANGE|NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_catch, "catch", ex_catch,
- EXTRA|SBOXOK|CMDWIN),
+ EXTRA|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_cbuffer, "cbuffer", ex_cbuffer,
- BANG|RANGE|NOTADR|WORD1|TRLBAR),
+ BANG|RANGE|NOTADR|WORD1|TRLBAR,
+ ADDR_LINES),
EX(CMD_cc, "cc", ex_cc,
- RANGE|NOTADR|COUNT|TRLBAR|BANG),
+ RANGE|NOTADR|COUNT|TRLBAR|BANG,
+ ADDR_LINES),
EX(CMD_cclose, "cclose", ex_cclose,
- RANGE|NOTADR|COUNT|TRLBAR),
+ RANGE|NOTADR|COUNT|TRLBAR,
+ ADDR_LINES),
EX(CMD_cd, "cd", ex_cd,
- BANG|FILE1|TRLBAR|CMDWIN),
+ BANG|FILE1|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_center, "center", ex_align,
- TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY),
+ TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY,
+ ADDR_LINES),
EX(CMD_cexpr, "cexpr", ex_cexpr,
- NEEDARG|WORD1|NOTRLCOM|TRLBAR|BANG),
+ NEEDARG|WORD1|NOTRLCOM|TRLBAR|BANG,
+ ADDR_LINES),
EX(CMD_cfile, "cfile", ex_cfile,
- TRLBAR|FILE1|BANG),
+ TRLBAR|FILE1|BANG,
+ ADDR_LINES),
EX(CMD_cfirst, "cfirst", ex_cc,
- RANGE|NOTADR|COUNT|TRLBAR|BANG),
+ RANGE|NOTADR|COUNT|TRLBAR|BANG,
+ ADDR_LINES),
EX(CMD_cgetfile, "cgetfile", ex_cfile,
- TRLBAR|FILE1),
+ TRLBAR|FILE1,
+ ADDR_LINES),
EX(CMD_cgetbuffer, "cgetbuffer", ex_cbuffer,
- RANGE|NOTADR|WORD1|TRLBAR),
+ RANGE|NOTADR|WORD1|TRLBAR,
+ ADDR_LINES),
EX(CMD_cgetexpr, "cgetexpr", ex_cexpr,
- NEEDARG|WORD1|NOTRLCOM|TRLBAR),
+ NEEDARG|WORD1|NOTRLCOM|TRLBAR,
+ ADDR_LINES),
EX(CMD_chdir, "chdir", ex_cd,
- BANG|FILE1|TRLBAR|CMDWIN),
+ BANG|FILE1|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_changes, "changes", ex_changes,
- TRLBAR|CMDWIN),
+ TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_checkpath, "checkpath", ex_checkpath,
- TRLBAR|BANG|CMDWIN),
+ TRLBAR|BANG|CMDWIN,
+ ADDR_LINES),
EX(CMD_checktime, "checktime", ex_checktime,
- RANGE|NOTADR|BUFNAME|COUNT|EXTRA|TRLBAR),
+ RANGE|NOTADR|BUFNAME|COUNT|EXTRA|TRLBAR,
+ ADDR_LINES),
EX(CMD_clist, "clist", qf_list,
- BANG|EXTRA|TRLBAR|CMDWIN),
+ BANG|EXTRA|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_clast, "clast", ex_cc,
- RANGE|NOTADR|COUNT|TRLBAR|BANG),
+ RANGE|NOTADR|COUNT|TRLBAR|BANG,
+ ADDR_LINES),
EX(CMD_close, "close", ex_close,
- BANG|TRLBAR|CMDWIN),
+ BANG|RANGE|NOTADR|COUNT|TRLBAR|CMDWIN,
+ ADDR_WINDOWS),
EX(CMD_cmap, "cmap", ex_map,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_cmapclear, "cmapclear", ex_mapclear,
- EXTRA|TRLBAR|CMDWIN),
+ EXTRA|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_cmenu, "cmenu", ex_menu,
- RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_cnext, "cnext", ex_cnext,
- RANGE|NOTADR|COUNT|TRLBAR|BANG),
+ RANGE|NOTADR|COUNT|TRLBAR|BANG,
+ ADDR_LINES),
EX(CMD_cnewer, "cnewer", qf_age,
- RANGE|NOTADR|COUNT|TRLBAR),
+ RANGE|NOTADR|COUNT|TRLBAR,
+ ADDR_LINES),
EX(CMD_cnfile, "cnfile", ex_cnext,
- RANGE|NOTADR|COUNT|TRLBAR|BANG),
+ RANGE|NOTADR|COUNT|TRLBAR|BANG,
+ ADDR_LINES),
EX(CMD_cnoremap, "cnoremap", ex_map,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_cnoreabbrev, "cnoreabbrev", ex_abbreviate,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_cnoremenu, "cnoremenu", ex_menu,
- RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_copy, "copy", ex_copymove,
- RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN|MODIFY),
+ RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN|MODIFY,
+ ADDR_LINES),
EX(CMD_colder, "colder", qf_age,
- RANGE|NOTADR|COUNT|TRLBAR),
+ RANGE|NOTADR|COUNT|TRLBAR,
+ ADDR_LINES),
EX(CMD_colorscheme, "colorscheme", ex_colorscheme,
- WORD1|TRLBAR|CMDWIN),
+ WORD1|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_command, "command", ex_command,
- EXTRA|BANG|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|BANG|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_comclear, "comclear", ex_comclear,
- TRLBAR|CMDWIN),
+ TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_compiler, "compiler", ex_compiler,
- BANG|TRLBAR|WORD1|CMDWIN),
+ BANG|TRLBAR|WORD1|CMDWIN,
+ ADDR_LINES),
EX(CMD_continue, "continue", ex_continue,
- TRLBAR|SBOXOK|CMDWIN),
+ TRLBAR|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_confirm, "confirm", ex_wrongmodifier,
- NEEDARG|EXTRA|NOTRLCOM|CMDWIN),
+ NEEDARG|EXTRA|NOTRLCOM|CMDWIN,
+ ADDR_LINES),
EX(CMD_copen, "copen", ex_copen,
- RANGE|NOTADR|COUNT|TRLBAR),
+ RANGE|NOTADR|COUNT|TRLBAR,
+ ADDR_LINES),
EX(CMD_cprevious, "cprevious", ex_cnext,
- RANGE|NOTADR|COUNT|TRLBAR|BANG),
+ RANGE|NOTADR|COUNT|TRLBAR|BANG,
+ ADDR_LINES),
EX(CMD_cpfile, "cpfile", ex_cnext,
- RANGE|NOTADR|COUNT|TRLBAR|BANG),
+ RANGE|NOTADR|COUNT|TRLBAR|BANG,
+ ADDR_LINES),
EX(CMD_cquit, "cquit", ex_cquit,
- TRLBAR|BANG),
+ TRLBAR|BANG,
+ ADDR_LINES),
EX(CMD_crewind, "crewind", ex_cc,
- RANGE|NOTADR|COUNT|TRLBAR|BANG),
+ RANGE|NOTADR|COUNT|TRLBAR|BANG,
+ ADDR_LINES),
EX(CMD_cscope, "cscope", do_cscope,
- EXTRA|NOTRLCOM|XFILE),
+ EXTRA|NOTRLCOM|XFILE,
+ ADDR_LINES),
EX(CMD_cstag, "cstag", do_cstag,
- BANG|TRLBAR|WORD1),
+ BANG|TRLBAR|WORD1,
+ ADDR_LINES),
EX(CMD_cunmap, "cunmap", ex_unmap,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_cunabbrev, "cunabbrev", ex_abbreviate,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_cunmenu, "cunmenu", ex_menu,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_cwindow, "cwindow", ex_cwindow,
- RANGE|NOTADR|COUNT|TRLBAR),
+ RANGE|NOTADR|COUNT|TRLBAR,
+ ADDR_LINES),
EX(CMD_delete, "delete", ex_operators,
- RANGE|WHOLEFOLD|REGSTR|COUNT|TRLBAR|CMDWIN|MODIFY),
+ RANGE|WHOLEFOLD|REGSTR|COUNT|TRLBAR|CMDWIN|MODIFY,
+ ADDR_LINES),
EX(CMD_delmarks, "delmarks", ex_delmarks,
- BANG|EXTRA|TRLBAR|CMDWIN),
+ BANG|EXTRA|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_debug, "debug", ex_debug,
- NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN),
+ NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_debuggreedy, "debuggreedy", ex_debuggreedy,
- RANGE|NOTADR|ZEROR|TRLBAR|CMDWIN),
+ RANGE|NOTADR|ZEROR|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_delcommand, "delcommand", ex_delcommand,
- NEEDARG|WORD1|TRLBAR|CMDWIN),
+ NEEDARG|WORD1|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_delfunction, "delfunction", ex_delfunction,
- NEEDARG|WORD1|CMDWIN),
+ NEEDARG|WORD1|CMDWIN,
+ ADDR_LINES),
EX(CMD_display, "display", ex_display,
- EXTRA|NOTRLCOM|TRLBAR|SBOXOK|CMDWIN),
+ EXTRA|NOTRLCOM|TRLBAR|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_diffupdate, "diffupdate", ex_diffupdate,
- BANG|TRLBAR),
+ BANG|TRLBAR,
+ ADDR_LINES),
EX(CMD_diffget, "diffget", ex_diffgetput,
- RANGE|EXTRA|TRLBAR|MODIFY),
+ RANGE|EXTRA|TRLBAR|MODIFY,
+ ADDR_LINES),
EX(CMD_diffoff, "diffoff", ex_diffoff,
- BANG|TRLBAR),
+ BANG|TRLBAR,
+ ADDR_LINES),
EX(CMD_diffpatch, "diffpatch", ex_diffpatch,
- EXTRA|FILE1|TRLBAR|MODIFY),
+ EXTRA|FILE1|TRLBAR|MODIFY,
+ ADDR_LINES),
EX(CMD_diffput, "diffput", ex_diffgetput,
- RANGE|EXTRA|TRLBAR),
+ RANGE|EXTRA|TRLBAR,
+ ADDR_LINES),
EX(CMD_diffsplit, "diffsplit", ex_diffsplit,
- EXTRA|FILE1|TRLBAR),
+ EXTRA|FILE1|TRLBAR,
+ ADDR_LINES),
EX(CMD_diffthis, "diffthis", ex_diffthis,
- TRLBAR),
+ TRLBAR,
+ ADDR_LINES),
EX(CMD_digraphs, "digraphs", ex_digraphs,
- EXTRA|TRLBAR|CMDWIN),
+ EXTRA|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_djump, "djump", ex_findpat,
- BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA),
+ BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA,
+ ADDR_LINES),
EX(CMD_dlist, "dlist", ex_findpat,
- BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA|CMDWIN),
+ BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA|CMDWIN,
+ ADDR_LINES),
EX(CMD_doautocmd, "doautocmd", ex_doautocmd,
- EXTRA|TRLBAR|CMDWIN),
+ EXTRA|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_doautoall, "doautoall", ex_doautoall,
- EXTRA|TRLBAR|CMDWIN),
+ EXTRA|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_drop, "drop", ex_drop,
- FILES|EDITCMD|NEEDARG|ARGOPT|TRLBAR),
+ FILES|EDITCMD|NEEDARG|ARGOPT|TRLBAR,
+ ADDR_LINES),
EX(CMD_dsearch, "dsearch", ex_findpat,
- BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA|CMDWIN),
+ BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA|CMDWIN,
+ ADDR_LINES),
EX(CMD_dsplit, "dsplit", ex_findpat,
- BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA),
+ BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA,
+ ADDR_LINES),
EX(CMD_edit, "edit", ex_edit,
- BANG|FILE1|EDITCMD|ARGOPT|TRLBAR),
+ BANG|FILE1|EDITCMD|ARGOPT|TRLBAR,
+ ADDR_LINES),
EX(CMD_earlier, "earlier", ex_later,
- TRLBAR|EXTRA|NOSPC|CMDWIN),
+ TRLBAR|EXTRA|NOSPC|CMDWIN,
+ ADDR_LINES),
EX(CMD_echo, "echo", ex_echo,
- EXTRA|NOTRLCOM|SBOXOK|CMDWIN),
+ EXTRA|NOTRLCOM|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_echoerr, "echoerr", ex_execute,
- EXTRA|NOTRLCOM|SBOXOK|CMDWIN),
+ EXTRA|NOTRLCOM|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_echohl, "echohl", ex_echohl,
- EXTRA|TRLBAR|SBOXOK|CMDWIN),
+ EXTRA|TRLBAR|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_echomsg, "echomsg", ex_execute,
- EXTRA|NOTRLCOM|SBOXOK|CMDWIN),
+ EXTRA|NOTRLCOM|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_echon, "echon", ex_echo,
- EXTRA|NOTRLCOM|SBOXOK|CMDWIN),
+ EXTRA|NOTRLCOM|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_else, "else", ex_else,
- TRLBAR|SBOXOK|CMDWIN),
+ TRLBAR|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_elseif, "elseif", ex_else,
- EXTRA|NOTRLCOM|SBOXOK|CMDWIN),
+ EXTRA|NOTRLCOM|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_emenu, "emenu", ex_emenu,
- NEEDARG|EXTRA|TRLBAR|NOTRLCOM|RANGE|NOTADR|CMDWIN),
+ NEEDARG|EXTRA|TRLBAR|NOTRLCOM|RANGE|NOTADR|CMDWIN,
+ ADDR_LINES),
EX(CMD_endif, "endif", ex_endif,
- TRLBAR|SBOXOK|CMDWIN),
+ TRLBAR|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_endfunction, "endfunction", ex_endfunction,
- TRLBAR|CMDWIN),
+ TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_endfor, "endfor", ex_endwhile,
- TRLBAR|SBOXOK|CMDWIN),
+ TRLBAR|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_endtry, "endtry", ex_endtry,
- TRLBAR|SBOXOK|CMDWIN),
+ TRLBAR|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_endwhile, "endwhile", ex_endwhile,
- TRLBAR|SBOXOK|CMDWIN),
+ TRLBAR|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_enew, "enew", ex_edit,
- BANG|TRLBAR),
+ BANG|TRLBAR,
+ ADDR_LINES),
EX(CMD_ex, "ex", ex_edit,
- BANG|FILE1|EDITCMD|ARGOPT|TRLBAR),
+ BANG|FILE1|EDITCMD|ARGOPT|TRLBAR,
+ ADDR_LINES),
EX(CMD_execute, "execute", ex_execute,
- EXTRA|NOTRLCOM|SBOXOK|CMDWIN),
+ EXTRA|NOTRLCOM|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_exit, "exit", ex_exit,
- RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR|CMDWIN),
+ RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_exusage, "exusage", ex_exusage,
- TRLBAR),
+ TRLBAR,
+ ADDR_LINES),
EX(CMD_file, "file", ex_file,
- RANGE|NOTADR|ZEROR|BANG|FILE1|TRLBAR),
+ RANGE|NOTADR|ZEROR|BANG|FILE1|TRLBAR,
+ ADDR_LINES),
EX(CMD_files, "files", buflist_list,
- BANG|TRLBAR|CMDWIN),
+ BANG|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_filetype, "filetype", ex_filetype,
- EXTRA|TRLBAR|CMDWIN),
+ EXTRA|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_find, "find", ex_find,
- RANGE|NOTADR|BANG|FILE1|EDITCMD|ARGOPT|TRLBAR),
+ RANGE|NOTADR|BANG|FILE1|EDITCMD|ARGOPT|TRLBAR,
+ ADDR_LINES),
EX(CMD_finally, "finally", ex_finally,
- TRLBAR|SBOXOK|CMDWIN),
+ TRLBAR|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_finish, "finish", ex_finish,
- TRLBAR|SBOXOK|CMDWIN),
+ TRLBAR|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_first, "first", ex_rewind,
- EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR),
+ EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR,
+ ADDR_LINES),
EX(CMD_fixdel, "fixdel", do_fixdel,
- TRLBAR|CMDWIN),
+ TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_fold, "fold", ex_fold,
- RANGE|WHOLEFOLD|TRLBAR|SBOXOK|CMDWIN),
+ RANGE|WHOLEFOLD|TRLBAR|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_foldclose, "foldclose", ex_foldopen,
- RANGE|BANG|WHOLEFOLD|TRLBAR|SBOXOK|CMDWIN),
+ RANGE|BANG|WHOLEFOLD|TRLBAR|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_folddoopen, "folddoopen", ex_folddo,
- RANGE|DFLALL|NEEDARG|EXTRA|NOTRLCOM),
+ RANGE|DFLALL|NEEDARG|EXTRA|NOTRLCOM,
+ ADDR_LINES),
EX(CMD_folddoclosed, "folddoclosed", ex_folddo,
- RANGE|DFLALL|NEEDARG|EXTRA|NOTRLCOM),
+ RANGE|DFLALL|NEEDARG|EXTRA|NOTRLCOM,
+ ADDR_LINES),
EX(CMD_foldopen, "foldopen", ex_foldopen,
- RANGE|BANG|WHOLEFOLD|TRLBAR|SBOXOK|CMDWIN),
+ RANGE|BANG|WHOLEFOLD|TRLBAR|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_for, "for", ex_while,
- EXTRA|NOTRLCOM|SBOXOK|CMDWIN),
+ EXTRA|NOTRLCOM|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_function, "function", ex_function,
- EXTRA|BANG|CMDWIN),
+ EXTRA|BANG|CMDWIN,
+ ADDR_LINES),
EX(CMD_global, "global", ex_global,
- RANGE|WHOLEFOLD|BANG|EXTRA|DFLALL|SBOXOK|CMDWIN),
+ RANGE|WHOLEFOLD|BANG|EXTRA|DFLALL|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_goto, "goto", ex_goto,
- RANGE|NOTADR|COUNT|TRLBAR|SBOXOK|CMDWIN),
+ RANGE|NOTADR|COUNT|TRLBAR|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_grep, "grep", ex_make,
- RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE),
+ RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE,
+ ADDR_LINES),
EX(CMD_grepadd, "grepadd", ex_make,
- RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE),
+ RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE,
+ ADDR_LINES),
EX(CMD_gui, "gui", ex_gui,
- BANG|FILES|EDITCMD|ARGOPT|TRLBAR|CMDWIN),
+ BANG|FILES|EDITCMD|ARGOPT|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_gvim, "gvim", ex_gui,
- BANG|FILES|EDITCMD|ARGOPT|TRLBAR|CMDWIN),
+ BANG|FILES|EDITCMD|ARGOPT|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_help, "help", ex_help,
- BANG|EXTRA|NOTRLCOM),
+ BANG|EXTRA|NOTRLCOM,
+ ADDR_LINES),
+EX(CMD_helpclose, "helpclose", ex_helpclose,
+ RANGE|NOTADR|COUNT|TRLBAR,
+ ADDR_LINES),
EX(CMD_helpfind, "helpfind", ex_helpfind,
- EXTRA|NOTRLCOM),
+ EXTRA|NOTRLCOM,
+ ADDR_LINES),
EX(CMD_helpgrep, "helpgrep", ex_helpgrep,
- EXTRA|NOTRLCOM|NEEDARG),
+ EXTRA|NOTRLCOM|NEEDARG,
+ ADDR_LINES),
EX(CMD_helptags, "helptags", ex_helptags,
- NEEDARG|FILES|TRLBAR|CMDWIN),
+ NEEDARG|FILES|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_hardcopy, "hardcopy", ex_hardcopy,
- RANGE|COUNT|EXTRA|TRLBAR|DFLALL|BANG),
+ RANGE|COUNT|EXTRA|TRLBAR|DFLALL|BANG,
+ ADDR_LINES),
EX(CMD_highlight, "highlight", ex_highlight,
- BANG|EXTRA|TRLBAR|SBOXOK|CMDWIN),
+ BANG|EXTRA|TRLBAR|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_hide, "hide", ex_hide,
- BANG|EXTRA|NOTRLCOM),
+ BANG|RANGE|NOTADR|COUNT|EXTRA|NOTRLCOM,
+ ADDR_WINDOWS),
EX(CMD_history, "history", ex_history,
- EXTRA|TRLBAR|CMDWIN),
+ EXTRA|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_insert, "insert", ex_append,
- BANG|RANGE|TRLBAR|CMDWIN|MODIFY),
+ BANG|RANGE|TRLBAR|CMDWIN|MODIFY,
+ ADDR_LINES),
EX(CMD_iabbrev, "iabbrev", ex_abbreviate,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_iabclear, "iabclear", ex_abclear,
- EXTRA|TRLBAR|CMDWIN),
+ EXTRA|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_if, "if", ex_if,
- EXTRA|NOTRLCOM|SBOXOK|CMDWIN),
+ EXTRA|NOTRLCOM|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_ijump, "ijump", ex_findpat,
- BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA),
+ BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA,
+ ADDR_LINES),
EX(CMD_ilist, "ilist", ex_findpat,
- BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA|CMDWIN),
+ BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA|CMDWIN,
+ ADDR_LINES),
EX(CMD_imap, "imap", ex_map,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_imapclear, "imapclear", ex_mapclear,
- EXTRA|TRLBAR|CMDWIN),
+ EXTRA|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_imenu, "imenu", ex_menu,
- RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_inoremap, "inoremap", ex_map,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_inoreabbrev, "inoreabbrev", ex_abbreviate,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_inoremenu, "inoremenu", ex_menu,
- RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_intro, "intro", ex_intro,
- TRLBAR|CMDWIN),
+ TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_isearch, "isearch", ex_findpat,
- BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA|CMDWIN),
+ BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA|CMDWIN,
+ ADDR_LINES),
EX(CMD_isplit, "isplit", ex_findpat,
- BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA),
+ BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA,
+ ADDR_LINES),
EX(CMD_iunmap, "iunmap", ex_unmap,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_iunabbrev, "iunabbrev", ex_abbreviate,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_iunmenu, "iunmenu", ex_menu,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_join, "join", ex_join,
- BANG|RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|MODIFY),
+ BANG|RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|MODIFY,
+ ADDR_LINES),
EX(CMD_jumps, "jumps", ex_jumps,
- TRLBAR|CMDWIN),
+ TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_k, "k", ex_mark,
- RANGE|WORD1|TRLBAR|SBOXOK|CMDWIN),
+ RANGE|WORD1|TRLBAR|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_keepmarks, "keepmarks", ex_wrongmodifier,
- NEEDARG|EXTRA|NOTRLCOM),
+ NEEDARG|EXTRA|NOTRLCOM,
+ ADDR_LINES),
EX(CMD_keepjumps, "keepjumps", ex_wrongmodifier,
- NEEDARG|EXTRA|NOTRLCOM),
+ NEEDARG|EXTRA|NOTRLCOM,
+ ADDR_LINES),
EX(CMD_keeppatterns, "keeppatterns", ex_wrongmodifier,
- NEEDARG|EXTRA|NOTRLCOM),
+ NEEDARG|EXTRA|NOTRLCOM,
+ ADDR_LINES),
EX(CMD_keepalt, "keepalt", ex_wrongmodifier,
- NEEDARG|EXTRA|NOTRLCOM),
+ NEEDARG|EXTRA|NOTRLCOM,
+ ADDR_LINES),
EX(CMD_list, "list", ex_print,
- RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN),
+ RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_lNext, "lNext", ex_cnext,
- RANGE|NOTADR|COUNT|TRLBAR|BANG),
+ RANGE|NOTADR|COUNT|TRLBAR|BANG,
+ ADDR_LINES),
EX(CMD_lNfile, "lNfile", ex_cnext,
- RANGE|NOTADR|COUNT|TRLBAR|BANG),
+ RANGE|NOTADR|COUNT|TRLBAR|BANG,
+ ADDR_LINES),
EX(CMD_last, "last", ex_last,
- EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR),
+ EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR,
+ ADDR_LINES),
EX(CMD_language, "language", ex_language,
- EXTRA|TRLBAR|CMDWIN),
+ EXTRA|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_laddexpr, "laddexpr", ex_cexpr,
- NEEDARG|WORD1|NOTRLCOM|TRLBAR),
+ NEEDARG|WORD1|NOTRLCOM|TRLBAR,
+ ADDR_LINES),
EX(CMD_laddbuffer, "laddbuffer", ex_cbuffer,
- RANGE|NOTADR|WORD1|TRLBAR),
+ RANGE|NOTADR|WORD1|TRLBAR,
+ ADDR_LINES),
EX(CMD_laddfile, "laddfile", ex_cfile,
- TRLBAR|FILE1),
+ TRLBAR|FILE1,
+ ADDR_LINES),
EX(CMD_later, "later", ex_later,
- TRLBAR|EXTRA|NOSPC|CMDWIN),
+ TRLBAR|EXTRA|NOSPC|CMDWIN,
+ ADDR_LINES),
EX(CMD_lbuffer, "lbuffer", ex_cbuffer,
- BANG|RANGE|NOTADR|WORD1|TRLBAR),
+ BANG|RANGE|NOTADR|WORD1|TRLBAR,
+ ADDR_LINES),
EX(CMD_lcd, "lcd", ex_cd,
- BANG|FILE1|TRLBAR|CMDWIN),
+ BANG|FILE1|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_lchdir, "lchdir", ex_cd,
- BANG|FILE1|TRLBAR|CMDWIN),
+ BANG|FILE1|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_lclose, "lclose", ex_cclose,
- RANGE|NOTADR|COUNT|TRLBAR),
+ RANGE|NOTADR|COUNT|TRLBAR,
+ ADDR_LINES),
EX(CMD_lcscope, "lcscope", do_cscope,
- EXTRA|NOTRLCOM|XFILE),
+ EXTRA|NOTRLCOM|XFILE,
+ ADDR_LINES),
EX(CMD_left, "left", ex_align,
- TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY),
+ TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY,
+ ADDR_LINES),
EX(CMD_leftabove, "leftabove", ex_wrongmodifier,
- NEEDARG|EXTRA|NOTRLCOM),
+ NEEDARG|EXTRA|NOTRLCOM,
+ ADDR_LINES),
EX(CMD_let, "let", ex_let,
- EXTRA|NOTRLCOM|SBOXOK|CMDWIN),
+ EXTRA|NOTRLCOM|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_lexpr, "lexpr", ex_cexpr,
- NEEDARG|WORD1|NOTRLCOM|TRLBAR|BANG),
+ NEEDARG|WORD1|NOTRLCOM|TRLBAR|BANG,
+ ADDR_LINES),
EX(CMD_lfile, "lfile", ex_cfile,
- TRLBAR|FILE1|BANG),
+ TRLBAR|FILE1|BANG,
+ ADDR_LINES),
EX(CMD_lfirst, "lfirst", ex_cc,
- RANGE|NOTADR|COUNT|TRLBAR|BANG),
+ RANGE|NOTADR|COUNT|TRLBAR|BANG,
+ ADDR_LINES),
EX(CMD_lgetfile, "lgetfile", ex_cfile,
- TRLBAR|FILE1),
+ TRLBAR|FILE1,
+ ADDR_LINES),
EX(CMD_lgetbuffer, "lgetbuffer", ex_cbuffer,
- RANGE|NOTADR|WORD1|TRLBAR),
+ RANGE|NOTADR|WORD1|TRLBAR,
+ ADDR_LINES),
EX(CMD_lgetexpr, "lgetexpr", ex_cexpr,
- NEEDARG|WORD1|NOTRLCOM|TRLBAR),
+ NEEDARG|WORD1|NOTRLCOM|TRLBAR,
+ ADDR_LINES),
EX(CMD_lgrep, "lgrep", ex_make,
- RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE),
+ RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE,
+ ADDR_LINES),
EX(CMD_lgrepadd, "lgrepadd", ex_make,
- RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE),
+ RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE,
+ ADDR_LINES),
EX(CMD_lhelpgrep, "lhelpgrep", ex_helpgrep,
- EXTRA|NOTRLCOM|NEEDARG),
+ EXTRA|NOTRLCOM|NEEDARG,
+ ADDR_LINES),
EX(CMD_ll, "ll", ex_cc,
- RANGE|NOTADR|COUNT|TRLBAR|BANG),
+ RANGE|NOTADR|COUNT|TRLBAR|BANG,
+ ADDR_LINES),
EX(CMD_llast, "llast", ex_cc,
- RANGE|NOTADR|COUNT|TRLBAR|BANG),
+ RANGE|NOTADR|COUNT|TRLBAR|BANG,
+ ADDR_LINES),
EX(CMD_llist, "llist", qf_list,
- BANG|EXTRA|TRLBAR|CMDWIN),
+ BANG|EXTRA|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_lmap, "lmap", ex_map,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_lmapclear, "lmapclear", ex_mapclear,
- EXTRA|TRLBAR|CMDWIN),
+ EXTRA|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_lmake, "lmake", ex_make,
- BANG|EXTRA|NOTRLCOM|TRLBAR|XFILE),
+ BANG|EXTRA|NOTRLCOM|TRLBAR|XFILE,
+ ADDR_LINES),
EX(CMD_lnoremap, "lnoremap", ex_map,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_lnext, "lnext", ex_cnext,
- RANGE|NOTADR|COUNT|TRLBAR|BANG),
+ RANGE|NOTADR|COUNT|TRLBAR|BANG,
+ ADDR_LINES),
EX(CMD_lnewer, "lnewer", qf_age,
- RANGE|NOTADR|COUNT|TRLBAR),
+ RANGE|NOTADR|COUNT|TRLBAR,
+ ADDR_LINES),
EX(CMD_lnfile, "lnfile", ex_cnext,
- RANGE|NOTADR|COUNT|TRLBAR|BANG),
+ RANGE|NOTADR|COUNT|TRLBAR|BANG,
+ ADDR_LINES),
EX(CMD_loadview, "loadview", ex_loadview,
- FILE1|TRLBAR),
+ FILE1|TRLBAR,
+ ADDR_LINES),
EX(CMD_loadkeymap, "loadkeymap", ex_loadkeymap,
- CMDWIN),
+ CMDWIN,
+ ADDR_LINES),
EX(CMD_lockmarks, "lockmarks", ex_wrongmodifier,
- NEEDARG|EXTRA|NOTRLCOM),
+ NEEDARG|EXTRA|NOTRLCOM,
+ ADDR_LINES),
EX(CMD_lockvar, "lockvar", ex_lockvar,
- BANG|EXTRA|NEEDARG|SBOXOK|CMDWIN),
+ BANG|EXTRA|NEEDARG|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_lolder, "lolder", qf_age,
- RANGE|NOTADR|COUNT|TRLBAR),
+ RANGE|NOTADR|COUNT|TRLBAR,
+ ADDR_LINES),
EX(CMD_lopen, "lopen", ex_copen,
- RANGE|NOTADR|COUNT|TRLBAR),
+ RANGE|NOTADR|COUNT|TRLBAR,
+ ADDR_LINES),
EX(CMD_lprevious, "lprevious", ex_cnext,
- RANGE|NOTADR|COUNT|TRLBAR|BANG),
+ RANGE|NOTADR|COUNT|TRLBAR|BANG,
+ ADDR_LINES),
EX(CMD_lpfile, "lpfile", ex_cnext,
- RANGE|NOTADR|COUNT|TRLBAR|BANG),
+ RANGE|NOTADR|COUNT|TRLBAR|BANG,
+ ADDR_LINES),
EX(CMD_lrewind, "lrewind", ex_cc,
- RANGE|NOTADR|COUNT|TRLBAR|BANG),
+ RANGE|NOTADR|COUNT|TRLBAR|BANG,
+ ADDR_LINES),
EX(CMD_ltag, "ltag", ex_tag,
- NOTADR|TRLBAR|BANG|WORD1),
+ NOTADR|TRLBAR|BANG|WORD1,
+ ADDR_LINES),
EX(CMD_lunmap, "lunmap", ex_unmap,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_lua, "lua", ex_lua,
- RANGE|EXTRA|NEEDARG|CMDWIN),
+ RANGE|EXTRA|NEEDARG|CMDWIN,
+ ADDR_LINES),
EX(CMD_luado, "luado", ex_luado,
- RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN),
+ RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN,
+ ADDR_LINES),
EX(CMD_luafile, "luafile", ex_luafile,
- RANGE|FILE1|NEEDARG|CMDWIN),
+ RANGE|FILE1|NEEDARG|CMDWIN,
+ ADDR_LINES),
EX(CMD_lvimgrep, "lvimgrep", ex_vimgrep,
- RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE),
+ RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE,
+ ADDR_LINES),
EX(CMD_lvimgrepadd, "lvimgrepadd", ex_vimgrep,
- RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE),
+ RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE,
+ ADDR_LINES),
EX(CMD_lwindow, "lwindow", ex_cwindow,
- RANGE|NOTADR|COUNT|TRLBAR),
+ RANGE|NOTADR|COUNT|TRLBAR,
+ ADDR_LINES),
EX(CMD_ls, "ls", buflist_list,
- BANG|TRLBAR|CMDWIN),
+ BANG|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_move, "move", ex_copymove,
- RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN|MODIFY),
+ RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN|MODIFY,
+ ADDR_LINES),
EX(CMD_mark, "mark", ex_mark,
- RANGE|WORD1|TRLBAR|SBOXOK|CMDWIN),
+ RANGE|WORD1|TRLBAR|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_make, "make", ex_make,
- BANG|EXTRA|NOTRLCOM|TRLBAR|XFILE),
+ BANG|EXTRA|NOTRLCOM|TRLBAR|XFILE,
+ ADDR_LINES),
EX(CMD_map, "map", ex_map,
- BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_mapclear, "mapclear", ex_mapclear,
- EXTRA|BANG|TRLBAR|CMDWIN),
+ EXTRA|BANG|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_marks, "marks", do_marks,
- EXTRA|TRLBAR|CMDWIN),
+ EXTRA|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_match, "match", ex_match,
- RANGE|NOTADR|EXTRA|CMDWIN),
+ RANGE|NOTADR|EXTRA|CMDWIN,
+ ADDR_LINES),
EX(CMD_macaction, "macaction", ex_macaction,
- EXTRA|NOSPC|NEEDARG),
+ EXTRA|NOSPC|NEEDARG,
+ ADDR_LINES),
EX(CMD_macmenu, "macmenu", ex_macmenu,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_menu, "menu", ex_menu,
- RANGE|NOTADR|ZEROR|BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ RANGE|NOTADR|ZEROR|BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_menutranslate, "menutranslate", ex_menutranslate,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_messages, "messages", ex_messages,
- TRLBAR|CMDWIN),
+ TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_mkexrc, "mkexrc", ex_mkrc,
- BANG|FILE1|TRLBAR|CMDWIN),
+ BANG|FILE1|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_mksession, "mksession", ex_mkrc,
- BANG|FILE1|TRLBAR),
+ BANG|FILE1|TRLBAR,
+ ADDR_LINES),
EX(CMD_mkspell, "mkspell", ex_mkspell,
- BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE),
+ BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE,
+ ADDR_LINES),
EX(CMD_mkvimrc, "mkvimrc", ex_mkrc,
- BANG|FILE1|TRLBAR|CMDWIN),
+ BANG|FILE1|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_mkview, "mkview", ex_mkrc,
- BANG|FILE1|TRLBAR),
+ BANG|FILE1|TRLBAR,
+ ADDR_LINES),
EX(CMD_mode, "mode", ex_mode,
- WORD1|TRLBAR|CMDWIN),
+ WORD1|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_mzscheme, "mzscheme", ex_mzscheme,
- RANGE|EXTRA|DFLALL|NEEDARG|CMDWIN|SBOXOK),
+ RANGE|EXTRA|DFLALL|NEEDARG|CMDWIN|SBOXOK,
+ ADDR_LINES),
EX(CMD_mzfile, "mzfile", ex_mzfile,
- RANGE|FILE1|NEEDARG|CMDWIN),
+ RANGE|FILE1|NEEDARG|CMDWIN,
+ ADDR_LINES),
EX(CMD_next, "next", ex_next,
- RANGE|NOTADR|BANG|FILES|EDITCMD|ARGOPT|TRLBAR),
+ RANGE|NOTADR|BANG|FILES|EDITCMD|ARGOPT|TRLBAR,
+ ADDR_LINES),
EX(CMD_nbkey, "nbkey", ex_nbkey,
- EXTRA|NOTADR|NEEDARG),
+ EXTRA|NOTADR|NEEDARG,
+ ADDR_LINES),
EX(CMD_nbclose, "nbclose", ex_nbclose,
- TRLBAR|CMDWIN),
+ TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_nbstart, "nbstart", ex_nbstart,
- WORD1|TRLBAR|CMDWIN),
+ WORD1|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_new, "new", ex_splitview,
- BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR),
+ BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR,
+ ADDR_LINES),
EX(CMD_nmap, "nmap", ex_map,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_nmapclear, "nmapclear", ex_mapclear,
- EXTRA|TRLBAR|CMDWIN),
+ EXTRA|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_nmenu, "nmenu", ex_menu,
- RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_nnoremap, "nnoremap", ex_map,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_nnoremenu, "nnoremenu", ex_menu,
- RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_noremap, "noremap", ex_map,
- BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_noautocmd, "noautocmd", ex_wrongmodifier,
- NEEDARG|EXTRA|NOTRLCOM),
+ NEEDARG|EXTRA|NOTRLCOM,
+ ADDR_LINES),
EX(CMD_nohlsearch, "nohlsearch", ex_nohlsearch,
- TRLBAR|SBOXOK|CMDWIN),
+ TRLBAR|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_noreabbrev, "noreabbrev", ex_abbreviate,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_noremenu, "noremenu", ex_menu,
- RANGE|NOTADR|ZEROR|BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ RANGE|NOTADR|ZEROR|BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_noswapfile, "noswapfile", ex_wrongmodifier,
- NEEDARG|EXTRA|NOTRLCOM),
+ NEEDARG|EXTRA|NOTRLCOM,
+ ADDR_LINES),
EX(CMD_normal, "normal", ex_normal,
- RANGE|BANG|EXTRA|NEEDARG|NOTRLCOM|USECTRLV|SBOXOK|CMDWIN),
+ RANGE|BANG|EXTRA|NEEDARG|NOTRLCOM|USECTRLV|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_number, "number", ex_print,
- RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN),
+ RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_nunmap, "nunmap", ex_unmap,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_nunmenu, "nunmenu", ex_menu,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_open, "open", ex_open,
- RANGE|BANG|EXTRA),
+ RANGE|BANG|EXTRA,
+ ADDR_LINES),
EX(CMD_oldfiles, "oldfiles", ex_oldfiles,
- BANG|TRLBAR|SBOXOK|CMDWIN),
+ BANG|TRLBAR|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_omap, "omap", ex_map,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_omapclear, "omapclear", ex_mapclear,
- EXTRA|TRLBAR|CMDWIN),
+ EXTRA|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_omenu, "omenu", ex_menu,
- RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_only, "only", ex_only,
- BANG|TRLBAR),
+ BANG|NOTADR|RANGE|COUNT|TRLBAR,
+ ADDR_WINDOWS),
EX(CMD_onoremap, "onoremap", ex_map,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_onoremenu, "onoremenu", ex_menu,
- RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_options, "options", ex_options,
- TRLBAR),
+ TRLBAR,
+ ADDR_LINES),
EX(CMD_ounmap, "ounmap", ex_unmap,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_ounmenu, "ounmenu", ex_menu,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_ownsyntax, "ownsyntax", ex_ownsyntax,
- EXTRA|NOTRLCOM|SBOXOK|CMDWIN),
+ EXTRA|NOTRLCOM|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_print, "print", ex_print,
- RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|SBOXOK),
+ RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|SBOXOK,
+ ADDR_LINES),
EX(CMD_pclose, "pclose", ex_pclose,
- BANG|TRLBAR),
+ BANG|TRLBAR,
+ ADDR_LINES),
EX(CMD_perl, "perl", ex_perl,
- RANGE|EXTRA|DFLALL|NEEDARG|SBOXOK|CMDWIN),
+ RANGE|EXTRA|DFLALL|NEEDARG|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_perldo, "perldo", ex_perldo,
- RANGE|EXTRA|DFLALL|NEEDARG|CMDWIN),
+ RANGE|EXTRA|DFLALL|NEEDARG|CMDWIN,
+ ADDR_LINES),
EX(CMD_pedit, "pedit", ex_pedit,
- BANG|FILE1|EDITCMD|ARGOPT|TRLBAR),
+ BANG|FILE1|EDITCMD|ARGOPT|TRLBAR,
+ ADDR_LINES),
EX(CMD_pop, "pop", ex_tag,
- RANGE|NOTADR|BANG|COUNT|TRLBAR|ZEROR),
+ RANGE|NOTADR|BANG|COUNT|TRLBAR|ZEROR,
+ ADDR_LINES),
EX(CMD_popup, "popup", ex_popup,
- NEEDARG|EXTRA|BANG|TRLBAR|NOTRLCOM|CMDWIN),
+ NEEDARG|EXTRA|BANG|TRLBAR|NOTRLCOM|CMDWIN,
+ ADDR_LINES),
EX(CMD_ppop, "ppop", ex_ptag,
- RANGE|NOTADR|BANG|COUNT|TRLBAR|ZEROR),
+ RANGE|NOTADR|BANG|COUNT|TRLBAR|ZEROR,
+ ADDR_LINES),
EX(CMD_preserve, "preserve", ex_preserve,
- TRLBAR),
+ TRLBAR,
+ ADDR_LINES),
EX(CMD_previous, "previous", ex_previous,
- EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR),
+ EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR,
+ ADDR_LINES),
EX(CMD_promptfind, "promptfind", gui_mch_find_dialog,
- EXTRA|NOTRLCOM|CMDWIN),
+ EXTRA|NOTRLCOM|CMDWIN,
+ ADDR_LINES),
EX(CMD_promptrepl, "promptrepl", gui_mch_replace_dialog,
- EXTRA|NOTRLCOM|CMDWIN),
+ EXTRA|NOTRLCOM|CMDWIN,
+ ADDR_LINES),
EX(CMD_profile, "profile", ex_profile,
- BANG|EXTRA|TRLBAR|CMDWIN),
+ BANG|EXTRA|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_profdel, "profdel", ex_breakdel,
- EXTRA|TRLBAR|CMDWIN),
+ EXTRA|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_psearch, "psearch", ex_psearch,
- BANG|RANGE|WHOLEFOLD|DFLALL|EXTRA),
+ BANG|RANGE|WHOLEFOLD|DFLALL|EXTRA,
+ ADDR_LINES),
EX(CMD_ptag, "ptag", ex_ptag,
- RANGE|NOTADR|BANG|WORD1|TRLBAR|ZEROR),
+ RANGE|NOTADR|BANG|WORD1|TRLBAR|ZEROR,
+ ADDR_LINES),
EX(CMD_ptNext, "ptNext", ex_ptag,
- RANGE|NOTADR|BANG|TRLBAR|ZEROR),
+ RANGE|NOTADR|BANG|TRLBAR|ZEROR,
+ ADDR_LINES),
EX(CMD_ptfirst, "ptfirst", ex_ptag,
- RANGE|NOTADR|BANG|TRLBAR|ZEROR),
+ RANGE|NOTADR|BANG|TRLBAR|ZEROR,
+ ADDR_LINES),
EX(CMD_ptjump, "ptjump", ex_ptag,
- BANG|TRLBAR|WORD1),
+ BANG|TRLBAR|WORD1,
+ ADDR_LINES),
EX(CMD_ptlast, "ptlast", ex_ptag,
- BANG|TRLBAR),
+ BANG|TRLBAR,
+ ADDR_LINES),
EX(CMD_ptnext, "ptnext", ex_ptag,
- RANGE|NOTADR|BANG|TRLBAR|ZEROR),
+ RANGE|NOTADR|BANG|TRLBAR|ZEROR,
+ ADDR_LINES),
EX(CMD_ptprevious, "ptprevious", ex_ptag,
- RANGE|NOTADR|BANG|TRLBAR|ZEROR),
+ RANGE|NOTADR|BANG|TRLBAR|ZEROR,
+ ADDR_LINES),
EX(CMD_ptrewind, "ptrewind", ex_ptag,
- RANGE|NOTADR|BANG|TRLBAR|ZEROR),
+ RANGE|NOTADR|BANG|TRLBAR|ZEROR,
+ ADDR_LINES),
EX(CMD_ptselect, "ptselect", ex_ptag,
- BANG|TRLBAR|WORD1),
+ BANG|TRLBAR|WORD1,
+ ADDR_LINES),
EX(CMD_put, "put", ex_put,
- RANGE|WHOLEFOLD|BANG|REGSTR|TRLBAR|ZEROR|CMDWIN|MODIFY),
+ RANGE|WHOLEFOLD|BANG|REGSTR|TRLBAR|ZEROR|CMDWIN|MODIFY,
+ ADDR_LINES),
EX(CMD_pwd, "pwd", ex_pwd,
- TRLBAR|CMDWIN),
+ TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_python, "python", ex_python,
- RANGE|EXTRA|NEEDARG|CMDWIN),
+ RANGE|EXTRA|NEEDARG|CMDWIN,
+ ADDR_LINES),
EX(CMD_pydo, "pydo", ex_pydo,
- RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN),
+ RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN,
+ ADDR_LINES),
EX(CMD_pyfile, "pyfile", ex_pyfile,
- RANGE|FILE1|NEEDARG|CMDWIN),
+ RANGE|FILE1|NEEDARG|CMDWIN,
+ ADDR_LINES),
EX(CMD_py3, "py3", ex_py3,
- RANGE|EXTRA|NEEDARG|CMDWIN),
+ RANGE|EXTRA|NEEDARG|CMDWIN,
+ ADDR_LINES),
EX(CMD_py3do, "py3do", ex_py3do,
- RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN),
+ RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN,
+ ADDR_LINES),
EX(CMD_python3, "python3", ex_py3,
- RANGE|EXTRA|NEEDARG|CMDWIN),
+ RANGE|EXTRA|NEEDARG|CMDWIN,
+ ADDR_LINES),
EX(CMD_py3file, "py3file", ex_py3file,
- RANGE|FILE1|NEEDARG|CMDWIN),
+ RANGE|FILE1|NEEDARG|CMDWIN,
+ ADDR_LINES),
EX(CMD_quit, "quit", ex_quit,
- BANG|TRLBAR|CMDWIN),
+ BANG|RANGE|COUNT|NOTADR|TRLBAR|CMDWIN,
+ ADDR_WINDOWS),
EX(CMD_quitall, "quitall", ex_quit_all,
- BANG|TRLBAR),
+ BANG|TRLBAR,
+ ADDR_LINES),
EX(CMD_qall, "qall", ex_quit_all,
- BANG|TRLBAR|CMDWIN),
+ BANG|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_read, "read", ex_read,
- BANG|RANGE|WHOLEFOLD|FILE1|ARGOPT|TRLBAR|ZEROR|CMDWIN|MODIFY),
+ BANG|RANGE|WHOLEFOLD|FILE1|ARGOPT|TRLBAR|ZEROR|CMDWIN|MODIFY,
+ ADDR_LINES),
EX(CMD_recover, "recover", ex_recover,
- BANG|FILE1|TRLBAR),
+ BANG|FILE1|TRLBAR,
+ ADDR_LINES),
EX(CMD_redo, "redo", ex_redo,
- TRLBAR|CMDWIN),
+ TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_redir, "redir", ex_redir,
- BANG|FILES|TRLBAR|CMDWIN),
+ BANG|FILES|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_redraw, "redraw", ex_redraw,
- BANG|TRLBAR|CMDWIN),
+ BANG|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_redrawstatus, "redrawstatus", ex_redrawstatus,
- BANG|TRLBAR|CMDWIN),
+ BANG|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_registers, "registers", ex_display,
- EXTRA|NOTRLCOM|TRLBAR|CMDWIN),
+ EXTRA|NOTRLCOM|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_resize, "resize", ex_resize,
- RANGE|NOTADR|TRLBAR|WORD1),
+ RANGE|NOTADR|TRLBAR|WORD1,
+ ADDR_LINES),
EX(CMD_retab, "retab", ex_retab,
- TRLBAR|RANGE|WHOLEFOLD|DFLALL|BANG|WORD1|CMDWIN|MODIFY),
+ TRLBAR|RANGE|WHOLEFOLD|DFLALL|BANG|WORD1|CMDWIN|MODIFY,
+ ADDR_LINES),
EX(CMD_return, "return", ex_return,
- EXTRA|NOTRLCOM|SBOXOK|CMDWIN),
+ EXTRA|NOTRLCOM|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_rewind, "rewind", ex_rewind,
- EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR),
+ EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR,
+ ADDR_LINES),
EX(CMD_right, "right", ex_align,
- TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY),
+ TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY,
+ ADDR_LINES),
EX(CMD_rightbelow, "rightbelow", ex_wrongmodifier,
- NEEDARG|EXTRA|NOTRLCOM),
+ NEEDARG|EXTRA|NOTRLCOM,
+ ADDR_LINES),
EX(CMD_runtime, "runtime", ex_runtime,
- BANG|NEEDARG|FILES|TRLBAR|SBOXOK|CMDWIN),
+ BANG|NEEDARG|FILES|TRLBAR|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_ruby, "ruby", ex_ruby,
- RANGE|EXTRA|NEEDARG|CMDWIN),
+ RANGE|EXTRA|NEEDARG|CMDWIN,
+ ADDR_LINES),
EX(CMD_rubydo, "rubydo", ex_rubydo,
- RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN),
+ RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN,
+ ADDR_LINES),
EX(CMD_rubyfile, "rubyfile", ex_rubyfile,
- RANGE|FILE1|NEEDARG|CMDWIN),
+ RANGE|FILE1|NEEDARG|CMDWIN,
+ ADDR_LINES),
EX(CMD_rundo, "rundo", ex_rundo,
- NEEDARG|FILE1),
+ NEEDARG|FILE1,
+ ADDR_LINES),
EX(CMD_rviminfo, "rviminfo", ex_viminfo,
- BANG|FILE1|TRLBAR|CMDWIN),
+ BANG|FILE1|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_substitute, "substitute", do_sub,
- RANGE|WHOLEFOLD|EXTRA|CMDWIN),
+ RANGE|WHOLEFOLD|EXTRA|CMDWIN,
+ ADDR_LINES),
EX(CMD_sNext, "sNext", ex_previous,
- EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR),
+ EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR,
+ ADDR_LINES),
EX(CMD_sargument, "sargument", ex_argument,
- BANG|RANGE|NOTADR|COUNT|EXTRA|EDITCMD|ARGOPT|TRLBAR),
+ BANG|RANGE|NOTADR|COUNT|EXTRA|EDITCMD|ARGOPT|TRLBAR,
+ ADDR_ARGUMENTS),
EX(CMD_sall, "sall", ex_all,
- BANG|RANGE|NOTADR|COUNT|TRLBAR),
+ BANG|RANGE|NOTADR|COUNT|TRLBAR,
+ ADDR_LINES),
EX(CMD_sandbox, "sandbox", ex_wrongmodifier,
- NEEDARG|EXTRA|NOTRLCOM),
+ NEEDARG|EXTRA|NOTRLCOM,
+ ADDR_LINES),
EX(CMD_saveas, "saveas", ex_write,
- BANG|DFLALL|FILE1|ARGOPT|CMDWIN|TRLBAR),
+ BANG|DFLALL|FILE1|ARGOPT|CMDWIN|TRLBAR,
+ ADDR_LINES),
EX(CMD_sbuffer, "sbuffer", ex_buffer,
- BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|TRLBAR),
+ BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|EDITCMD|TRLBAR,
+ ADDR_UNLOADED_BUFFERS),
EX(CMD_sbNext, "sbNext", ex_bprevious,
- RANGE|NOTADR|COUNT|TRLBAR),
+ RANGE|NOTADR|COUNT|EDITCMD|TRLBAR,
+ ADDR_LINES),
EX(CMD_sball, "sball", ex_buffer_all,
- RANGE|NOTADR|COUNT|TRLBAR),
+ RANGE|NOTADR|COUNT|EDITCMD|TRLBAR,
+ ADDR_LINES),
EX(CMD_sbfirst, "sbfirst", ex_brewind,
- TRLBAR),
+ EDITCMD|TRLBAR,
+ ADDR_LINES),
EX(CMD_sblast, "sblast", ex_blast,
- TRLBAR),
+ EDITCMD|TRLBAR,
+ ADDR_LINES),
EX(CMD_sbmodified, "sbmodified", ex_bmodified,
- RANGE|NOTADR|COUNT|TRLBAR),
+ RANGE|NOTADR|COUNT|EDITCMD|TRLBAR,
+ ADDR_LINES),
EX(CMD_sbnext, "sbnext", ex_bnext,
- RANGE|NOTADR|COUNT|TRLBAR),
+ RANGE|NOTADR|COUNT|EDITCMD|TRLBAR,
+ ADDR_LINES),
EX(CMD_sbprevious, "sbprevious", ex_bprevious,
- RANGE|NOTADR|COUNT|TRLBAR),
+ RANGE|NOTADR|COUNT|EDITCMD|TRLBAR,
+ ADDR_LINES),
EX(CMD_sbrewind, "sbrewind", ex_brewind,
- TRLBAR),
+ EDITCMD|TRLBAR,
+ ADDR_LINES),
EX(CMD_scriptnames, "scriptnames", ex_scriptnames,
- TRLBAR|CMDWIN),
+ TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_scriptencoding, "scriptencoding", ex_scriptencoding,
- WORD1|TRLBAR|CMDWIN),
+ WORD1|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_scscope, "scscope", do_scscope,
- EXTRA|NOTRLCOM),
+ EXTRA|NOTRLCOM,
+ ADDR_LINES),
EX(CMD_set, "set", ex_set,
- TRLBAR|EXTRA|CMDWIN|SBOXOK),
+ TRLBAR|EXTRA|CMDWIN|SBOXOK,
+ ADDR_LINES),
EX(CMD_setfiletype, "setfiletype", ex_setfiletype,
- TRLBAR|EXTRA|NEEDARG|CMDWIN),
+ TRLBAR|EXTRA|NEEDARG|CMDWIN,
+ ADDR_LINES),
EX(CMD_setglobal, "setglobal", ex_set,
- TRLBAR|EXTRA|CMDWIN|SBOXOK),
+ TRLBAR|EXTRA|CMDWIN|SBOXOK,
+ ADDR_LINES),
EX(CMD_setlocal, "setlocal", ex_set,
- TRLBAR|EXTRA|CMDWIN|SBOXOK),
+ TRLBAR|EXTRA|CMDWIN|SBOXOK,
+ ADDR_LINES),
EX(CMD_sfind, "sfind", ex_splitview,
- BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR),
+ BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR,
+ ADDR_LINES),
EX(CMD_sfirst, "sfirst", ex_rewind,
- EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR),
+ EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR,
+ ADDR_LINES),
EX(CMD_shell, "shell", ex_shell,
- TRLBAR|CMDWIN),
+ TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_simalt, "simalt", ex_simalt,
- NEEDARG|WORD1|TRLBAR|CMDWIN),
+ NEEDARG|WORD1|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_sign, "sign", ex_sign,
- NEEDARG|RANGE|NOTADR|EXTRA|CMDWIN),
+ NEEDARG|RANGE|NOTADR|EXTRA|CMDWIN,
+ ADDR_LINES),
EX(CMD_silent, "silent", ex_wrongmodifier,
- NEEDARG|EXTRA|BANG|NOTRLCOM|SBOXOK|CMDWIN),
+ NEEDARG|EXTRA|BANG|NOTRLCOM|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_sleep, "sleep", ex_sleep,
- RANGE|NOTADR|COUNT|EXTRA|TRLBAR|CMDWIN),
+ RANGE|NOTADR|COUNT|EXTRA|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_slast, "slast", ex_last,
- EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR),
+ EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR,
+ ADDR_LINES),
EX(CMD_smagic, "smagic", ex_submagic,
- RANGE|WHOLEFOLD|EXTRA|CMDWIN),
+ RANGE|WHOLEFOLD|EXTRA|CMDWIN,
+ ADDR_LINES),
EX(CMD_smap, "smap", ex_map,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_smapclear, "smapclear", ex_mapclear,
- EXTRA|TRLBAR|CMDWIN),
+ EXTRA|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_smenu, "smenu", ex_menu,
- RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_snext, "snext", ex_next,
- RANGE|NOTADR|BANG|FILES|EDITCMD|ARGOPT|TRLBAR),
+ RANGE|NOTADR|BANG|FILES|EDITCMD|ARGOPT|TRLBAR,
+ ADDR_LINES),
EX(CMD_sniff, "sniff", ex_sniff,
- EXTRA|TRLBAR),
+ EXTRA|TRLBAR,
+ ADDR_LINES),
EX(CMD_snomagic, "snomagic", ex_submagic,
- RANGE|WHOLEFOLD|EXTRA|CMDWIN),
+ RANGE|WHOLEFOLD|EXTRA|CMDWIN,
+ ADDR_LINES),
EX(CMD_snoremap, "snoremap", ex_map,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_snoremenu, "snoremenu", ex_menu,
- RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_source, "source", ex_source,
- BANG|FILE1|TRLBAR|SBOXOK|CMDWIN),
+ BANG|FILE1|TRLBAR|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_sort, "sort", ex_sort,
- RANGE|DFLALL|WHOLEFOLD|BANG|EXTRA|NOTRLCOM|MODIFY),
+ RANGE|DFLALL|WHOLEFOLD|BANG|EXTRA|NOTRLCOM|MODIFY,
+ ADDR_LINES),
EX(CMD_split, "split", ex_splitview,
- BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR),
+ BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR,
+ ADDR_LINES),
EX(CMD_spellgood, "spellgood", ex_spell,
- BANG|RANGE|NOTADR|NEEDARG|EXTRA|TRLBAR),
+ BANG|RANGE|NOTADR|NEEDARG|EXTRA|TRLBAR,
+ ADDR_LINES),
EX(CMD_spelldump, "spelldump", ex_spelldump,
- BANG|TRLBAR),
+ BANG|TRLBAR,
+ ADDR_LINES),
EX(CMD_spellinfo, "spellinfo", ex_spellinfo,
- TRLBAR),
+ TRLBAR,
+ ADDR_LINES),
EX(CMD_spellrepall, "spellrepall", ex_spellrepall,
- TRLBAR),
+ TRLBAR,
+ ADDR_LINES),
EX(CMD_spellundo, "spellundo", ex_spell,
- BANG|RANGE|NOTADR|NEEDARG|EXTRA|TRLBAR),
+ BANG|RANGE|NOTADR|NEEDARG|EXTRA|TRLBAR,
+ ADDR_LINES),
EX(CMD_spellwrong, "spellwrong", ex_spell,
- BANG|RANGE|NOTADR|NEEDARG|EXTRA|TRLBAR),
+ BANG|RANGE|NOTADR|NEEDARG|EXTRA|TRLBAR,
+ ADDR_LINES),
EX(CMD_sprevious, "sprevious", ex_previous,
- EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR),
+ EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR,
+ ADDR_LINES),
EX(CMD_srewind, "srewind", ex_rewind,
- EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR),
+ EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR,
+ ADDR_LINES),
EX(CMD_stop, "stop", ex_stop,
- TRLBAR|BANG|CMDWIN),
+ TRLBAR|BANG|CMDWIN,
+ ADDR_LINES),
EX(CMD_stag, "stag", ex_stag,
- RANGE|NOTADR|BANG|WORD1|TRLBAR|ZEROR),
+ RANGE|NOTADR|BANG|WORD1|TRLBAR|ZEROR,
+ ADDR_LINES),
EX(CMD_startinsert, "startinsert", ex_startinsert,
- BANG|TRLBAR|CMDWIN),
+ BANG|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_startgreplace, "startgreplace", ex_startinsert,
- BANG|TRLBAR|CMDWIN),
+ BANG|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_startreplace, "startreplace", ex_startinsert,
- BANG|TRLBAR|CMDWIN),
+ BANG|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_stopinsert, "stopinsert", ex_stopinsert,
- BANG|TRLBAR|CMDWIN),
+ BANG|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_stjump, "stjump", ex_stag,
- BANG|TRLBAR|WORD1),
+ BANG|TRLBAR|WORD1,
+ ADDR_LINES),
EX(CMD_stselect, "stselect", ex_stag,
- BANG|TRLBAR|WORD1),
+ BANG|TRLBAR|WORD1,
+ ADDR_LINES),
EX(CMD_sunhide, "sunhide", ex_buffer_all,
- RANGE|NOTADR|COUNT|TRLBAR),
+ RANGE|NOTADR|COUNT|TRLBAR,
+ ADDR_LINES),
EX(CMD_sunmap, "sunmap", ex_unmap,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_sunmenu, "sunmenu", ex_menu,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_suspend, "suspend", ex_stop,
- TRLBAR|BANG|CMDWIN),
+ TRLBAR|BANG|CMDWIN,
+ ADDR_LINES),
EX(CMD_sview, "sview", ex_splitview,
- BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR),
+ BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR,
+ ADDR_LINES),
EX(CMD_swapname, "swapname", ex_swapname,
- TRLBAR|CMDWIN),
+ TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_syntax, "syntax", ex_syntax,
- EXTRA|NOTRLCOM|CMDWIN),
+ EXTRA|NOTRLCOM|CMDWIN,
+ ADDR_LINES),
EX(CMD_syntime, "syntime", ex_syntime,
- NEEDARG|WORD1|TRLBAR|CMDWIN),
+ NEEDARG|WORD1|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_syncbind, "syncbind", ex_syncbind,
- TRLBAR),
+ TRLBAR,
+ ADDR_LINES),
EX(CMD_t, "t", ex_copymove,
- RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN|MODIFY),
+ RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN|MODIFY,
+ ADDR_LINES),
EX(CMD_tNext, "tNext", ex_tag,
- RANGE|NOTADR|BANG|TRLBAR|ZEROR),
+ RANGE|NOTADR|BANG|TRLBAR|ZEROR,
+ ADDR_LINES),
EX(CMD_tag, "tag", ex_tag,
- RANGE|NOTADR|BANG|WORD1|TRLBAR|ZEROR),
+ RANGE|NOTADR|BANG|WORD1|TRLBAR|ZEROR,
+ ADDR_LINES),
EX(CMD_tags, "tags", do_tags,
- TRLBAR|CMDWIN),
+ TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_tab, "tab", ex_wrongmodifier,
- NEEDARG|EXTRA|NOTRLCOM),
+ NEEDARG|EXTRA|NOTRLCOM,
+ ADDR_LINES),
EX(CMD_tabclose, "tabclose", ex_tabclose,
- RANGE|NOTADR|COUNT|BANG|TRLBAR|CMDWIN),
+ RANGE|NOTADR|COUNT|BANG|TRLBAR|CMDWIN,
+ ADDR_TABS),
EX(CMD_tabdo, "tabdo", ex_listdo,
- NEEDARG|EXTRA|NOTRLCOM),
+ NEEDARG|EXTRA|NOTRLCOM,
+ ADDR_LINES),
EX(CMD_tabedit, "tabedit", ex_splitview,
- BANG|FILE1|RANGE|NOTADR|ZEROR|EDITCMD|ARGOPT|TRLBAR),
+ BANG|FILE1|RANGE|NOTADR|ZEROR|EDITCMD|ARGOPT|TRLBAR,
+ ADDR_TABS),
EX(CMD_tabfind, "tabfind", ex_splitview,
- BANG|FILE1|RANGE|NOTADR|ZEROR|EDITCMD|ARGOPT|NEEDARG|TRLBAR),
+ BANG|FILE1|RANGE|NOTADR|ZEROR|EDITCMD|ARGOPT|NEEDARG|TRLBAR,
+ ADDR_TABS),
EX(CMD_tabfirst, "tabfirst", ex_tabnext,
- TRLBAR),
+ TRLBAR,
+ ADDR_LINES),
EX(CMD_tabmove, "tabmove", ex_tabmove,
- RANGE|NOTADR|ZEROR|EXTRA|NOSPC|TRLBAR),
+ RANGE|NOTADR|ZEROR|EXTRA|NOSPC|TRLBAR,
+ ADDR_TABS),
EX(CMD_tablast, "tablast", ex_tabnext,
- TRLBAR),
+ TRLBAR,
+ ADDR_LINES),
EX(CMD_tabnext, "tabnext", ex_tabnext,
- RANGE|NOTADR|COUNT|TRLBAR),
+ RANGE|NOTADR|COUNT|TRLBAR,
+ ADDR_LINES),
EX(CMD_tabnew, "tabnew", ex_splitview,
- BANG|FILE1|RANGE|NOTADR|ZEROR|EDITCMD|ARGOPT|TRLBAR),
+ BANG|FILE1|RANGE|NOTADR|ZEROR|EDITCMD|ARGOPT|TRLBAR,
+ ADDR_TABS),
EX(CMD_tabonly, "tabonly", ex_tabonly,
- BANG|TRLBAR|CMDWIN),
+ BANG|RANGE|NOTADR|TRLBAR|CMDWIN,
+ ADDR_TABS),
EX(CMD_tabprevious, "tabprevious", ex_tabnext,
- RANGE|NOTADR|COUNT|TRLBAR),
+ RANGE|NOTADR|COUNT|TRLBAR,
+ ADDR_LINES),
EX(CMD_tabNext, "tabNext", ex_tabnext,
- RANGE|NOTADR|COUNT|TRLBAR),
+ RANGE|NOTADR|COUNT|TRLBAR,
+ ADDR_LINES),
EX(CMD_tabrewind, "tabrewind", ex_tabnext,
- TRLBAR),
+ TRLBAR,
+ ADDR_LINES),
EX(CMD_tabs, "tabs", ex_tabs,
- TRLBAR|CMDWIN),
+ TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_tcl, "tcl", ex_tcl,
- RANGE|EXTRA|NEEDARG|CMDWIN),
+ RANGE|EXTRA|NEEDARG|CMDWIN,
+ ADDR_LINES),
EX(CMD_tcldo, "tcldo", ex_tcldo,
- RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN),
+ RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN,
+ ADDR_LINES),
EX(CMD_tclfile, "tclfile", ex_tclfile,
- RANGE|FILE1|NEEDARG|CMDWIN),
+ RANGE|FILE1|NEEDARG|CMDWIN,
+ ADDR_LINES),
EX(CMD_tearoff, "tearoff", ex_tearoff,
- NEEDARG|EXTRA|TRLBAR|NOTRLCOM|CMDWIN),
+ NEEDARG|EXTRA|TRLBAR|NOTRLCOM|CMDWIN,
+ ADDR_LINES),
EX(CMD_tfirst, "tfirst", ex_tag,
- RANGE|NOTADR|BANG|TRLBAR|ZEROR),
+ RANGE|NOTADR|BANG|TRLBAR|ZEROR,
+ ADDR_LINES),
EX(CMD_throw, "throw", ex_throw,
- EXTRA|NEEDARG|SBOXOK|CMDWIN),
+ EXTRA|NEEDARG|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_tjump, "tjump", ex_tag,
- BANG|TRLBAR|WORD1),
+ BANG|TRLBAR|WORD1,
+ ADDR_LINES),
EX(CMD_tlast, "tlast", ex_tag,
- BANG|TRLBAR),
+ BANG|TRLBAR,
+ ADDR_LINES),
EX(CMD_tmenu, "tmenu", ex_menu,
- RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_tnext, "tnext", ex_tag,
- RANGE|NOTADR|BANG|TRLBAR|ZEROR),
+ RANGE|NOTADR|BANG|TRLBAR|ZEROR,
+ ADDR_LINES),
EX(CMD_topleft, "topleft", ex_wrongmodifier,
- NEEDARG|EXTRA|NOTRLCOM),
+ NEEDARG|EXTRA|NOTRLCOM,
+ ADDR_LINES),
EX(CMD_tprevious, "tprevious", ex_tag,
- RANGE|NOTADR|BANG|TRLBAR|ZEROR),
+ RANGE|NOTADR|BANG|TRLBAR|ZEROR,
+ ADDR_LINES),
EX(CMD_trewind, "trewind", ex_tag,
- RANGE|NOTADR|BANG|TRLBAR|ZEROR),
+ RANGE|NOTADR|BANG|TRLBAR|ZEROR,
+ ADDR_LINES),
EX(CMD_try, "try", ex_try,
- TRLBAR|SBOXOK|CMDWIN),
+ TRLBAR|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_tselect, "tselect", ex_tag,
- BANG|TRLBAR|WORD1),
+ BANG|TRLBAR|WORD1,
+ ADDR_LINES),
EX(CMD_tunmenu, "tunmenu", ex_menu,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_undo, "undo", ex_undo,
- RANGE|NOTADR|COUNT|ZEROR|TRLBAR|CMDWIN),
+ RANGE|NOTADR|COUNT|ZEROR|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_undojoin, "undojoin", ex_undojoin,
- TRLBAR|CMDWIN),
+ TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_undolist, "undolist", ex_undolist,
- TRLBAR|CMDWIN),
+ TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_unabbreviate, "unabbreviate", ex_abbreviate,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_unhide, "unhide", ex_buffer_all,
- RANGE|NOTADR|COUNT|TRLBAR),
+ RANGE|NOTADR|COUNT|TRLBAR,
+ ADDR_LINES),
EX(CMD_unlet, "unlet", ex_unlet,
- BANG|EXTRA|NEEDARG|SBOXOK|CMDWIN),
+ BANG|EXTRA|NEEDARG|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_unlockvar, "unlockvar", ex_lockvar,
- BANG|EXTRA|NEEDARG|SBOXOK|CMDWIN),
+ BANG|EXTRA|NEEDARG|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_unmap, "unmap", ex_unmap,
- BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_unmenu, "unmenu", ex_menu,
- BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_unsilent, "unsilent", ex_wrongmodifier,
- NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN),
+ NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_update, "update", ex_update,
- RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR),
+ RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR,
+ ADDR_LINES),
EX(CMD_vglobal, "vglobal", ex_global,
- RANGE|WHOLEFOLD|EXTRA|DFLALL|CMDWIN),
+ RANGE|WHOLEFOLD|EXTRA|DFLALL|CMDWIN,
+ ADDR_LINES),
EX(CMD_version, "version", ex_version,
- EXTRA|TRLBAR|CMDWIN),
+ EXTRA|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_verbose, "verbose", ex_wrongmodifier,
- NEEDARG|RANGE|NOTADR|EXTRA|NOTRLCOM|SBOXOK|CMDWIN),
+ NEEDARG|RANGE|NOTADR|EXTRA|NOTRLCOM|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_vertical, "vertical", ex_wrongmodifier,
- NEEDARG|EXTRA|NOTRLCOM),
+ NEEDARG|EXTRA|NOTRLCOM,
+ ADDR_LINES),
EX(CMD_visual, "visual", ex_edit,
- BANG|FILE1|EDITCMD|ARGOPT|TRLBAR),
+ BANG|FILE1|EDITCMD|ARGOPT|TRLBAR,
+ ADDR_LINES),
EX(CMD_view, "view", ex_edit,
- BANG|FILE1|EDITCMD|ARGOPT|TRLBAR),
+ BANG|FILE1|EDITCMD|ARGOPT|TRLBAR,
+ ADDR_LINES),
EX(CMD_vimgrep, "vimgrep", ex_vimgrep,
- RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE),
+ RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE,
+ ADDR_LINES),
EX(CMD_vimgrepadd, "vimgrepadd", ex_vimgrep,
- RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE),
+ RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE,
+ ADDR_LINES),
EX(CMD_viusage, "viusage", ex_viusage,
- TRLBAR),
+ TRLBAR,
+ ADDR_LINES),
EX(CMD_vmap, "vmap", ex_map,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_vmapclear, "vmapclear", ex_mapclear,
- EXTRA|TRLBAR|CMDWIN),
+ EXTRA|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_vmenu, "vmenu", ex_menu,
- RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_vnoremap, "vnoremap", ex_map,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_vnew, "vnew", ex_splitview,
- BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR),
+ BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR,
+ ADDR_LINES),
EX(CMD_vnoremenu, "vnoremenu", ex_menu,
- RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_vsplit, "vsplit", ex_splitview,
- BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR),
+ BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR,
+ ADDR_LINES),
EX(CMD_vunmap, "vunmap", ex_unmap,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_vunmenu, "vunmenu", ex_menu,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_write, "write", ex_write,
- RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR|CMDWIN),
+ RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_wNext, "wNext", ex_wnext,
- RANGE|WHOLEFOLD|NOTADR|BANG|FILE1|ARGOPT|TRLBAR),
+ RANGE|WHOLEFOLD|NOTADR|BANG|FILE1|ARGOPT|TRLBAR,
+ ADDR_LINES),
EX(CMD_wall, "wall", do_wqall,
- BANG|TRLBAR|CMDWIN),
+ BANG|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_while, "while", ex_while,
- EXTRA|NOTRLCOM|SBOXOK|CMDWIN),
+ EXTRA|NOTRLCOM|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_winsize, "winsize", ex_winsize,
- EXTRA|NEEDARG|TRLBAR),
+ EXTRA|NEEDARG|TRLBAR,
+ ADDR_LINES),
EX(CMD_wincmd, "wincmd", ex_wincmd,
- NEEDARG|WORD1|RANGE|NOTADR),
+ NEEDARG|WORD1|RANGE|NOTADR,
+ ADDR_LINES),
EX(CMD_windo, "windo", ex_listdo,
- BANG|NEEDARG|EXTRA|NOTRLCOM),
+ BANG|NEEDARG|EXTRA|NOTRLCOM,
+ ADDR_LINES),
EX(CMD_winpos, "winpos", ex_winpos,
- EXTRA|TRLBAR|CMDWIN),
+ EXTRA|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_wnext, "wnext", ex_wnext,
- RANGE|NOTADR|BANG|FILE1|ARGOPT|TRLBAR),
+ RANGE|NOTADR|BANG|FILE1|ARGOPT|TRLBAR,
+ ADDR_LINES),
EX(CMD_wprevious, "wprevious", ex_wnext,
- RANGE|NOTADR|BANG|FILE1|ARGOPT|TRLBAR),
+ RANGE|NOTADR|BANG|FILE1|ARGOPT|TRLBAR,
+ ADDR_LINES),
EX(CMD_wq, "wq", ex_exit,
- RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR),
+ RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR,
+ ADDR_LINES),
EX(CMD_wqall, "wqall", do_wqall,
- BANG|FILE1|ARGOPT|DFLALL|TRLBAR),
+ BANG|FILE1|ARGOPT|DFLALL|TRLBAR,
+ ADDR_LINES),
EX(CMD_wsverb, "wsverb", ex_wsverb,
- EXTRA|NOTADR|NEEDARG),
+ EXTRA|NOTADR|NEEDARG,
+ ADDR_LINES),
EX(CMD_wundo, "wundo", ex_wundo,
- BANG|NEEDARG|FILE1),
+ BANG|NEEDARG|FILE1,
+ ADDR_LINES),
EX(CMD_wviminfo, "wviminfo", ex_viminfo,
- BANG|FILE1|TRLBAR|CMDWIN),
+ BANG|FILE1|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_xit, "xit", ex_exit,
- RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR|CMDWIN),
+ RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_xall, "xall", do_wqall,
- BANG|TRLBAR),
+ BANG|TRLBAR,
+ ADDR_LINES),
EX(CMD_xmap, "xmap", ex_map,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_xmapclear, "xmapclear", ex_mapclear,
- EXTRA|TRLBAR|CMDWIN),
+ EXTRA|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_xmenu, "xmenu", ex_menu,
- RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_xnoremap, "xnoremap", ex_map,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_xnoremenu, "xnoremenu", ex_menu,
- RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_xunmap, "xunmap", ex_unmap,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_xunmenu, "xunmenu", ex_menu,
- EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
+ ADDR_LINES),
EX(CMD_yank, "yank", ex_operators,
- RANGE|WHOLEFOLD|REGSTR|COUNT|TRLBAR|CMDWIN),
+ RANGE|WHOLEFOLD|REGSTR|COUNT|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_z, "z", ex_z,
- RANGE|WHOLEFOLD|EXTRA|EXFLAGS|TRLBAR|CMDWIN),
+ RANGE|WHOLEFOLD|EXTRA|EXFLAGS|TRLBAR|CMDWIN,
+ ADDR_LINES),
/* commands that don't start with a lowercase letter */
EX(CMD_bang, "!", ex_bang,
- RANGE|WHOLEFOLD|BANG|FILES|CMDWIN),
+ RANGE|WHOLEFOLD|BANG|FILES|CMDWIN,
+ ADDR_LINES),
EX(CMD_pound, "#", ex_print,
- RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN),
+ RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_and, "&", do_sub,
- RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY),
+ RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY,
+ ADDR_LINES),
EX(CMD_star, "*", ex_at,
- RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN),
+ RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_lshift, "<", ex_operators,
- RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|MODIFY),
+ RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|MODIFY,
+ ADDR_LINES),
EX(CMD_equal, "=", ex_equal,
- RANGE|TRLBAR|DFLALL|EXFLAGS|CMDWIN),
+ RANGE|TRLBAR|DFLALL|EXFLAGS|CMDWIN,
+ ADDR_LINES),
EX(CMD_rshift, ">", ex_operators,
- RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|MODIFY),
+ RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|MODIFY,
+ ADDR_LINES),
EX(CMD_at, "@", ex_at,
- RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN),
+ RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_Next, "Next", ex_previous,
- EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR),
+ EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR,
+ ADDR_LINES),
EX(CMD_Print, "Print", ex_print,
- RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN),
+ RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_X, "X", ex_X,
- TRLBAR),
+ TRLBAR,
+ ADDR_LINES),
EX(CMD_tilde, "~", do_sub,
- RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY),
+ RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY,
+ ADDR_LINES),
#ifndef DO_DECLARE_EXCMD
#ifdef FEAT_USR_CMDS
@@ -1155,8 +1691,6 @@ EX(CMD_tilde, "~", do_sub,
#endif
};
-#define USER_CMDIDX(idx) ((int)(idx) < 0)
-
#ifndef DO_DECLARE_EXCMD
typedef enum CMD_index cmdidx_T;
@@ -1176,6 +1710,7 @@ struct exarg
int addr_count; /* the number of addresses given */
linenr_T line1; /* the first line number */
linenr_T line2; /* the second line number or count */
+ int addr_type; /* type of the count/range */
int flags; /* extra flags after count: EXFLAG_ */
char_u *do_ecmd_cmd; /* +command arg to be used in edited file */
linenr_T do_ecmd_lnum; /* the line number in an edited file */
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 2198f16..2aae258 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -739,7 +739,6 @@ debuggy_find(file, fname, after, gap, fp)
struct debuggy *bp;
int i;
linenr_T lnum = 0;
- regmatch_T regmatch;
char_u *name = fname;
int prev_got_int;
@@ -771,8 +770,6 @@ debuggy_find(file, fname, after, gap, fp)
#endif
(bp->dbg_lnum > after && (lnum == 0 || bp->dbg_lnum < lnum)))))
{
- regmatch.regprog = bp->dbg_prog;
- regmatch.rm_ic = FALSE;
/*
* Save the value of got_int and reset it. We don't want a
* previous interruption cancel matching, only hitting CTRL-C
@@ -780,7 +777,7 @@ debuggy_find(file, fname, after, gap, fp)
*/
prev_got_int = got_int;
got_int = FALSE;
- if (vim_regexec(&regmatch, name, (colnr_T)0))
+ if (vim_regexec_prog(&bp->dbg_prog, FALSE, name, (colnr_T)0))
{
lnum = bp->dbg_lnum;
if (fp != NULL)
@@ -2537,6 +2534,9 @@ ex_listdo(eap)
* great speed improvement. */
save_ei = au_event_disable(",Syntax");
#endif
+#ifdef FEAT_CLIPBOARD
+ start_global_changes();
+#endif
if (eap->cmdidx == CMD_windo
|| eap->cmdidx == CMD_tabdo
@@ -2664,6 +2664,9 @@ ex_listdo(eap)
curbuf->b_fname, TRUE, curbuf);
}
#endif
+#ifdef FEAT_CLIPBOARD
+ end_global_changes();
+#endif
}
/*
@@ -2823,8 +2826,8 @@ source_runtime(name, all)
* used.
* Returns OK when at least one match found, FAIL otherwise.
*
- * If "name" is NULL calls callback for each entry in runtimepath. Cookie is
- * passed by reference in this case, setting it to NULL indicates that callback
+ * If "name" is NULL calls callback for each entry in runtimepath. Cookie is
+ * passed by reference in this case, setting it to NULL indicates that callback
* has done its job.
*/
int
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index a091c0b..40c0b6d 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -49,12 +49,18 @@ static void ex_delcommand __ARGS((exarg_T *eap));
static char_u *get_user_command_name __ARGS((int idx));
# endif
+/* Wether a command index indicates a user command. */
+# define IS_USER_CMDIDX(idx) ((int)(idx) < 0)
+
#else
# define ex_command ex_ni
# define ex_comclear ex_ni
# define ex_delcommand ex_ni
+/* Wether a command index indicates a user command. */
+# define IS_USER_CMDIDX(idx) (FALSE)
#endif
+static int compute_buffer_local_count __ARGS((int addr_type, int lnum, int local));
#ifdef FEAT_EVAL
static char_u *do_one_cmd __ARGS((char_u **, int, struct condstack *, char_u *(*fgetline)(int, void *, int), void *cookie));
#else
@@ -128,7 +134,7 @@ static int getargopt __ARGS((exarg_T *eap));
#endif
static int check_more __ARGS((int, int));
-static linenr_T get_address __ARGS((char_u **, int skip, int to_other_file));
+static linenr_T get_address __ARGS((char_u **, int addr_type, int skip, int to_other_file));
static void get_flags __ARGS((exarg_T *eap));
#if !defined(FEAT_PERL) \
|| !defined(FEAT_PYTHON) || !defined(FEAT_PYTHON3) \
@@ -1682,6 +1688,102 @@ getline_cookie(fgetline, cookie)
}
#endif
+
+/*
+ * Helper function to apply an offset for buffer commands, i.e. ":bdelete",
+ * ":bwipeout", etc.
+ * Returns the buffer number.
+ */
+ static int
+compute_buffer_local_count(addr_type, lnum, offset)
+ int addr_type;
+ int lnum;
+ int offset;
+{
+ buf_T *buf;
+ buf_T *nextbuf;
+ int count = offset;
+
+ buf = firstbuf;
+ while (buf->b_next != NULL && buf->b_fnum < lnum)
+ buf = buf->b_next;
+ while (count != 0)
+ {
+ count += (offset < 0) ? 1 : -1;
+ nextbuf = (offset < 0) ? buf->b_prev : buf->b_next;
+ if (nextbuf == NULL)
+ break;
+ buf = nextbuf;
+ if (addr_type == ADDR_LOADED_BUFFERS)
+ /* skip over unloaded buffers */
+ while (buf->b_ml.ml_mfp == NULL)
+ {
+ nextbuf = (offset < 0) ? buf->b_prev : buf->b_next;
+ if (nextbuf == NULL)
+ break;
+ buf = nextbuf;
+ }
+ }
+ /* we might have gone too far, last buffer is not loadedd */
+ if (addr_type == ADDR_LOADED_BUFFERS)
+ while (buf->b_ml.ml_mfp == NULL)
+ {
+ nextbuf = (offset >= 0) ? buf->b_prev : buf->b_next;
+ if (nextbuf == NULL)
+ break;
+ buf = nextbuf;
+ }
+ return buf->b_fnum;
+}
+
+#ifdef FEAT_WINDOWS
+static int current_win_nr __ARGS((win_T *win));
+static int current_tab_nr __ARGS((tabpage_T *tab));
+
+ static int
+current_win_nr(win)
+ win_T *win;
+{
+ win_T *wp;
+ int nr = 0;
+
+ for (wp = firstwin; wp != NULL; wp = wp->w_next)
+ {
+ ++nr;
+ if (wp == win)
+ break;
+ }
+ return nr;
+}
+
+ static int
+current_tab_nr(tab)
+ tabpage_T *tab;
+{
+ tabpage_T *tp;
+ int nr = 0;
+
+ for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
+ {
+ ++nr;
+ if (tp == tab)
+ break;
+ }
+ return nr;
+}
+
+# define CURRENT_WIN_NR current_win_nr(curwin)
+# define LAST_WIN_NR current_win_nr(NULL)
+# define CURRENT_TAB_NR current_tab_nr(curtab)
+# define LAST_TAB_NR current_tab_nr(NULL)
+#else
+# define CURRENT_WIN_NR 1
+# define LAST_WIN_NR 1
+# define CURRENT_TAB_NR 1
+# define LAST_TAB_NR 1
+#endif
+
+
/*
* Execute one Ex command.
*
@@ -1689,10 +1791,11 @@ getline_cookie(fgetline, cookie)
*
* 1. skip comment lines and leading space
* 2. handle command modifiers
- * 3. parse range
- * 4. parse command
- * 5. parse arguments
- * 6. switch on command name
+ * 3. find the command
+ * 4. parse range
+ * 5. Parse the command.
+ * 6. parse arguments
+ * 7. switch on command name
*
* Note: "fgetline" can be NULL.
*
@@ -1732,6 +1835,7 @@ do_one_cmd(cmdlinep, sourcing,
#endif
cmdmod_T save_cmdmod;
int ni; /* set when Not Implemented */
+ char_u *cmd;
vim_memset(&ea, 0, sizeof(ea));
ea.line1 = 1;
@@ -1771,7 +1875,7 @@ do_one_cmd(cmdlinep, sourcing,
for (;;)
{
/*
- * 1. skip comment lines and leading white space and colons
+ * 1. Skip comment lines and leading white space and colons.
*/
while (*ea.cmd == ' ' || *ea.cmd == '\t' || *ea.cmd == ':')
++ea.cmd;
@@ -1796,7 +1900,7 @@ do_one_cmd(cmdlinep, sourcing,
}
/*
- * 2. handle command modifiers.
+ * 2. Handle command modifiers.
*/
p = ea.cmd;
if (VIM_ISDIGIT(*ea.cmd))
@@ -2005,7 +2109,18 @@ do_one_cmd(cmdlinep, sourcing,
#endif
/*
- * 3. parse a range specifier of the form: addr [,addr] [;addr] ..
+ * 3. Skip over the range to find the command. Let "p" point to after it.
+ *
+ * We need the command to know what kind of range it uses.
+ */
+ cmd = ea.cmd;
+ ea.cmd = skip_range(ea.cmd, NULL);
+ if (*ea.cmd == '*' && vim_strchr(p_cpo, CPO_STAR) == NULL)
+ ea.cmd = skipwhite(ea.cmd + 1);
+ p = find_command(&ea, NULL);
+
+/*
+ * 4. parse a range specifier of the form: addr [,addr] [;addr] ..
*
* where 'addr' is:
*
@@ -2021,22 +2136,82 @@ do_one_cmd(cmdlinep, sourcing,
* is equal to the lower.
*/
+ if (ea.cmdidx != CMD_SIZE
+#ifdef FEAT_USR_CMDS
+ && ea.cmdidx != CMD_USER
+#endif
+ )
+ ea.addr_type = cmdnames[(int)ea.cmdidx].cmd_addr_type;
+ else
+ ea.addr_type = ADDR_LINES;
+ ea.cmd = cmd;
+
/* repeat for all ',' or ';' separated addresses */
for (;;)
{
ea.line1 = ea.line2;
- ea.line2 = curwin->w_cursor.lnum; /* default is current line number */
+ switch (ea.addr_type)
+ {
+ case ADDR_LINES:
+ /* default is current line number */
+ ea.line2 = curwin->w_cursor.lnum;
+ break;
+ case ADDR_WINDOWS:
+ lnum = CURRENT_WIN_NR;
+ ea.line2 = lnum;
+ break;
+ case ADDR_ARGUMENTS:
+ ea.line2 = curwin->w_arg_idx + 1;
+ break;
+ case ADDR_LOADED_BUFFERS:
+ case ADDR_UNLOADED_BUFFERS:
+ ea.line2 = curbuf->b_fnum;
+ break;
+ case ADDR_TABS:
+ lnum = CURRENT_TAB_NR;
+ ea.line2 = lnum;
+ break;
+ }
ea.cmd = skipwhite(ea.cmd);
- lnum = get_address(&ea.cmd, ea.skip, ea.addr_count == 0);
+ lnum = get_address(&ea.cmd, ea.addr_type, ea.skip, ea.addr_count == 0);
if (ea.cmd == NULL) /* error detected */
goto doend;
if (lnum == MAXLNUM)
{
if (*ea.cmd == '%') /* '%' - all lines */
{
+ buf_T *buf;
++ea.cmd;
- ea.line1 = 1;
- ea.line2 = curbuf->b_ml.ml_line_count;
+ switch (ea.addr_type)
+ {
+ case ADDR_LINES:
+ ea.line1 = 1;
+ ea.line2 = curbuf->b_ml.ml_line_count;
+ break;
+ case ADDR_LOADED_BUFFERS:
+ buf = firstbuf;
+ while (buf->b_next != NULL && buf->b_ml.ml_mfp == NULL)
+ buf = buf->b_next;
+ ea.line1 = buf->b_fnum;
+ buf = lastbuf;
+ while (buf->b_prev != NULL && buf->b_ml.ml_mfp == NULL)
+ buf = buf->b_prev;
+ ea.line2 = buf->b_fnum;
+ break;
+ case ADDR_UNLOADED_BUFFERS:
+ ea.line1 = firstbuf->b_fnum;
+ ea.line2 = lastbuf->b_fnum;
+ break;
+ case ADDR_WINDOWS:
+ case ADDR_TABS:
+ errormsg = (char_u *)_(e_invrange);
+ goto doend;
+ break;
+ case ADDR_ARGUMENTS:
+ ea.line1 = 1;
+ ea.line2 = ARGCOUNT;
+ break;
+ }
++ea.addr_count;
}
/* '*' - visual area */
@@ -2044,6 +2219,12 @@ do_one_cmd(cmdlinep, sourcing,
{
pos_T *fp;
+ if (ea.addr_type != ADDR_LINES)
+ {
+ errormsg = (char_u *)_(e_invrange);
+ goto doend;
+ }
+
++ea.cmd;
if (!ea.skip)
{
@@ -2086,7 +2267,7 @@ do_one_cmd(cmdlinep, sourcing,
check_cursor_lnum();
/*
- * 4. parse command
+ * 5. Parse the command.
*/
/*
@@ -2100,8 +2281,8 @@ do_one_cmd(cmdlinep, sourcing,
* If we got a line, but no command, then go to the line.
* If we find a '|' or '\n' we set ea.nextcmd.
*/
- if (*ea.cmd == NUL || *ea.cmd == '"' ||
- (ea.nextcmd = check_nextcmd(ea.cmd)) != NULL)
+ if (*ea.cmd == NUL || *ea.cmd == '"'
+ || (ea.nextcmd = check_nextcmd(ea.cmd)) != NULL)
{
/*
* strange vi behaviour:
@@ -2147,8 +2328,25 @@ do_one_cmd(cmdlinep, sourcing,
goto doend;
}
- /* Find the command and let "p" point to after it. */
- p = find_command(&ea, NULL);
+#ifdef FEAT_AUTOCMD
+ /* If this looks like an undefined user command and there are CmdUndefined
+ * autocommands defined, trigger the matching autocommands. */
+ if (p != NULL && ea.cmdidx == CMD_SIZE && !ea.skip
+ && ASCII_ISUPPER(*ea.cmd)
+ && has_cmdundefined())
+ {
+ int ret;
+
+ p = ea.cmd;
+ while (ASCII_ISALNUM(*p))
+ ++p;
+ p = vim_strnsave(ea.cmd, (int)(p - ea.cmd));
+ ret = apply_autocmds(EVENT_CMDUNDEFINED, p, p, TRUE, NULL);
+ vim_free(p);
+ if (ret && !aborting())
+ p = find_command(&ea, NULL);
+ }
+#endif
#ifdef FEAT_USR_CMDS
if (p == NULL)
@@ -2177,11 +2375,8 @@ do_one_cmd(cmdlinep, sourcing,
goto doend;
}
- ni = (
-#ifdef FEAT_USR_CMDS
- !USER_CMDIDX(ea.cmdidx) &&
-#endif
- (cmdnames[ea.cmdidx].cmd_func == ex_ni
+ ni = (!IS_USER_CMDIDX(ea.cmdidx)
+ && (cmdnames[ea.cmdidx].cmd_func == ex_ni
#ifdef HAVE_EX_SCRIPT_NI
|| cmdnames[ea.cmdidx].cmd_func == ex_script_ni
#endif
@@ -2214,11 +2409,9 @@ do_one_cmd(cmdlinep, sourcing,
ea.forceit = FALSE;
/*
- * 5. parse arguments
+ * 6. Parse arguments.
*/
-#ifdef FEAT_USR_CMDS
- if (!USER_CMDIDX(ea.cmdidx))
-#endif
+ if (!IS_USER_CMDIDX(ea.cmdidx))
ea.argt = (long)cmdnames[(int)ea.cmdidx].cmd_argt;
if (!ea.skip)
@@ -2239,10 +2432,7 @@ do_one_cmd(cmdlinep, sourcing,
}
if (text_locked() && !(ea.argt & CMDWIN)
-# ifdef FEAT_USR_CMDS
- && !USER_CMDIDX(ea.cmdidx)
-# endif
- )
+ && !IS_USER_CMDIDX(ea.cmdidx))
{
/* Command not allowed when editing the command line. */
#ifdef FEAT_CMDWIN
@@ -2260,9 +2450,7 @@ do_one_cmd(cmdlinep, sourcing,
if (!(ea.argt & CMDWIN)
&& ea.cmdidx != CMD_edit
&& ea.cmdidx != CMD_checktime
-# ifdef FEAT_USR_CMDS
- && !USER_CMDIDX(ea.cmdidx)
-# endif
+ && !IS_USER_CMDIDX(ea.cmdidx)
&& curbuf_locked())
goto doend;
#endif
@@ -2455,10 +2643,8 @@ do_one_cmd(cmdlinep, sourcing,
/* accept numbered register only when no count allowed (:put) */
if ( (ea.argt & REGSTR)
&& *ea.arg != NUL
-#ifdef FEAT_USR_CMDS
- /* Do not allow register = for user commands */
- && (!USER_CMDIDX(ea.cmdidx) || *ea.arg != '=')
-#endif
+ /* Do not allow register = for user commands */
+ && (!IS_USER_CMDIDX(ea.cmdidx) || *ea.arg != '=')
&& !((ea.argt & COUNT) && VIM_ISDIGIT(*ea.arg)))
{
#ifndef FEAT_CLIPBOARD
@@ -2469,14 +2655,8 @@ do_one_cmd(cmdlinep, sourcing,
goto doend;
}
#endif
- if (
-#ifdef FEAT_USR_CMDS
- valid_yank_reg(*ea.arg, (ea.cmdidx != CMD_put
- && USER_CMDIDX(ea.cmdidx)))
-#else
- valid_yank_reg(*ea.arg, ea.cmdidx != CMD_put)
-#endif
- )
+ if (valid_yank_reg(*ea.arg, (ea.cmdidx != CMD_put
+ && !IS_USER_CMDIDX(ea.cmdidx))))
{
ea.regname = *ea.arg++;
#ifdef FEAT_EVAL
@@ -2650,10 +2830,7 @@ do_one_cmd(cmdlinep, sourcing,
* number. Don't do this for a user command.
*/
if ((ea.argt & BUFNAME) && *ea.arg != NUL && ea.addr_count == 0
-# ifdef FEAT_USR_CMDS
- && !USER_CMDIDX(ea.cmdidx)
-# endif
- )
+ && !IS_USER_CMDIDX(ea.cmdidx))
{
/*
* :bdelete, :bwipeout and :bunload take several arguments, separated
@@ -2679,7 +2856,7 @@ do_one_cmd(cmdlinep, sourcing,
#endif
/*
- * 6. switch on command name
+ * 7. Switch on command name.
*
* The "ea" structure holds the arguments that can be used.
*/
@@ -2691,7 +2868,7 @@ do_one_cmd(cmdlinep, sourcing,
#endif
#ifdef FEAT_USR_CMDS
- if (USER_CMDIDX(ea.cmdidx))
+ if (IS_USER_CMDIDX(ea.cmdidx))
{
/*
* Execute a user-defined command.
@@ -2750,11 +2927,8 @@ doend:
}
#ifdef FEAT_EVAL
do_errthrow(cstack,
- (ea.cmdidx != CMD_SIZE
-# ifdef FEAT_USR_CMDS
- && !USER_CMDIDX(ea.cmdidx)
-# endif
- ) ? cmdnames[(int)ea.cmdidx].cmd_name : (char_u *)NULL);
+ (ea.cmdidx != CMD_SIZE && !IS_USER_CMDIDX(ea.cmdidx))
+ ? cmdnames[(int)ea.cmdidx].cmd_name : (char_u *)NULL);
#endif
if (verbose_save >= 0)
@@ -3219,7 +3393,7 @@ set_one_cmd_context(xp, buff)
ea.argt = 0;
/*
- * 2. skip comment lines and leading space, colons or bars
+ * 1. skip comment lines and leading space, colons or bars
*/
for (cmd = buff; vim_strchr((char_u *)" \t:|", *cmd) != NULL; cmd++)
;
@@ -3234,13 +3408,9 @@ set_one_cmd_context(xp, buff)
}
/*
- * 3. parse a range specifier of the form: addr [,addr] [;addr] ..
+ * 3. Skip over the range to find the command.
*/
cmd = skip_range(cmd, &xp->xp_context);
-
-/*
- * 4. parse command
- */
xp->xp_pattern = cmd;
if (*cmd == NUL)
return NULL;
@@ -3346,11 +3516,9 @@ set_one_cmd_context(xp, buff)
}
/*
- * 5. parse arguments
+ * 6. parse arguments
*/
-#ifdef FEAT_USR_CMDS
- if (!USER_CMDIDX(ea.cmdidx))
-#endif
+ if (!IS_USER_CMDIDX(ea.cmdidx))
ea.argt = (long)cmdnames[(int)ea.cmdidx].cmd_argt;
arg = skipwhite(p);
@@ -3584,7 +3752,7 @@ set_one_cmd_context(xp, buff)
}
/*
- * 6. switch on command name
+ * 6. Switch on command name.
*/
switch (ea.cmdidx)
{
@@ -4100,8 +4268,9 @@ skip_range(cmd, ctx)
* Return MAXLNUM when no Ex address was found.
*/
static linenr_T
-get_address(ptr, skip, to_other_file)
+get_address(ptr, addr_type, skip, to_other_file)
char_u **ptr;
+ int addr_type; /* flag: one of ADDR_LINES, ... */
int skip; /* only skip the address, don't use it */
int to_other_file; /* flag: may jump to other file */
{
@@ -4120,137 +4289,188 @@ get_address(ptr, skip, to_other_file)
switch (*cmd)
{
case '.': /* '.' - Cursor position */
- ++cmd;
+ ++cmd;
+ switch (addr_type)
+ {
+ case ADDR_LINES:
lnum = curwin->w_cursor.lnum;
break;
+ case ADDR_WINDOWS:
+ lnum = CURRENT_WIN_NR;
+ break;
+ case ADDR_ARGUMENTS:
+ lnum = curwin->w_arg_idx + 1;
+ break;
+ case ADDR_LOADED_BUFFERS:
+ case ADDR_UNLOADED_BUFFERS:
+ lnum = curbuf->b_fnum;
+ break;
+ case ADDR_TABS:
+ lnum = CURRENT_TAB_NR;
+ break;
+ }
+ break;
case '$': /* '$' - last line */
- ++cmd;
+ ++cmd;
+ switch (addr_type)
+ {
+ case ADDR_LINES:
lnum = curbuf->b_ml.ml_line_count;
break;
+ case ADDR_WINDOWS:
+ lnum = LAST_WIN_NR;
+ break;
+ case ADDR_ARGUMENTS:
+ lnum = ARGCOUNT;
+ break;
+ case ADDR_LOADED_BUFFERS:
+ case ADDR_UNLOADED_BUFFERS:
+ lnum = lastbuf->b_fnum;
+ break;
+ case ADDR_TABS:
+ lnum = LAST_TAB_NR;
+ break;
+ }
+ break;
case '\'': /* ''' - mark */
- if (*++cmd == NUL)
+ if (*++cmd == NUL)
+ {
+ cmd = NULL;
+ goto error;
+ }
+ if (addr_type != ADDR_LINES)
+ {
+ EMSG(_(e_invaddr));
+ goto error;
+ }
+ if (skip)
+ ++cmd;
+ else
+ {
+ /* Only accept a mark in another file when it is
+ * used by itself: ":'M". */
+ fp = getmark(*cmd, to_other_file && cmd[1] == NUL);
+ ++cmd;
+ if (fp == (pos_T *)-1)
+ /* Jumped to another file. */
+ lnum = curwin->w_cursor.lnum;
+ else
+ {
+ if (check_mark(fp) == FAIL)
{
cmd = NULL;
goto error;
}
- if (skip)
- ++cmd;
- else
- {
- /* Only accept a mark in another file when it is
- * used by itself: ":'M". */
- fp = getmark(*cmd, to_other_file && cmd[1] == NUL);
- ++cmd;
- if (fp == (pos_T *)-1)
- /* Jumped to another file. */
- lnum = curwin->w_cursor.lnum;
- else
- {
- if (check_mark(fp) == FAIL)
- {
- cmd = NULL;
- goto error;
- }
- lnum = fp->lnum;
- }
- }
- break;
+ lnum = fp->lnum;
+ }
+ }
+ break;
case '/':
case '?': /* '/' or '?' - search */
- c = *cmd++;
- if (skip) /* skip "/pat/" */
- {
- cmd = skip_regexp(cmd, c, (int)p_magic, NULL);
- if (*cmd == c)
- ++cmd;
- }
- else
- {
- pos = curwin->w_cursor; /* save curwin->w_cursor */
- /*
- * When '/' or '?' follows another address, start
- * from there.
- */
- if (lnum != MAXLNUM)
- curwin->w_cursor.lnum = lnum;
- /*
- * Start a forward search at the end of the line.
- * Start a backward search at the start of the line.
- * This makes sure we never match in the current
- * line, and can match anywhere in the
- * next/previous line.
- */
- if (c == '/')
- curwin->w_cursor.col = MAXCOL;
- else
- curwin->w_cursor.col = 0;
- searchcmdlen = 0;
- if (!do_search(NULL, c, cmd, 1L,
- SEARCH_HIS | SEARCH_MSG, NULL))
- {
- curwin->w_cursor = pos;
- cmd = NULL;
- goto error;
- }
- lnum = curwin->w_cursor.lnum;
- curwin->w_cursor = pos;
- /* adjust command string pointer */
- cmd += searchcmdlen;
- }
- break;
+ c = *cmd++;
+ if (addr_type != ADDR_LINES)
+ {
+ EMSG(_(e_invaddr));
+ goto error;
+ }
+ if (skip) /* skip "/pat/" */
+ {
+ cmd = skip_regexp(cmd, c, (int)p_magic, NULL);
+ if (*cmd == c)
+ ++cmd;
+ }
+ else
+ {
+ pos = curwin->w_cursor; /* save curwin->w_cursor */
+ /*
+ * When '/' or '?' follows another address, start
+ * from there.
+ */
+ if (lnum != MAXLNUM)
+ curwin->w_cursor.lnum = lnum;
+ /*
+ * Start a forward search at the end of the line.
+ * Start a backward search at the start of the line.
+ * This makes sure we never match in the current
+ * line, and can match anywhere in the
+ * next/previous line.
+ */
+ if (c == '/')
+ curwin->w_cursor.col = MAXCOL;
+ else
+ curwin->w_cursor.col = 0;
+ searchcmdlen = 0;
+ if (!do_search(NULL, c, cmd, 1L,
+ SEARCH_HIS | SEARCH_MSG, NULL))
+ {
+ curwin->w_cursor = pos;
+ cmd = NULL;
+ goto error;
+ }
+ lnum = curwin->w_cursor.lnum;
+ curwin->w_cursor = pos;
+ /* adjust command string pointer */
+ cmd += searchcmdlen;
+ }
+ break;
case '\\': /* "\?", "\/" or "\&", repeat search */
- ++cmd;
- if (*cmd == '&')
- i = RE_SUBST;
- else if (*cmd == '?' || *cmd == '/')
- i = RE_SEARCH;
- else
- {
- EMSG(_(e_backslash));
- cmd = NULL;
- goto error;
- }
+ ++cmd;
+ if (addr_type != ADDR_LINES)
+ {
+ EMSG(_(e_invaddr));
+ goto error;
+ }
+ if (*cmd == '&')
+ i = RE_SUBST;
+ else if (*cmd == '?' || *cmd == '/')
+ i = RE_SEARCH;
+ else
+ {
+ EMSG(_(e_backslash));
+ cmd = NULL;
+ goto error;
+ }
- if (!skip)
- {
- /*
- * When search follows another address, start from
- * there.
- */
- if (lnum != MAXLNUM)
- pos.lnum = lnum;
- else
- pos.lnum = curwin->w_cursor.lnum;
-
- /*
- * Start the search just like for the above
- * do_search().
- */
- if (*cmd != '?')
- pos.col = MAXCOL;
- else
- pos.col = 0;
- if (searchit(curwin, curbuf, &pos,
- *cmd == '?' ? BACKWARD : FORWARD,
- (char_u *)"", 1L, SEARCH_MSG,
- i, (linenr_T)0, NULL) != FAIL)
- lnum = pos.lnum;
- else
- {
- cmd = NULL;
- goto error;
- }
- }
- ++cmd;
- break;
+ if (!skip)
+ {
+ /*
+ * When search follows another address, start from
+ * there.
+ */
+ if (lnum != MAXLNUM)
+ pos.lnum = lnum;
+ else
+ pos.lnum = curwin->w_cursor.lnum;
+
+ /*
+ * Start the search just like for the above
+ * do_search().
+ */
+ if (*cmd != '?')
+ pos.col = MAXCOL;
+ else
+ pos.col = 0;
+ if (searchit(curwin, curbuf, &pos,
+ *cmd == '?' ? BACKWARD : FORWARD,
+ (char_u *)"", 1L, SEARCH_MSG,
+ i, (linenr_T)0, NULL) != FAIL)
+ lnum = pos.lnum;
+ else
+ {
+ cmd = NULL;
+ goto error;
+ }
+ }
+ ++cmd;
+ break;
default:
- if (VIM_ISDIGIT(*cmd)) /* absolute line number */
- lnum = getdigits(&cmd);
+ if (VIM_ISDIGIT(*cmd)) /* absolute line number */
+ lnum = getdigits(&cmd);
}
for (;;)
@@ -4260,7 +4480,29 @@ get_address(ptr, skip, to_other_file)
break;
if (lnum == MAXLNUM)
- lnum = curwin->w_cursor.lnum; /* "+1" is same as ".+1" */
+ {
+ switch (addr_type)
+ {
+ case ADDR_LINES:
+ /* "+1" is same as ".+1" */
+ lnum = curwin->w_cursor.lnum;
+ break;
+ case ADDR_WINDOWS:
+ lnum = CURRENT_WIN_NR;
+ break;
+ case ADDR_ARGUMENTS:
+ lnum = curwin->w_arg_idx + 1;
+ break;
+ case ADDR_LOADED_BUFFERS:
+ case ADDR_UNLOADED_BUFFERS:
+ lnum = curbuf->b_fnum;
+ break;
+ case ADDR_TABS:
+ lnum = CURRENT_TAB_NR;
+ break;
+ }
+ }
+
if (VIM_ISDIGIT(*cmd))
i = '+'; /* "number" is same as "+number" */
else
@@ -4269,10 +4511,53 @@ get_address(ptr, skip, to_other_file)
n = 1;
else
n = getdigits(&cmd);
- if (i == '-')
+ if (addr_type == ADDR_LOADED_BUFFERS
+ || addr_type == ADDR_UNLOADED_BUFFERS)
+ lnum = compute_buffer_local_count(addr_type, lnum, (i == '-') ? -1 * n : n);
+ else if (i == '-')
lnum -= n;
else
lnum += n;
+
+ switch (addr_type)
+ {
+ case ADDR_LINES:
+ break;
+ case ADDR_ARGUMENTS:
+ if (lnum < 0)
+ lnum = 0;
+ else if (lnum >= ARGCOUNT)
+ lnum = ARGCOUNT;
+ break;
+ case ADDR_TABS:
+ if (lnum < 0)
+ {
+ lnum = 0;
+ break;
+ }
+ if (lnum >= LAST_TAB_NR)
+ lnum = LAST_TAB_NR;
+ break;
+ case ADDR_WINDOWS:
+ if (lnum < 0)
+ {
+ lnum = 0;
+ break;
+ }
+ if (lnum >= LAST_WIN_NR)
+ lnum = LAST_WIN_NR;
+ break;
+ case ADDR_LOADED_BUFFERS:
+ case ADDR_UNLOADED_BUFFERS:
+ if (lnum < firstbuf->b_fnum)
+ {
+ lnum = firstbuf->b_fnum;
+ break;
+ }
+ if (lnum > lastbuf->b_fnum)
+ lnum = lastbuf->b_fnum;
+ break;
+ }
}
} while (*cmd == '/' || *cmd == '?');
@@ -5132,6 +5417,8 @@ ex_buffer(eap)
goto_buffer(eap, DOBUF_CURRENT, FORWARD, 0);
else
goto_buffer(eap, DOBUF_FIRST, FORWARD, (int)eap->line2);
+ if (eap->do_ecmd_cmd != NULL)
+ do_cmdline_cmd(eap->do_ecmd_cmd);
}
}
@@ -5144,6 +5431,8 @@ ex_bmodified(eap)
exarg_T *eap;
{
goto_buffer(eap, DOBUF_MOD, FORWARD, (int)eap->line2);
+ if (eap->do_ecmd_cmd != NULL)
+ do_cmdline_cmd(eap->do_ecmd_cmd);
}
/*
@@ -5155,6 +5444,8 @@ ex_bnext(eap)
exarg_T *eap;
{
goto_buffer(eap, DOBUF_CURRENT, FORWARD, (int)eap->line2);
+ if (eap->do_ecmd_cmd != NULL)
+ do_cmdline_cmd(eap->do_ecmd_cmd);
}
/*
@@ -5168,6 +5459,8 @@ ex_bprevious(eap)
exarg_T *eap;
{
goto_buffer(eap, DOBUF_CURRENT, BACKWARD, (int)eap->line2);
+ if (eap->do_ecmd_cmd != NULL)
+ do_cmdline_cmd(eap->do_ecmd_cmd);
}
/*
@@ -5181,6 +5474,8 @@ ex_brewind(eap)
exarg_T *eap;
{
goto_buffer(eap, DOBUF_FIRST, FORWARD, 0);
+ if (eap->do_ecmd_cmd != NULL)
+ do_cmdline_cmd(eap->do_ecmd_cmd);
}
/*
@@ -5192,6 +5487,8 @@ ex_blast(eap)
exarg_T *eap;
{
goto_buffer(eap, DOBUF_LAST, BACKWARD, 0);
+ if (eap->do_ecmd_cmd != NULL)
+ do_cmdline_cmd(eap->do_ecmd_cmd);
}
#endif
@@ -6556,12 +6853,16 @@ not_exiting()
}
/*
- * ":quit": quit current window, quit Vim if closed the last window.
+ * ":quit": quit current window, quit Vim if the last window is closed.
*/
static void
ex_quit(eap)
exarg_T *eap;
{
+#if defined(FEAT_WINDOWS) || defined(FEAT_AUTOCMD)
+ win_T *wp;
+#endif
+
#ifdef FEAT_CMDWIN
if (cmdwin_type != 0)
{
@@ -6575,11 +6876,27 @@ ex_quit(eap)
text_locked_msg();
return;
}
+#ifdef FEAT_WINDOWS
+ if (eap->addr_count > 0)
+ {
+ int wnr = eap->line2;
+
+ for (wp = firstwin; wp->w_next != NULL; wp = wp->w_next)
+ if (--wnr <= 0)
+ break;
+ }
+ else
+#endif
+#if defined(FEAT_WINDOWS) || defined(FEAT_AUTOCMD)
+ wp = curwin;
+#endif
+
#ifdef FEAT_AUTOCMD
apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, curbuf);
/* Refuse to quit when locked or when the buffer in the last window is
* being closed (can only happen in autocommands). */
- if (curbuf_locked() || (curbuf->b_nwindows == 1 && curbuf->b_closing))
+ if (curbuf_locked() || (wp->w_buffer->b_nwindows == 1
+ && wp->w_buffer->b_closing))
return;
#endif
@@ -6612,7 +6929,7 @@ ex_quit(eap)
need_mouse_correct = TRUE;
# endif
/* close window; may free buffer */
- win_close(curwin, !P_HID(curwin->w_buffer) || eap->forceit);
+ win_close(wp, !P_HID(wp->w_buffer) || eap->forceit);
#endif
}
}
@@ -6674,6 +6991,8 @@ ex_quit_all(eap)
ex_close(eap)
exarg_T *eap;
{
+ win_T *win;
+ int winnr = 0;
# ifdef FEAT_CMDWIN
if (cmdwin_type != 0)
cmdwin_result = Ctrl_C;
@@ -6684,7 +7003,21 @@ ex_close(eap)
&& !curbuf_locked()
#endif
)
- ex_win_close(eap->forceit, curwin, NULL);
+ {
+ if (eap->addr_count == 0)
+ ex_win_close(eap->forceit, curwin, NULL);
+ else {
+ for (win = firstwin; win != NULL; win = win->w_next)
+ {
+ winnr++;
+ if (winnr == eap->line2)
+ break;
+ }
+ if (win == NULL)
+ win = lastwin;
+ ex_win_close(eap->forceit, win, NULL);
+ }
+ }
}
# ifdef FEAT_QUICKFIX
@@ -6810,6 +7143,8 @@ ex_tabonly(eap)
MSG(_("Already only one tab page"));
else
{
+ if (eap->addr_count > 0)
+ goto_tabpage(eap->line2);
/* Repeat this up to a 1000 times, because autocommands may mess
* up the lists. */
for (done = 0; done < 1000; ++done)
@@ -6888,9 +7223,23 @@ tabpage_close_other(tp, forceit)
ex_only(eap)
exarg_T *eap;
{
+ win_T *wp;
+ int wnr;
# ifdef FEAT_GUI
need_mouse_correct = TRUE;
# endif
+ if (eap->addr_count > 0)
+ {
+ wnr = eap->line2;
+ for (wp = firstwin; --wnr > 0; )
+ {
+ if (wp->w_next == NULL)
+ break;
+ else
+ wp = wp->w_next;
+ }
+ win_goto(wp);
+ }
close_others(TRUE, eap->forceit);
}
@@ -6924,7 +7273,23 @@ ex_hide(eap)
# ifdef FEAT_GUI
need_mouse_correct = TRUE;
# endif
- win_close(curwin, FALSE); /* don't free buffer */
+ if (eap->addr_count == 0)
+ win_close(curwin, FALSE); /* don't free buffer */
+ else
+ {
+ int winnr = 0;
+ win_T *win;
+
+ for (win = firstwin; win != NULL; win = win->w_next)
+ {
+ winnr++;
+ if (winnr == eap->line2)
+ break;
+ }
+ if (win == NULL)
+ win = lastwin;
+ win_close(win, FALSE);
+ }
}
#endif
}
@@ -8660,7 +9025,7 @@ ex_copymove(eap)
{
long n;
- n = get_address(&eap->arg, FALSE, FALSE);
+ n = get_address(&eap->arg, eap->addr_type, FALSE, FALSE);
if (eap->arg == NULL) /* error detected */
{
eap->nextcmd = NULL;
@@ -9534,8 +9899,15 @@ ex_normal(eap)
msg_didout |= save_msg_didout; /* don't reset msg_didout now */
/* Restore the state (needed when called from a function executed for
- * 'indentexpr'). */
+ * 'indentexpr'). Update the mouse and cursor, they may have changed. */
State = save_State;
+#ifdef FEAT_MOUSE
+ setmouse();
+#endif
+#ifdef CURSOR_SHAPE
+ ui_cursor_shape(); /* may show different cursor shape */
+#endif
+
#ifdef FEAT_MBYTE
vim_free(arg);
#endif
@@ -11533,8 +11905,8 @@ ex_match(eap)
ex_X(eap)
exarg_T *eap UNUSED;
{
- if (get_crypt_method(curbuf) == 0 || blowfish_self_test() == OK)
- (void)get_crypt_key(TRUE, TRUE);
+ crypt_check_current_method();
+ (void)crypt_get_key(TRUE, TRUE);
}
#endif
@@ -11561,6 +11933,10 @@ ex_folddo(eap)
{
linenr_T lnum;
+#ifdef FEAT_CLIPBOARD
+ start_global_changes();
+#endif
+
/* First set the marks for all lines closed/open. */
for (lnum = eap->line1; lnum <= eap->line2; ++lnum)
if (hasFolding(lnum, NULL, NULL) == (eap->cmdidx == CMD_folddoclosed))
@@ -11569,5 +11945,8 @@ ex_folddo(eap)
/* Execute the command on the marked lines. */
global_exe(eap->arg);
ml_clearmarked(); /* clear rest of the marks */
+#ifdef FEAT_CLIPBOARD
+ end_global_changes();
+#endif
}
#endif
diff --git a/src/ex_getln.c b/src/ex_getln.c
index b5fa737..ee33125 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -759,11 +759,14 @@ getcmdline(firstc, count, indent)
#ifdef FEAT_CMDWIN
if (c == cedit_key || c == K_CMDWIN)
{
- /*
- * Open a window to edit the command line (and history).
- */
- c = ex_window();
- some_key_typed = TRUE;
+ if (ex_normal_busy == 0 && got_int == FALSE)
+ {
+ /*
+ * Open a window to edit the command line (and history).
+ */
+ c = ex_window();
+ some_key_typed = TRUE;
+ }
}
# ifdef FEAT_DIGRAPHS
else
@@ -6377,6 +6380,9 @@ ex_window()
#ifdef FEAT_RIGHTLEFT
int save_cmdmsg_rl = cmdmsg_rl;
#endif
+#ifdef FEAT_FOLDING
+ int save_KeyTyped;
+#endif
/* Can't do this recursively. Can't do it when typing a password. */
if (cmdwin_type != 0
@@ -6511,8 +6517,19 @@ ex_window()
RedrawingDisabled = i;
# ifdef FEAT_AUTOCMD
+
+# ifdef FEAT_FOLDING
+ save_KeyTyped = KeyTyped;
+# endif
+
/* Trigger CmdwinLeave autocommands. */
apply_autocmds(EVENT_CMDWINLEAVE, typestr, typestr, FALSE, curbuf);
+
+# ifdef FEAT_FOLDING
+ /* Restore KeyTyped in case it is modified by autocommands */
+ KeyTyped = save_KeyTyped;
+# endif
+
# endif
/* Restore the command line info. */
diff --git a/src/feature.h b/src/feature.h
index 45d20f2..886082a 100644
--- a/src/feature.h
+++ b/src/feature.h
@@ -385,13 +385,6 @@
#endif
/*
- * +python and +python3 require FEAT_EVAL.
- */
-#if !defined(FEAT_EVAL) && (defined(FEAT_PYTHON3) || defined(FEAT_PYTHON))
-# define FEAT_EVAL
-#endif
-
-/*
* +profile Profiling for functions and scripts.
*/
#if defined(FEAT_HUGE) \
diff --git a/src/fileio.c b/src/fileio.c
index 0f3b024..aad9ead 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -24,20 +24,6 @@
#define BUFSIZE 8192 /* size of normal write buffer */
#define SMBUFSIZE 256 /* size of emergency write buffer */
-#ifdef FEAT_CRYPT
-/* crypt_magic[0] is pkzip crypt, crypt_magic[1] is sha2+blowfish */
-static char *crypt_magic[] = {"VimCrypt~01!", "VimCrypt~02!"};
-static char crypt_magic_head[] = "VimCrypt~";
-# define CRYPT_MAGIC_LEN 12 /* must be multiple of 4! */
-
-/* For blowfish, after the magic header, we store 8 bytes of salt and then 8
- * bytes of seed (initialisation vector). */
-static int crypt_salt_len[] = {0, 8};
-static int crypt_seed_len[] = {0, 8};
-#define CRYPT_SALT_LEN_MAX 8
-#define CRYPT_SEED_LEN_MAX 8
-#endif
-
/* Is there any system that doesn't have access()? */
#define USE_MCH_ACCESS
@@ -55,7 +41,6 @@ static char_u *readfile_charconvert __ARGS((char_u *fname, char_u *fenc, int *fd
static void check_marks_read __ARGS((void));
#endif
#ifdef FEAT_CRYPT
-static int crypt_method_from_magic __ARGS((char *ptr, int len));
static char_u *check_for_cryptkey __ARGS((char_u *cryptkey, char_u *ptr, long *sizep, off_t *filesizep, int newfile, char_u *fname, int *did_ask));
#endif
#ifdef UNIX
@@ -116,6 +101,9 @@ struct bw_info
#ifdef HAS_BW_FLAGS
int bw_flags; /* FIO_ flags */
#endif
+#ifdef FEAT_CRYPT
+ buf_T *bw_buffer; /* buffer being written */
+#endif
#ifdef FEAT_MBYTE
char_u bw_rest[CONV_RESTLEN]; /* not converted bytes */
int bw_restlen; /* nr of bytes in bw_rest[] */
@@ -250,7 +238,6 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags)
#ifdef FEAT_CRYPT
char_u *cryptkey = NULL;
int did_ask_for_key = FALSE;
- int crypt_method_used;
#endif
#ifdef FEAT_PERSISTENT_UNDO
context_sha256_T sha_ctx;
@@ -966,13 +953,6 @@ retry:
#endif
}
-#ifdef FEAT_CRYPT
- if (cryptkey != NULL)
- /* Need to reset the state, but keep the key, don't want to ask for it
- * again. */
- crypt_pop_state();
-#endif
-
/*
* When retrying with another "fenc" and the first time "fileformat"
* will be reset.
@@ -1175,6 +1155,15 @@ retry:
if (read_undo_file)
sha256_start(&sha_ctx);
#endif
+#ifdef FEAT_CRYPT
+ if (curbuf->b_cryptstate != NULL)
+ {
+ /* Need to free the state, but keep the key, don't want to ask for
+ * it again. */
+ crypt_free_state(curbuf->b_cryptstate);
+ curbuf->b_cryptstate = NULL;
+ }
+#endif
}
while (!error && !got_int)
@@ -1339,6 +1328,76 @@ retry:
size = read_eintr(fd, ptr, size);
}
+#ifdef FEAT_CRYPT
+ /*
+ * At start of file: Check for magic number of encryption.
+ */
+ if (filesize == 0 && size > 0)
+ cryptkey = check_for_cryptkey(cryptkey, ptr, &size,
+ &filesize, newfile, sfname,
+ &did_ask_for_key);
+ /*
+ * Decrypt the read bytes. This is done before checking for
+ * EOF because the crypt layer may be buffering.
+ */
+ if (cryptkey != NULL && size > 0)
+ {
+ if (crypt_works_inplace(curbuf->b_cryptstate))
+ {
+ crypt_decode_inplace(curbuf->b_cryptstate, ptr, size);
+ }
+ else
+ {
+ char_u *newptr = NULL;
+ int decrypted_size;
+
+ decrypted_size = crypt_decode_alloc(
+ curbuf->b_cryptstate, ptr, size, &newptr);
+
+ /* If the crypt layer is buffering, not producing
+ * anything yet, need to read more. */
+ if (size > 0 && decrypted_size == 0)
+ continue;
+
+ if (linerest == 0)
+ {
+ /* Simple case: reuse returned buffer (may be
+ * NULL, checked later). */
+ new_buffer = newptr;
+ }
+ else
+ {
+ long_u new_size;
+
+ /* Need new buffer to add bytes carried over. */
+ new_size = (long_u)(decrypted_size + linerest + 1);
+ new_buffer = lalloc(new_size, FALSE);
+ if (new_buffer == NULL)
+ {
+ do_outofmem_msg(new_size);
+ error = TRUE;
+ break;
+ }
+
+ mch_memmove(new_buffer, buffer, linerest);
+ if (newptr != NULL)
+ mch_memmove(new_buffer + linerest, newptr,
+ decrypted_size);
+ }
+
+ if (new_buffer != NULL)
+ {
+ vim_free(buffer);
+ buffer = new_buffer;
+ new_buffer = NULL;
+ line_start = buffer;
+ ptr = buffer + linerest;
+ }
+ size = decrypted_size;
+ }
+ }
+#endif
+
if (size <= 0)
{
if (size < 0) /* read error */
@@ -1403,21 +1462,6 @@ retry:
}
#endif
}
-
-#ifdef FEAT_CRYPT
- /*
- * At start of file: Check for magic number of encryption.
- */
- if (filesize == 0)
- cryptkey = check_for_cryptkey(cryptkey, ptr, &size,
- &filesize, newfile, sfname,
- &did_ask_for_key);
- /*
- * Decrypt the read bytes.
- */
- if (cryptkey != NULL && size > 0)
- crypt_decode(ptr, size);
-#endif
}
skip_read = FALSE;
@@ -1430,10 +1474,9 @@ retry:
*/
if ((filesize == 0
# ifdef FEAT_CRYPT
- || (filesize == (CRYPT_MAGIC_LEN
- + crypt_salt_len[use_crypt_method]
- + crypt_seed_len[use_crypt_method])
- && cryptkey != NULL)
+ || (cryptkey != NULL
+ && filesize == crypt_get_header_len(
+ crypt_get_method_nr(curbuf)))
# endif
)
&& (fio_flags == FIO_UCSBOM
@@ -2262,15 +2305,15 @@ failed:
save_file_ff(curbuf); /* remember the current file format */
#ifdef FEAT_CRYPT
- crypt_method_used = use_crypt_method;
- if (cryptkey != NULL)
+ if (curbuf->b_cryptstate != NULL)
{
- crypt_pop_state();
- if (cryptkey != curbuf->b_p_key)
- free_crypt_key(cryptkey);
- /* don't set cryptkey to NULL, it's used below as a flag that
- * encryption was used */
+ crypt_free_state(curbuf->b_cryptstate);
+ curbuf->b_cryptstate = NULL;
}
+ if (cryptkey != NULL && cryptkey != curbuf->b_p_key)
+ crypt_free_key(cryptkey);
+ /* Don't set cryptkey to NULL, it's used below as a flag that
+ * encryption was used. */
#endif
#ifdef FEAT_MBYTE
@@ -2457,10 +2500,7 @@ failed:
#ifdef FEAT_CRYPT
if (cryptkey != NULL)
{
- if (crypt_method_used == 1)
- STRCAT(IObuff, _("[blowfish]"));
- else
- STRCAT(IObuff, _("[crypted]"));
+ crypt_append_msg(curbuf);
c = TRUE;
}
#endif
@@ -2489,9 +2529,7 @@ failed:
#ifdef FEAT_CRYPT
if (cryptkey != NULL)
msg_add_lines(c, (long)linecnt, filesize
- - CRYPT_MAGIC_LEN
- - crypt_salt_len[use_crypt_method]
- - crypt_seed_len[use_crypt_method]);
+ - crypt_get_header_len(crypt_get_method_nr(curbuf)));
else
#endif
msg_add_lines(c, (long)linecnt, filesize);
@@ -2882,33 +2920,6 @@ check_marks_read()
#if defined(FEAT_CRYPT) || defined(PROTO)
/*
- * Get the crypt method used for a file from "ptr[len]", the magic text at the
- * start of the file.
- * Returns -1 when no encryption used.
- */
- static int
-crypt_method_from_magic(ptr, len)
- char *ptr;
- int len;
-{
- int i;
-
- for (i = 0; i < (int)(sizeof(crypt_magic) / sizeof(crypt_magic[0])); i++)
- {
- if (len < (CRYPT_MAGIC_LEN + crypt_salt_len[i] + crypt_seed_len[i]))
- continue;
- if (memcmp(ptr, crypt_magic[i], CRYPT_MAGIC_LEN) == 0)
- return i;
- }
-
- i = (int)STRLEN(crypt_magic_head);
- if (len >= i && memcmp(ptr, crypt_magic_head, i) == 0)
- EMSG(_("E821: File is encrypted with unknown method"));
-
- return -1;
-}
-
-/*
* Check for magic number used for encryption. Applies to the current buffer.
* If found, the magic number is removed from ptr[*sizep] and *sizep and
* *filesizep are updated.
@@ -2924,7 +2935,7 @@ check_for_cryptkey(cryptkey, ptr, sizep, filesizep, newfile, fname, did_ask)
char_u *fname; /* file name to display */
int *did_ask; /* flag: whether already asked for key */
{
- int method = crypt_method_from_magic((char *)ptr, *sizep);
+ int method = crypt_method_nr_from_magic((char *)ptr, *sizep);
int b_p_ro = curbuf->b_p_ro;
if (method >= 0)
@@ -2933,9 +2944,8 @@ check_for_cryptkey(cryptkey, ptr, sizep, filesizep, newfile, fname, did_ask)
* Avoids accidentally overwriting the file with garbage. */
curbuf->b_p_ro = TRUE;
- set_crypt_method(curbuf, method);
- if (method > 0)
- (void)blowfish_self_test();
+ /* Set the cryptmethod local to the buffer. */
+ crypt_set_cm_option(curbuf, method);
if (cryptkey == NULL && !*did_ask)
{
if (*curbuf->b_p_key)
@@ -2948,7 +2958,8 @@ check_for_cryptkey(cryptkey, ptr, sizep, filesizep, newfile, fname, did_ask)
* Happens when retrying to detect encoding. */
smsg((char_u *)_(need_key_msg), fname);
msg_scroll = TRUE;
- cryptkey = get_crypt_key(newfile, FALSE);
+ crypt_check_method(method);
+ cryptkey = crypt_get_key(newfile, FALSE);
*did_ask = TRUE;
/* check if empty key entered */
@@ -2963,24 +2974,18 @@ check_for_cryptkey(cryptkey, ptr, sizep, filesizep, newfile, fname, did_ask)
if (cryptkey != NULL)
{
- int seed_len = crypt_seed_len[method];
- int salt_len = crypt_salt_len[method];
+ int header_len;
- crypt_push_state();
- use_crypt_method = method;
- if (method == 0)
- crypt_init_keys(cryptkey);
- else
- {
- bf_key_init(cryptkey, ptr + CRYPT_MAGIC_LEN, salt_len);
- bf_cfb_init(ptr + CRYPT_MAGIC_LEN + salt_len, seed_len);
- }
+ curbuf->b_cryptstate = crypt_create_from_header(
+ method, cryptkey, ptr);
+ crypt_set_cm_option(curbuf, method);
+
+ /* Remove cryptmethod specific header from the text. */
+ header_len = crypt_get_header_len(method);
+ *filesizep += header_len;
+ *sizep -= header_len;
+ mch_memmove(ptr, ptr + header_len, (size_t)*sizep);
- /* Remove magic number from the text */
- *filesizep += CRYPT_MAGIC_LEN + salt_len + seed_len;
- *sizep -= CRYPT_MAGIC_LEN + salt_len + seed_len;
- mch_memmove(ptr, ptr + CRYPT_MAGIC_LEN + salt_len + seed_len,
- (size_t)*sizep);
/* Restore the read-only flag. */
curbuf->b_p_ro = b_p_ro;
}
@@ -2992,85 +2997,6 @@ check_for_cryptkey(cryptkey, ptr, sizep, filesizep, newfile, fname, did_ask)
return cryptkey;
}
-
-/*
- * Check for magic number used for encryption. Applies to the current buffer.
- * If found and decryption is possible returns OK;
- */
- int
-prepare_crypt_read(fp)
- FILE *fp;
-{
- int method;
- char_u buffer[CRYPT_MAGIC_LEN + CRYPT_SALT_LEN_MAX
- + CRYPT_SEED_LEN_MAX + 2];
-
- if (fread(buffer, CRYPT_MAGIC_LEN, 1, fp) != 1)
- return FAIL;
- method = crypt_method_from_magic((char *)buffer,
- CRYPT_MAGIC_LEN +
- CRYPT_SEED_LEN_MAX +
- CRYPT_SALT_LEN_MAX);
- if (method < 0 || method != get_crypt_method(curbuf))
- return FAIL;
-
- crypt_push_state();
- if (method == 0)
- crypt_init_keys(curbuf->b_p_key);
- else
- {
- int salt_len = crypt_salt_len[method];
- int seed_len = crypt_seed_len[method];
-
- if (fread(buffer, salt_len + seed_len, 1, fp) != 1)
- return FAIL;
- bf_key_init(curbuf->b_p_key, buffer, salt_len);
- bf_cfb_init(buffer + salt_len, seed_len);
- }
- return OK;
-}
-
-/*
- * Prepare for writing encrypted bytes for buffer "buf".
- * Returns a pointer to an allocated header of length "*lenp".
- * When out of memory returns NULL.
- * Otherwise calls crypt_push_state(), call crypt_pop_state() later.
- */
- char_u *
-prepare_crypt_write(buf, lenp)
- buf_T *buf;
- int *lenp;
-{
- char_u *header;
- int seed_len = crypt_seed_len[get_crypt_method(buf)];
- int salt_len = crypt_salt_len[get_crypt_method(buf)];
- char_u *salt;
- char_u *seed;
-
- header = alloc_clear(CRYPT_MAGIC_LEN + CRYPT_SALT_LEN_MAX
- + CRYPT_SEED_LEN_MAX + 2);
- if (header != NULL)
- {
- crypt_push_state();
- use_crypt_method = get_crypt_method(buf); /* select zip or blowfish */
- vim_strncpy(header, (char_u *)crypt_magic[use_crypt_method],
- CRYPT_MAGIC_LEN);
- if (use_crypt_method == 0)
- crypt_init_keys(buf->b_p_key);
- else
- {
- /* Using blowfish, add salt and seed. */
- salt = header + CRYPT_MAGIC_LEN;
- seed = salt + salt_len;
- sha2_seed(salt, salt_len, seed, seed_len);
- bf_key_init(buf->b_p_key, salt, salt_len);
- bf_cfb_init(seed, seed_len);
- }
- }
- *lenp = CRYPT_MAGIC_LEN + salt_len + seed_len;
- return header;
-}
-
#endif /* FEAT_CRYPT */
#ifdef UNIX
@@ -3224,9 +3150,7 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit,
int write_undo_file = FALSE;
context_sha256_T sha_ctx;
#endif
-#ifdef FEAT_CRYPT
- int crypt_method_used;
-#endif
+ unsigned int bkc = get_bkc_value(buf);
if (fname == NULL || *fname == NUL) /* safety check */
return FAIL;
@@ -3262,6 +3186,9 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit,
write_info.bw_iconv_fd = (iconv_t)-1;
# endif
#endif
+#ifdef FEAT_CRYPT
+ write_info.bw_buffer = buf;
+#endif
/* After writing a file changedtick changes but we don't want to display
* the line. */
@@ -3722,10 +3649,10 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit,
struct stat st;
#endif
- if ((bkc_flags & BKC_YES) || append) /* "yes" */
+ if ((bkc & BKC_YES) || append) /* "yes" */
backup_copy = TRUE;
#if defined(UNIX) || defined(WIN32)
- else if ((bkc_flags & BKC_AUTO)) /* "auto" */
+ else if ((bkc & BKC_AUTO)) /* "auto" */
{
int i;
@@ -3813,7 +3740,7 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit,
/*
* Break symlinks and/or hardlinks if we've been asked to.
*/
- if ((bkc_flags & BKC_BREAKSYMLINK) || (bkc_flags & BKC_BREAKHARDLINK))
+ if ((bkc & BKC_BREAKSYMLINK) || (bkc & BKC_BREAKHARDLINK))
{
# ifdef UNIX
int lstat_res;
@@ -3821,24 +3748,24 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit,
lstat_res = mch_lstat((char *)fname, &st);
/* Symlinks. */
- if ((bkc_flags & BKC_BREAKSYMLINK)
+ if ((bkc & BKC_BREAKSYMLINK)
&& lstat_res == 0
&& st.st_ino != st_old.st_ino)
backup_copy = FALSE;
/* Hardlinks. */
- if ((bkc_flags & BKC_BREAKHARDLINK)
+ if ((bkc & BKC_BREAKHARDLINK)
&& st_old.st_nlink > 1
&& (lstat_res != 0 || st.st_ino == st_old.st_ino))
backup_copy = FALSE;
# else
# if defined(WIN32)
/* Symlinks. */
- if ((bkc_flags & BKC_BREAKSYMLINK) && mch_is_symbolic_link(fname))
+ if ((bkc & BKC_BREAKSYMLINK) && mch_is_symbolic_link(fname))
backup_copy = FALSE;
/* Hardlinks. */
- if ((bkc_flags & BKC_BREAKHARDLINK) && mch_is_hard_link(fname))
+ if ((bkc & BKC_BREAKHARDLINK) && mch_is_hard_link(fname))
backup_copy = FALSE;
# endif
# endif
@@ -4505,17 +4432,17 @@ restore_backup:
#ifdef FEAT_CRYPT
if (*buf->b_p_key != NUL && !filtering)
{
- char_u *header;
- int header_len;
+ char_u *header;
+ int header_len;
- header = prepare_crypt_write(buf, &header_len);
- if (header == NULL)
+ buf->b_cryptstate = crypt_create_for_writing(crypt_get_method_nr(buf),
+ buf->b_p_key, &header, &header_len);
+ if (buf->b_cryptstate == NULL || header == NULL)
end = 0;
else
{
- /* Write magic number, so that Vim knows that this file is
- * encrypted when reading it again. This also undergoes utf-8 to
- * ucs-2/4 conversion when needed. */
+ /* Write magic number, so that Vim knows how this file is
+ * encrypted when reading it back. */
write_info.bw_buf = header;
write_info.bw_len = header_len;
write_info.bw_flags = FIO_NOCONVERT;
@@ -4769,12 +4696,13 @@ restore_backup:
mch_set_acl(wfname, acl);
#endif
#ifdef FEAT_CRYPT
- crypt_method_used = use_crypt_method;
- if (wb_flags & FIO_ENCRYPTED)
- crypt_pop_state();
+ if (buf->b_cryptstate != NULL)
+ {
+ crypt_free_state(buf->b_cryptstate);
+ buf->b_cryptstate = NULL;
+ }
#endif
-
#if defined(FEAT_MBYTE) && defined(FEAT_EVAL)
if (wfname != fname)
{
@@ -4924,10 +4852,7 @@ restore_backup:
#ifdef FEAT_CRYPT
if (wb_flags & FIO_ENCRYPTED)
{
- if (crypt_method_used == 1)
- STRCAT(IObuff, _("[blowfish]"));
- else
- STRCAT(IObuff, _("[crypted]"));
+ crypt_append_msg(buf);
c = TRUE;
}
#endif
@@ -4953,6 +4878,13 @@ restore_backup:
)
{
unchanged(buf, TRUE);
+#ifdef FEAT_AUTOCMD
+ /* buf->b_changedtick is always incremented in unchanged() but that
+ * should not trigger a TextChanged event. */
+ if (last_changedtick + 1 == buf->b_changedtick
+ && last_changedtick_buf == buf)
+ last_changedtick = buf->b_changedtick;
+#endif
u_unchanged(buf);
u_update_save_nr(buf);
}
@@ -5744,8 +5676,26 @@ buf_write_bytes(ip)
#endif /* FEAT_MBYTE */
#ifdef FEAT_CRYPT
- if (flags & FIO_ENCRYPTED) /* encrypt the data */
- crypt_encode(buf, len, buf);
+ if (flags & FIO_ENCRYPTED)
+ {
+ /* Encrypt the data. Do it in-place if possible, otherwise use an
+ * allocated buffer. */
+ if (crypt_works_inplace(ip->bw_buffer->b_cryptstate))
+ {
+ crypt_encode_inplace(ip->bw_buffer->b_cryptstate, buf, len);
+ }
+ else
+ {
+ char_u *outbuf;
+
+ len = crypt_encode_alloc(curbuf->b_cryptstate, buf, len, &outbuf);
+ if (len == 0)
+ return OK; /* Crypt layer is buffering, will flush later. */
+ wlen = write_eintr(ip->bw_fd, outbuf, len);
+ vim_free(outbuf);
+ return (wlen < len) ? FAIL : OK;
+ }
+ }
#endif
wlen = write_eintr(ip->bw_fd, buf, len);
@@ -7738,6 +7688,7 @@ static struct event_name
{"BufWriteCmd", EVENT_BUFWRITECMD},
{"CmdwinEnter", EVENT_CMDWINENTER},
{"CmdwinLeave", EVENT_CMDWINLEAVE},
+ {"CmdUndefined", EVENT_CMDUNDEFINED},
{"ColorScheme", EVENT_COLORSCHEME},
{"CompleteDone", EVENT_COMPLETEDONE},
{"CursorHold", EVENT_CURSORHOLD},
@@ -7859,6 +7810,9 @@ static int au_get_grouparg __ARGS((char_u **argp));
static int do_autocmd_event __ARGS((event_T event, char_u *pat, int nested, char_u *cmd, int forceit, int group));
static int apply_autocmds_group __ARGS((event_T event, char_u *fname, char_u *fname_io, int force, int group, buf_T *buf, exarg_T *eap));
static void auto_next_pat __ARGS((AutoPatCmd *apc, int stop_at_last));
+#if defined(FEAT_AUTOCMD) || defined(FEAT_WILDIGN)
+static int match_file_pat __ARGS((char_u *pattern, regprog_T **prog, char_u *fname, char_u *sfname, char_u *tail, int allow_dirs));
+#endif
static event_T last_event;
@@ -9105,6 +9059,9 @@ win_found:
curwin = aco->save_curwin;
curbuf = curwin->w_buffer;
+ /* In case the autocommand move the cursor to a position that that
+ * not exist in curbuf. */
+ check_cursor();
}
}
}
@@ -9256,6 +9213,24 @@ has_insertcharpre()
return (first_autopat[(int)EVENT_INSERTCHARPRE] != NULL);
}
+/*
+ * Return TRUE when there is an CmdUndefined autocommand defined.
+ */
+ int
+has_cmdundefined()
+{
+ return (first_autopat[(int)EVENT_CMDUNDEFINED] != NULL);
+}
+
+/*
+ * Return TRUE when there is an FuncUndefined autocommand defined.
+ */
+ int
+has_funcundefined()
+{
+ return (first_autopat[(int)EVENT_FUNCUNDEFINED] != NULL);
+}
+
static int
apply_autocmds_group(event, fname, fname_io, force, group, buf, eap)
event_T event;
@@ -9706,7 +9681,7 @@ auto_next_pat(apc, stop_at_last)
{
/* execution-condition */
if (ap->buflocal_nr == 0
- ? (match_file_pat(NULL, ap->reg_prog, apc->fname,
+ ? (match_file_pat(NULL, &ap->reg_prog, apc->fname,
apc->sfname, apc->tail, ap->allow_dirs))
: ap->buflocal_nr == apc->arg_bufnr)
{
@@ -9840,7 +9815,7 @@ has_autocmd(event, sfname, buf)
for (ap = first_autopat[(int)event]; ap != NULL; ap = ap->next)
if (ap->pat != NULL && ap->cmds != NULL
&& (ap->buflocal_nr == 0
- ? match_file_pat(NULL, ap->reg_prog,
+ ? match_file_pat(NULL, &ap->reg_prog,
fname, sfname, tail, ap->allow_dirs)
: buf != NULL && ap->buflocal_nr == buf->b_fnum
))
@@ -10101,10 +10076,10 @@ aucmd_restbuf(aco)
* Used for autocommands and 'wildignore'.
* Returns TRUE if there is a match, FALSE otherwise.
*/
- int
+ static int
match_file_pat(pattern, prog, fname, sfname, tail, allow_dirs)
char_u *pattern; /* pattern to match with */
- regprog_T *prog; /* pre-compiled regprog or NULL */
+ regprog_T **prog; /* pre-compiled regprog or NULL */
char_u *fname; /* full path of file name */
char_u *sfname; /* short file name or NULL */
char_u *tail; /* tail of path */
@@ -10159,7 +10134,7 @@ match_file_pat(pattern, prog, fname, sfname, tail, allow_dirs)
#endif
{
if (prog != NULL)
- regmatch.regprog = prog;
+ regmatch.regprog = *prog;
else
regmatch.regprog = vim_regcomp(pattern, RE_MAGIC);
}
@@ -10185,7 +10160,9 @@ match_file_pat(pattern, prog, fname, sfname, tail, allow_dirs)
|| (!allow_dirs && vim_regexec(&regmatch, tail, (colnr_T)0)))))
result = TRUE;
- if (prog == NULL)
+ if (prog != NULL)
+ *prog = regmatch.regprog;
+ else
vim_regfree(regmatch.regprog);
return result;
}
diff --git a/src/getchar.c b/src/getchar.c
index dbf273d..fb631b2 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -678,6 +678,17 @@ stuffReadbuff(s)
add_buff(&readbuf1, s, -1L);
}
+/*
+ * Append string "s" to the redo stuff buffer.
+ * CSI and K_SPECIAL must already have been escaped.
+ */
+ void
+stuffRedoReadbuff(s)
+ char_u *s;
+{
+ add_buff(&readbuf2, s, -1L);
+}
+
void
stuffReadbuffLen(s, len)
char_u *s;
@@ -3696,6 +3707,9 @@ do_map(maptype, arg, mode, abbrev)
{
if (!did_it)
retval = 2; /* no match */
+ else if (*keys == Ctrl_C)
+ /* If CTRL-C has been unmapped, reuse it for Interrupting. */
+ mapped_ctrl_c = FALSE;
goto theend;
}
@@ -3728,7 +3742,7 @@ do_map(maptype, arg, mode, abbrev)
goto theend;
}
- /* If CTRL-C has been mapped, don't always use it for Interrupting */
+ /* If CTRL-C has been mapped, don't always use it for Interrupting. */
if (*keys == Ctrl_C)
mapped_ctrl_c = TRUE;
@@ -4512,10 +4526,28 @@ check_abbr(c, ptr, col, mincol)
#endif
(mp = mp->m_next))
{
+ int qlen = mp->m_keylen;
+ char_u *q = mp->m_keys;
+ int match;
+
+ if (vim_strbyte(mp->m_keys, K_SPECIAL) != NULL)
+ {
+ /* might have CSI escaped mp->m_keys */
+ q = vim_strsave(mp->m_keys);
+ if (q != NULL)
+ {
+ vim_unescape_csi(q);
+ qlen = (int)STRLEN(q);
+ }
+ }
+
/* find entries with right mode and keys */
- if ( (mp->m_mode & State)
- && mp->m_keylen == len
- && !STRNCMP(mp->m_keys, ptr, (size_t)len))
+ match = (mp->m_mode & State)
+ && qlen == len
+ && !STRNCMP(q, ptr, (size_t)len);
+ if (q != mp->m_keys)
+ vim_free(q);
+ if (match)
break;
}
if (mp != NULL)
diff --git a/src/globals.h b/src/globals.h
index b932489..81ef56d 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -105,10 +105,6 @@ EXTERN int exec_from_reg INIT(= FALSE); /* executing register */
EXTERN int screen_cleared INIT(= FALSE); /* screen has been cleared */
-#ifdef FEAT_CRYPT
-EXTERN int use_crypt_method INIT(= 0);
-#endif
-
/*
* When '$' is included in 'cpoptions' option set:
* When a change command is given that deletes only part of a line, a dollar
@@ -533,6 +529,8 @@ EXTERN int clip_autoselect_plus INIT(= FALSE);
EXTERN int clip_autoselectml INIT(= FALSE);
EXTERN int clip_html INIT(= FALSE);
EXTERN regprog_T *clip_exclude_prog INIT(= NULL);
+EXTERN int clip_did_set_selection INIT(= TRUE);
+EXTERN int clip_unnamed_saved INIT(= 0);
#endif
/*
@@ -1340,9 +1338,6 @@ EXTERN int clientWindow INIT(= 0);
#if defined(UNIX) || defined(VMS)
EXTERN int term_is_xterm INIT(= FALSE); /* xterm-like 'term' */
#endif
-#if defined(UNIX)
-EXTERN int xterm_conflict_mouse INIT(= FALSE);
-#endif
#ifdef BACKSLASH_IN_FILENAME
EXTERN char psepc INIT(= '\\'); /* normal path separator character */
diff --git a/src/gui_beval.c b/src/gui_beval.c
index f956039..b2a740a 100644
--- a/src/gui_beval.c
+++ b/src/gui_beval.c
@@ -30,6 +30,7 @@ general_beval_cb(beval, state)
long winnr = 0;
char_u *bexpr;
buf_T *save_curbuf;
+ size_t len;
# ifdef FEAT_WINDOWS
win_T *cw;
# endif
@@ -83,6 +84,16 @@ general_beval_cb(beval, state)
vim_free(result);
result = eval_to_string(bexpr, NULL, TRUE);
+ /* Remove one trailing newline, it is added when the result was a
+ * list and it's hardly every useful. If the user really wants a
+ * trailing newline he can add two and one remains. */
+ if (result != NULL)
+ {
+ len = STRLEN(result);
+ if (len > 0 && result[len - 1] == NL)
+ result[len - 1] = NUL;
+ }
+
if (use_sandbox)
--sandbox;
--textlock;
diff --git a/src/gui_dwrite.cpp b/src/gui_dwrite.cpp
new file mode 100644
index 0000000..d4c43a3
--- /dev/null
+++ b/src/gui_dwrite.cpp
@@ -0,0 +1,901 @@
+/* vi:set ts=8 sts=4 sw=4 noet: */
+/*
+ * Author: MURAOKA Taro <koron.kaoriya@gmail.com>
+ *
+ * Contributors:
+ * - Ken Takata
+ *
+ * Copyright (C) 2013 MURAOKA Taro <koron.kaoriya@gmail.com>
+ * THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE.
+ */
+
+#define WIN32_LEAN_AND_MEAN
+
+#ifndef DYNAMIC_DIRECTX
+# if WINVER < 0x0600
+# error WINVER must be 0x0600 or above to use DirectWrite(DirectX)
+# endif
+#endif
+
+#include <windows.h>
+#include <crtdbg.h>
+#include <assert.h>
+#include <math.h>
+#include <d2d1.h>
+#include <d2d1helper.h>
+#include <dwrite.h>
+
+#include "gui_dwrite.h"
+
+#ifdef __MINGW32__
+# define __maybenull SAL__maybenull
+# define __in SAL__in
+# define __out SAL__out
+#endif
+
+#ifdef DYNAMIC_DIRECTX
+extern "C" HINSTANCE vimLoadLib(char *name);
+
+typedef int (WINAPI *PGETUSERDEFAULTLOCALENAME)(LPWSTR, int);
+typedef HRESULT (WINAPI *PD2D1CREATEFACTORY)(D2D1_FACTORY_TYPE,
+ REFIID, const D2D1_FACTORY_OPTIONS *, void **);
+typedef HRESULT (WINAPI *PDWRITECREATEFACTORY)(DWRITE_FACTORY_TYPE,
+ REFIID, IUnknown **);
+
+static HINSTANCE hD2D1DLL = NULL;
+static HINSTANCE hDWriteDLL = NULL;
+
+static PGETUSERDEFAULTLOCALENAME pGetUserDefaultLocaleName = NULL;
+static PD2D1CREATEFACTORY pD2D1CreateFactory = NULL;
+static PDWRITECREATEFACTORY pDWriteCreateFactory = NULL;
+
+#define GetUserDefaultLocaleName (*pGetUserDefaultLocaleName)
+#define D2D1CreateFactory (*pD2D1CreateFactory)
+#define DWriteCreateFactory (*pDWriteCreateFactory)
+
+ static void
+unload(HINSTANCE &hinst)
+{
+ if (hinst != NULL)
+ {
+ FreeLibrary(hinst);
+ hinst = NULL;
+ }
+}
+#endif // DYNAMIC_DIRECTX
+
+template <class T> inline void SafeRelease(T **ppT)
+{
+ if (*ppT)
+ {
+ (*ppT)->Release();
+ *ppT = NULL;
+ }
+}
+
+struct GdiTextRendererContext
+{
+ // const fields.
+ COLORREF color;
+ FLOAT cellWidth;
+
+ // working fields.
+ FLOAT offsetX;
+};
+
+ static DWRITE_PIXEL_GEOMETRY
+ToPixelGeometry(int value)
+{
+ switch (value)
+ {
+ default:
+ case 0:
+ return DWRITE_PIXEL_GEOMETRY_FLAT;
+ case 1:
+ return DWRITE_PIXEL_GEOMETRY_RGB;
+ case 2:
+ return DWRITE_PIXEL_GEOMETRY_BGR;
+ }
+}
+
+ static int
+ToInt(DWRITE_PIXEL_GEOMETRY value)
+{
+ switch (value)
+ {
+ case DWRITE_PIXEL_GEOMETRY_FLAT:
+ return 0;
+ case DWRITE_PIXEL_GEOMETRY_RGB:
+ return 1;
+ case DWRITE_PIXEL_GEOMETRY_BGR:
+ return 2;
+ default:
+ return -1;
+ }
+}
+
+ static DWRITE_RENDERING_MODE
+ToRenderingMode(int value)
+{
+ switch (value)
+ {
+ default:
+ case 0:
+ return DWRITE_RENDERING_MODE_DEFAULT;
+ case 1:
+ return DWRITE_RENDERING_MODE_ALIASED;
+ case 2:
+ return DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC;
+ case 3:
+ return DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL;
+ case 4:
+ return DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL;
+ case 5:
+ return DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC;
+ case 6:
+ return DWRITE_RENDERING_MODE_OUTLINE;
+ }
+}
+
+ static D2D1_TEXT_ANTIALIAS_MODE
+ToTextAntialiasMode(int value)
+{
+ switch (value)
+ {
+ default:
+ case 0:
+ return D2D1_TEXT_ANTIALIAS_MODE_DEFAULT;
+ case 1:
+ return D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE;
+ case 2:
+ return D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE;
+ case 3:
+ return D2D1_TEXT_ANTIALIAS_MODE_ALIASED;
+ }
+}
+
+ static int
+ToInt(DWRITE_RENDERING_MODE value)
+{
+ switch (value)
+ {
+ case DWRITE_RENDERING_MODE_DEFAULT:
+ return 0;
+ case DWRITE_RENDERING_MODE_ALIASED:
+ return 1;
+ case DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC:
+ return 2;
+ case DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL:
+ return 3;
+ case DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL:
+ return 4;
+ case DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC:
+ return 5;
+ case DWRITE_RENDERING_MODE_OUTLINE:
+ return 6;
+ default:
+ return -1;
+ }
+}
+
+class AdjustedGlyphRun : public DWRITE_GLYPH_RUN
+{
+private:
+ FLOAT mDelta;
+ FLOAT *mAdjustedAdvances;
+
+public:
+ AdjustedGlyphRun(
+ const DWRITE_GLYPH_RUN *glyphRun,
+ FLOAT cellWidth) :
+ DWRITE_GLYPH_RUN(*glyphRun),
+ mDelta(0.0f),
+ mAdjustedAdvances(new FLOAT[glyphRun->glyphCount])
+ {
+ assert(cellWidth != 0.0f);
+ for (UINT32 i = 0; i < glyphRun->glyphCount; ++i)
+ {
+ FLOAT orig = glyphRun->glyphAdvances[i];
+ FLOAT adjusted = adjustToCell(orig, cellWidth);
+ mAdjustedAdvances[i] = adjusted;
+ mDelta += adjusted - orig;
+ }
+ glyphAdvances = mAdjustedAdvances;
+ }
+
+ ~AdjustedGlyphRun(void)
+ {
+ delete[] mAdjustedAdvances;
+ }
+
+ FLOAT getDelta(void) const
+ {
+ return mDelta;
+ }
+
+ static FLOAT adjustToCell(FLOAT value, FLOAT cellWidth)
+ {
+ int cellCount = (int)floor(value / cellWidth + 0.5f);
+ if (cellCount < 1)
+ cellCount = 1;
+ return cellCount * cellWidth;
+ }
+};
+
+class GdiTextRenderer : public IDWriteTextRenderer
+{
+public:
+ GdiTextRenderer(
+ IDWriteBitmapRenderTarget* bitmapRenderTarget,
+ IDWriteRenderingParams* renderingParams) :
+ cRefCount_(0),
+ pRenderTarget_(bitmapRenderTarget),
+ pRenderingParams_(renderingParams)
+ {
+ pRenderTarget_->AddRef();
+ pRenderingParams_->AddRef();
+ AddRef();
+ }
+
+ ~GdiTextRenderer()
+ {
+ SafeRelease(&pRenderTarget_);
+ SafeRelease(&pRenderingParams_);
+ }
+
+ IFACEMETHOD(IsPixelSnappingDisabled)(
+ __maybenull void* clientDrawingContext,
+ __out BOOL* isDisabled)
+ {
+ *isDisabled = FALSE;
+ return S_OK;
+ }
+
+ IFACEMETHOD(GetCurrentTransform)(
+ __maybenull void* clientDrawingContext,
+ __out DWRITE_MATRIX* transform)
+ {
+ //forward the render target's transform
+ pRenderTarget_->GetCurrentTransform(transform);
+ return S_OK;
+ }
+
+ IFACEMETHOD(GetPixelsPerDip)(
+ __maybenull void* clientDrawingContext,
+ __out FLOAT* pixelsPerDip)
+ {
+ *pixelsPerDip = pRenderTarget_->GetPixelsPerDip();
+ return S_OK;
+ }
+
+ IFACEMETHOD(DrawGlyphRun)(
+ __maybenull void* clientDrawingContext,
+ FLOAT baselineOriginX,
+ FLOAT baselineOriginY,
+ DWRITE_MEASURING_MODE measuringMode,
+ __in DWRITE_GLYPH_RUN const* glyphRun,
+ __in DWRITE_GLYPH_RUN_DESCRIPTION const* glyphRunDescription,
+ IUnknown* clientDrawingEffect)
+ {
+ HRESULT hr = S_OK;
+
+ GdiTextRendererContext *context =
+ reinterpret_cast<GdiTextRendererContext*>(clientDrawingContext);
+
+ AdjustedGlyphRun adjustedGlyphRun(glyphRun, context->cellWidth);
+
+ // Pass on the drawing call to the render target to do the real work.
+ RECT dirtyRect = {0};
+
+ hr = pRenderTarget_->DrawGlyphRun(
+ baselineOriginX + context->offsetX,
+ baselineOriginY,
+ measuringMode,
+ &adjustedGlyphRun,
+ pRenderingParams_,
+ context->color,
+ &dirtyRect);
+
+ context->offsetX += adjustedGlyphRun.getDelta();
+
+ return hr;
+ }
+
+ IFACEMETHOD(DrawUnderline)(
+ __maybenull void* clientDrawingContext,
+ FLOAT baselineOriginX,
+ FLOAT baselineOriginY,
+ __in DWRITE_UNDERLINE const* underline,
+ IUnknown* clientDrawingEffect)
+ {
+ return E_NOTIMPL;
+ }
+
+ IFACEMETHOD(DrawStrikethrough)(
+ __maybenull void* clientDrawingContext,
+ FLOAT baselineOriginX,
+ FLOAT baselineOriginY,
+ __in DWRITE_STRIKETHROUGH const* strikethrough,
+ IUnknown* clientDrawingEffect)
+ {
+ return E_NOTIMPL;
+ }
+
+ IFACEMETHOD(DrawInlineObject)(
+ __maybenull void* clientDrawingContext,
+ FLOAT originX,
+ FLOAT originY,
+ IDWriteInlineObject* inlineObject,
+ BOOL isSideways,
+ BOOL isRightToLeft,
+ IUnknown* clientDrawingEffect)
+ {
+ return E_NOTIMPL;
+ }
+
+public:
+ IFACEMETHOD_(unsigned long, AddRef) ()
+ {
+ return InterlockedIncrement(&cRefCount_);
+ }
+
+ IFACEMETHOD_(unsigned long, Release) ()
+ {
+ long newCount = InterlockedDecrement(&cRefCount_);
+
+ if (newCount == 0)
+ {
+ delete this;
+ return 0;
+ }
+ return newCount;
+ }
+
+ IFACEMETHOD(QueryInterface)(
+ IID const& riid,
+ void** ppvObject)
+ {
+ if (__uuidof(IDWriteTextRenderer) == riid)
+ {
+ *ppvObject = this;
+ }
+ else if (__uuidof(IDWritePixelSnapping) == riid)
+ {
+ *ppvObject = this;
+ }
+ else if (__uuidof(IUnknown) == riid)
+ {
+ *ppvObject = this;
+ }
+ else
+ {
+ *ppvObject = NULL;
+ return E_FAIL;
+ }
+
+ return S_OK;
+ }
+
+private:
+ long cRefCount_;
+ IDWriteBitmapRenderTarget* pRenderTarget_;
+ IDWriteRenderingParams* pRenderingParams_;
+};
+
+struct DWriteContext {
+ FLOAT mDpiScaleX;
+ FLOAT mDpiScaleY;
+ bool mDrawing;
+
+ ID2D1Factory *mD2D1Factory;
+
+ ID2D1DCRenderTarget *mRT;
+ ID2D1SolidColorBrush *mBrush;
+
+ IDWriteFactory *mDWriteFactory;
+ IDWriteGdiInterop *mGdiInterop;
+ IDWriteRenderingParams *mRenderingParams;
+ IDWriteTextFormat *mTextFormat;
+
+ HFONT mLastHFont;
+ DWRITE_FONT_WEIGHT mFontWeight;
+ DWRITE_FONT_STYLE mFontStyle;
+
+ D2D1_TEXT_ANTIALIAS_MODE mTextAntialiasMode;
+
+ // METHODS
+
+ DWriteContext();
+
+ virtual ~DWriteContext();
+
+ HRESULT SetLOGFONT(const LOGFONTW &logFont, float fontSize);
+
+ void SetFont(HFONT hFont);
+
+ void SetFont(const LOGFONTW &logFont);
+
+ void DrawText(HDC hdc, const WCHAR* text, int len,
+ int x, int y, int w, int h, int cellWidth, COLORREF color);
+
+ float PixelsToDipsX(int x);
+
+ float PixelsToDipsY(int y);
+
+ void SetRenderingParams(
+ const DWriteRenderingParams *params);
+
+ DWriteRenderingParams *GetRenderingParams(
+ DWriteRenderingParams *params);
+};
+
+DWriteContext::DWriteContext() :
+ mDpiScaleX(1.f),
+ mDpiScaleY(1.f),
+ mDrawing(false),
+ mD2D1Factory(NULL),
+ mRT(NULL),
+ mBrush(NULL),
+ mDWriteFactory(NULL),
+ mGdiInterop(NULL),
+ mRenderingParams(NULL),
+ mTextFormat(NULL),
+ mLastHFont(NULL),
+ mFontWeight(DWRITE_FONT_WEIGHT_NORMAL),
+ mFontStyle(DWRITE_FONT_STYLE_NORMAL),
+ mTextAntialiasMode(D2D1_TEXT_ANTIALIAS_MODE_DEFAULT)
+{
+ HRESULT hr;
+
+ HDC screen = ::GetDC(0);
+ mDpiScaleX = ::GetDeviceCaps(screen, LOGPIXELSX) / 96.0f;
+ mDpiScaleY = ::GetDeviceCaps(screen, LOGPIXELSY) / 96.0f;
+ ::ReleaseDC(0, screen);
+
+ hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED,
+ __uuidof(ID2D1Factory), NULL,
+ reinterpret_cast<void**>(&mD2D1Factory));
+ _RPT2(_CRT_WARN, "D2D1CreateFactory: hr=%p p=%p\n", hr, mD2D1Factory);
+
+ if (SUCCEEDED(hr))
+ {
+ D2D1_RENDER_TARGET_PROPERTIES props = {
+ D2D1_RENDER_TARGET_TYPE_DEFAULT,
+ { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE },
+ 0, 0,
+ D2D1_RENDER_TARGET_USAGE_NONE,
+ D2D1_FEATURE_LEVEL_DEFAULT
+ };
+ hr = mD2D1Factory->CreateDCRenderTarget(&props, &mRT);
+ _RPT2(_CRT_WARN, "CreateDCRenderTarget: hr=%p p=%p\n", hr, mRT);
+ }
+
+ if (SUCCEEDED(hr))
+ {
+ hr = mRT->CreateSolidColorBrush(
+ D2D1::ColorF(D2D1::ColorF::Black),
+ &mBrush);
+ _RPT2(_CRT_WARN, "CreateSolidColorBrush: hr=%p p=%p\n", hr, mBrush);
+ }
+
+ if (SUCCEEDED(hr))
+ {
+ hr = DWriteCreateFactory(
+ DWRITE_FACTORY_TYPE_SHARED,
+ __uuidof(IDWriteFactory),
+ reinterpret_cast<IUnknown**>(&mDWriteFactory));
+ _RPT2(_CRT_WARN, "DWriteCreateFactory: hr=%p p=%p\n", hr,
+ mDWriteFactory);
+ }
+
+ if (SUCCEEDED(hr))
+ {
+ hr = mDWriteFactory->GetGdiInterop(&mGdiInterop);
+ _RPT2(_CRT_WARN, "GetGdiInterop: hr=%p p=%p\n", hr, mGdiInterop);
+ }
+
+ if (SUCCEEDED(hr))
+ {
+ hr = mDWriteFactory->CreateRenderingParams(&mRenderingParams);
+ _RPT2(_CRT_WARN, "CreateRenderingParams: hr=%p p=%p\n", hr,
+ mRenderingParams);
+ }
+}
+
+DWriteContext::~DWriteContext()
+{
+ SafeRelease(&mTextFormat);
+ SafeRelease(&mRenderingParams);
+ SafeRelease(&mGdiInterop);
+ SafeRelease(&mDWriteFactory);
+ SafeRelease(&mBrush);
+ SafeRelease(&mRT);
+ SafeRelease(&mD2D1Factory);
+}
+
+ HRESULT
+DWriteContext::SetLOGFONT(const LOGFONTW &logFont, float fontSize)
+{
+ // Most of this function is copy from: http://msdn.microsoft.com/en-us/library/windows/desktop/dd941783(v=vs.85).aspx
+ HRESULT hr = S_OK;
+
+ IDWriteFont *font = NULL;
+ IDWriteFontFamily *fontFamily = NULL;
+ IDWriteLocalizedStrings *localizedFamilyNames = NULL;
+
+ if (SUCCEEDED(hr))
+ {
+ hr = mGdiInterop->CreateFontFromLOGFONT(&logFont, &font);
+ }
+
+ // Get the font family to which this font belongs.
+ if (SUCCEEDED(hr))
+ {
+ hr = font->GetFontFamily(&fontFamily);
+ }
+
+ // Get the family names. This returns an object that encapsulates one or
+ // more names with the same meaning but in different languages.
+ if (SUCCEEDED(hr))
+ {
+ hr = fontFamily->GetFamilyNames(&localizedFamilyNames);
+ }
+
+ // Get the family name at index zero. If we were going to display the name
+ // we'd want to try to find one that matched the use locale, but for
+ // purposes of creating a text format object any language will do.
+
+ wchar_t familyName[100];
+ if (SUCCEEDED(hr))
+ {
+ hr = localizedFamilyNames->GetString(0, familyName,
+ ARRAYSIZE(familyName));
+ }
+
+ if (SUCCEEDED(hr))
+ {
+ // If no font size was passed in use the lfHeight of the LOGFONT.
+ if (fontSize == 0)
+ {
+ // Convert from pixels to DIPs.
+ fontSize = PixelsToDipsY(logFont.lfHeight);
+ if (fontSize < 0)
+ {
+ // Negative lfHeight represents the size of the em unit.
+ fontSize = -fontSize;
+ }
+ else
+ {
+ // Positive lfHeight represents the cell height (ascent +
+ // descent).
+ DWRITE_FONT_METRICS fontMetrics;
+ font->GetMetrics(&fontMetrics);
+
+ // Convert the cell height (ascent + descent) from design units
+ // to ems.
+ float cellHeight = static_cast<float>(
+ fontMetrics.ascent + fontMetrics.descent)
+ / fontMetrics.designUnitsPerEm;
+
+ // Divide the font size by the cell height to get the font em
+ // size.
+ fontSize /= cellHeight;
+ }
+ }
+ }
+
+ // The text format includes a locale name. Ideally, this would be the
+ // language of the text, which may or may not be the same as the primary
+ // language of the user. However, for our purposes the user locale will do.
+ wchar_t localeName[LOCALE_NAME_MAX_LENGTH];
+ if (SUCCEEDED(hr))
+ {
+ if (GetUserDefaultLocaleName(localeName, LOCALE_NAME_MAX_LENGTH) == 0)
+ hr = HRESULT_FROM_WIN32(GetLastError());
+ }
+
+ if (SUCCEEDED(hr))
+ {
+ // Create the text format object.
+ hr = mDWriteFactory->CreateTextFormat(
+ familyName,
+ NULL, // no custom font collection
+ font->GetWeight(),
+ font->GetStyle(),
+ font->GetStretch(),
+ fontSize,
+ localeName,
+ &mTextFormat);
+ }
+
+ if (SUCCEEDED(hr))
+ {
+ mFontWeight = static_cast<DWRITE_FONT_WEIGHT>(logFont.lfWeight);
+ mFontStyle = logFont.lfItalic ? DWRITE_FONT_STYLE_ITALIC
+ : DWRITE_FONT_STYLE_NORMAL;
+ }
+
+ SafeRelease(&localizedFamilyNames);
+ SafeRelease(&fontFamily);
+ SafeRelease(&font);
+
+ return hr;
+}
+
+ void
+DWriteContext::SetFont(HFONT hFont)
+{
+ if (mLastHFont != hFont)
+ {
+ LOGFONTW lf;
+ if (GetObjectW(hFont, sizeof(lf), &lf))
+ {
+ SetFont(lf);
+ mLastHFont = hFont;
+ }
+ }
+}
+
+ void
+DWriteContext::SetFont(const LOGFONTW &logFont)
+{
+ SafeRelease(&mTextFormat);
+ mLastHFont = NULL;
+
+ HRESULT hr = SetLOGFONT(logFont, 0.f);
+
+ if (SUCCEEDED(hr))
+ hr = mTextFormat->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_LEADING);
+
+ if (SUCCEEDED(hr))
+ hr = mTextFormat->SetParagraphAlignment(
+ DWRITE_PARAGRAPH_ALIGNMENT_CENTER);
+
+ if (SUCCEEDED(hr))
+ hr = mTextFormat->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP);
+}
+
+ void
+DWriteContext::DrawText(HDC hdc, const WCHAR* text, int len,
+ int x, int y, int w, int h, int cellWidth, COLORREF color)
+{
+ HRESULT hr = S_OK;
+ IDWriteBitmapRenderTarget *bmpRT = NULL;
+
+ // Skip when any fonts are not set.
+ if (mTextFormat == NULL)
+ return;
+
+ // Check possibility of zero divided error.
+ if (cellWidth == 0 || mDpiScaleX == 0.0f || mDpiScaleY == 0.0f)
+ return;
+
+ if (SUCCEEDED(hr))
+ hr = mGdiInterop->CreateBitmapRenderTarget(hdc, w, h, &bmpRT);
+
+ if (SUCCEEDED(hr))
+ {
+ IDWriteTextLayout *textLayout = NULL;
+
+ HDC memdc = bmpRT->GetMemoryDC();
+ BitBlt(memdc, 0, 0, w, h, hdc, x, y, SRCCOPY);
+
+ hr = mDWriteFactory->CreateGdiCompatibleTextLayout(
+ text, len, mTextFormat, PixelsToDipsX(w),
+ PixelsToDipsY(h), mDpiScaleX, NULL, TRUE, &textLayout);
+
+ if (SUCCEEDED(hr))
+ {
+ DWRITE_TEXT_RANGE textRange = { 0, len };
+ textLayout->SetFontWeight(mFontWeight, textRange);
+ textLayout->SetFontStyle(mFontStyle, textRange);
+ }
+
+ if (SUCCEEDED(hr))
+ {
+ GdiTextRenderer *renderer = new GdiTextRenderer(bmpRT,
+ mRenderingParams);
+ GdiTextRendererContext data = {
+ color,
+ PixelsToDipsX(cellWidth),
+ 0.0f
+ };
+ textLayout->Draw(&data, renderer, 0, 0);
+ SafeRelease(&renderer);
+ }
+
+ BitBlt(hdc, x, y, w, h, memdc, 0, 0, SRCCOPY);
+
+ SafeRelease(&textLayout);
+ }
+
+ SafeRelease(&bmpRT);
+}
+
+ float
+DWriteContext::PixelsToDipsX(int x)
+{
+ return x / mDpiScaleX;
+}
+
+ float
+DWriteContext::PixelsToDipsY(int y)
+{
+ return y / mDpiScaleY;
+}
+
+ void
+DWriteContext::SetRenderingParams(
+ const DWriteRenderingParams *params)
+{
+ if (mDWriteFactory == NULL)
+ return;
+
+ IDWriteRenderingParams *renderingParams = NULL;
+ D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode =
+ D2D1_TEXT_ANTIALIAS_MODE_DEFAULT;
+ HRESULT hr;
+ if (params != NULL)
+ {
+ hr = mDWriteFactory->CreateCustomRenderingParams(params->gamma,
+ params->enhancedContrast, params->clearTypeLevel,
+ ToPixelGeometry(params->pixelGeometry),
+ ToRenderingMode(params->renderingMode), &renderingParams);
+ textAntialiasMode = ToTextAntialiasMode(params->textAntialiasMode);
+ }
+ else
+ hr = mDWriteFactory->CreateRenderingParams(&renderingParams);
+ if (SUCCEEDED(hr) && renderingParams != NULL)
+ {
+ SafeRelease(&mRenderingParams);
+ mRenderingParams = renderingParams;
+ mTextAntialiasMode = textAntialiasMode;
+ }
+}
+
+ DWriteRenderingParams *
+DWriteContext::GetRenderingParams(
+ DWriteRenderingParams *params)
+{
+ if (params != NULL && mRenderingParams != NULL)
+ {
+ params->gamma = mRenderingParams->GetGamma();
+ params->enhancedContrast = mRenderingParams->GetEnhancedContrast();
+ params->clearTypeLevel = mRenderingParams->GetClearTypeLevel();
+ params->pixelGeometry = ToInt(mRenderingParams->GetPixelGeometry());
+ params->renderingMode = ToInt(mRenderingParams->GetRenderingMode());
+ params->textAntialiasMode = mTextAntialiasMode;
+ }
+ return params;
+}
+
+////////////////////////////////////////////////////////////////////////////
+// PUBLIC C INTERFACES
+
+ void
+DWrite_Init(void)
+{
+#ifdef DYNAMIC_DIRECTX
+ // Load libraries.
+ hD2D1DLL = vimLoadLib(const_cast<char*>("d2d1.dll"));
+ hDWriteDLL = vimLoadLib(const_cast<char*>("dwrite.dll"));
+ if (hD2D1DLL == NULL || hDWriteDLL == NULL)
+ {
+ DWrite_Final();
+ return;
+ }
+ // Get address of procedures.
+ pGetUserDefaultLocaleName = (PGETUSERDEFAULTLOCALENAME)GetProcAddress(
+ GetModuleHandle("kernel32.dll"), "GetUserDefaultLocaleName");
+ pD2D1CreateFactory = (PD2D1CREATEFACTORY)GetProcAddress(hD2D1DLL,
+ "D2D1CreateFactory");
+ pDWriteCreateFactory = (PDWRITECREATEFACTORY)GetProcAddress(hDWriteDLL,
+ "DWriteCreateFactory");
+#endif
+}
+
+ void
+DWrite_Final(void)
+{
+#ifdef DYNAMIC_DIRECTX
+ pGetUserDefaultLocaleName = NULL;
+ pD2D1CreateFactory = NULL;
+ pDWriteCreateFactory = NULL;
+ unload(hDWriteDLL);
+ unload(hD2D1DLL);
+#endif
+}
+
+ DWriteContext *
+DWriteContext_Open(void)
+{
+#ifdef DYNAMIC_DIRECTX
+ if (pGetUserDefaultLocaleName == NULL || pD2D1CreateFactory == NULL
+ || pDWriteCreateFactory == NULL)
+ return NULL;
+#endif
+ return new DWriteContext();
+}
+
+ void
+DWriteContext_BeginDraw(DWriteContext *ctx)
+{
+ if (ctx != NULL && ctx->mRT != NULL)
+ {
+ ctx->mRT->BeginDraw();
+ ctx->mRT->SetTransform(D2D1::IdentityMatrix());
+ ctx->mDrawing = true;
+ }
+}
+
+ void
+DWriteContext_BindDC(DWriteContext *ctx, HDC hdc, RECT *rect)
+{
+ if (ctx != NULL && ctx->mRT != NULL)
+ {
+ ctx->mRT->BindDC(hdc, rect);
+ ctx->mRT->SetTextAntialiasMode(ctx->mTextAntialiasMode);
+ }
+}
+
+ void
+DWriteContext_SetFont(DWriteContext *ctx, HFONT hFont)
+{
+ if (ctx != NULL)
+ {
+ ctx->SetFont(hFont);
+ }
+}
+
+ void
+DWriteContext_DrawText(
+ DWriteContext *ctx,
+ HDC hdc,
+ const WCHAR* text,
+ int len,
+ int x,
+ int y,
+ int w,
+ int h,
+ int cellWidth,
+ COLORREF color)
+{
+ if (ctx != NULL)
+ ctx->DrawText(hdc, text, len, x, y, w, h, cellWidth, color);
+}
+
+ void
+DWriteContext_EndDraw(DWriteContext *ctx)
+{
+ if (ctx != NULL && ctx->mRT != NULL)
+ {
+ ctx->mRT->EndDraw();
+ ctx->mDrawing = false;
+ }
+}
+
+ void
+DWriteContext_Close(DWriteContext *ctx)
+{
+ delete ctx;
+}
+
+ void
+DWriteContext_SetRenderingParams(
+ DWriteContext *ctx,
+ const DWriteRenderingParams *params)
+{
+ if (ctx != NULL)
+ ctx->SetRenderingParams(params);
+}
+
+ DWriteRenderingParams *
+DWriteContext_GetRenderingParams(
+ DWriteContext *ctx,
+ DWriteRenderingParams *params)
+{
+ if (ctx != NULL)
+ return ctx->GetRenderingParams(params);
+ else
+ return NULL;
+}
diff --git a/src/gui_dwrite.h b/src/gui_dwrite.h
new file mode 100644
index 0000000..647f479
--- /dev/null
+++ b/src/gui_dwrite.h
@@ -0,0 +1,85 @@
+/* vi:set ts=8 sts=4 sw=4 noet: */
+/*
+ * Author: MURAOKA Taro <koron.kaoriya@gmail.com>
+ *
+ * Contributors:
+ * - Ken Takata
+ *
+ * Copyright (C) 2013 MURAOKA Taro <koron.kaoriya@gmail.com>
+ * THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE.
+ */
+
+#ifndef GUI_DWRITE_H
+#define GUI_DWRITE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct DWriteContext DWriteContext;
+
+typedef struct DWriteRenderingParams {
+ float gamma;
+ float enhancedContrast;
+ float clearTypeLevel;
+ /*
+ * pixelGeometry:
+ * 0 - DWRITE_PIXEL_GEOMETRY_FLAT
+ * 1 - DWRITE_PIXEL_GEOMETRY_RGB
+ * 2 - DWRITE_PIXEL_GEOMETRY_BGR
+ */
+ int pixelGeometry;
+ /*
+ * renderingMode:
+ * 0 - DWRITE_RENDERING_MODE_DEFAULT
+ * 1 - DWRITE_RENDERING_MODE_ALIASED
+ * 2 - DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC
+ * 3 - DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL
+ * 4 - DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL
+ * 5 - DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC
+ * 6 - DWRITE_RENDERING_MODE_OUTLINE
+ */
+ int renderingMode;
+ /*
+ * antialiasMode:
+ * 0 - D2D1_TEXT_ANTIALIAS_MODE_DEFAULT
+ * 1 - D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE
+ * 2 - D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE
+ * 3 - D2D1_TEXT_ANTIALIAS_MODE_ALIASED
+ */
+ int textAntialiasMode;
+} DWriteRenderingParams;
+
+void DWrite_Init(void);
+void DWrite_Final(void);
+
+DWriteContext *DWriteContext_Open(void);
+void DWriteContext_BeginDraw(DWriteContext *ctx);
+void DWriteContext_BindDC(DWriteContext *ctx, HDC hdc, RECT *rect);
+void DWriteContext_SetFont(DWriteContext *ctx, HFONT hFont);
+void DWriteContext_DrawText(
+ DWriteContext *ctx,
+ HDC hdc,
+ const WCHAR* text,
+ int len,
+ int x,
+ int y,
+ int w,
+ int h,
+ int cellWidth,
+ COLORREF color);
+void DWriteContext_EndDraw(DWriteContext *ctx);
+void DWriteContext_Close(DWriteContext *ctx);
+
+void DWriteContext_SetRenderingParams(
+ DWriteContext *ctx,
+ const DWriteRenderingParams *params);
+
+DWriteRenderingParams *DWriteContext_GetRenderingParams(
+ DWriteContext *ctx,
+ DWriteRenderingParams *params);
+
+#ifdef __cplusplus
+}
+#endif
+#endif/*GUI_DWRITE_H*/
diff --git a/src/gui_w32.c b/src/gui_w32.c
index 2d57fbb..b81a74d 100644
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -25,6 +25,147 @@
#include "vim.h"
+#if defined(FEAT_DIRECTX)
+# include "gui_dwrite.h"
+#endif
+
+#if defined(FEAT_DIRECTX)
+static DWriteContext *s_dwc = NULL;
+static int s_directx_enabled = 0;
+static int s_directx_load_attempted = 0;
+# define IS_ENABLE_DIRECTX() (s_directx_enabled && s_dwc != NULL)
+#endif
+
+#if defined(FEAT_DIRECTX) || defined(PROTO)
+ int
+directx_enabled(void)
+{
+ if (s_dwc != NULL)
+ return 1;
+ else if (s_directx_load_attempted)
+ return 0;
+ /* load DirectX */
+ DWrite_Init();
+ s_directx_load_attempted = 1;
+ s_dwc = DWriteContext_Open();
+ return s_dwc != NULL ? 1 : 0;
+}
+#endif
+
+#if defined(FEAT_RENDER_OPTIONS) || defined(PROTO)
+ int
+gui_mch_set_rendering_options(char_u *s)
+{
+#ifdef FEAT_DIRECTX
+ int retval = FAIL;
+ char_u *p, *q;
+
+ int dx_enable = 0;
+ int dx_flags = 0;
+ float dx_gamma = 0.0f;
+ float dx_contrast = 0.0f;
+ float dx_level = 0.0f;
+ int dx_geom = 0;
+ int dx_renmode = 0;
+ int dx_taamode = 0;
+
+ /* parse string as rendering options. */
+ for (p = s; p != NULL && *p != NUL; )
+ {
+ char_u item[256];
+ char_u name[128];
+ char_u value[128];
+
+ copy_option_part(&p, item, sizeof(item), ",");
+ if (p == NULL)
+ break;
+ q = &item[0];
+ copy_option_part(&q, name, sizeof(name), ":");
+ if (q == NULL)
+ return FAIL;
+ copy_option_part(&q, value, sizeof(value), ":");
+
+ if (STRCMP(name, "type") == 0)
+ {
+ if (STRCMP(value, "directx") == 0)
+ dx_enable = 1;
+ else
+ return FAIL;
+ }
+ else if (STRCMP(name, "gamma") == 0)
+ {
+ dx_flags |= 1 << 0;
+ dx_gamma = (float)atof(value);
+ }
+ else if (STRCMP(name, "contrast") == 0)
+ {
+ dx_flags |= 1 << 1;
+ dx_contrast = (float)atof(value);
+ }
+ else if (STRCMP(name, "level") == 0)
+ {
+ dx_flags |= 1 << 2;
+ dx_level = (float)atof(value);
+ }
+ else if (STRCMP(name, "geom") == 0)
+ {
+ dx_flags |= 1 << 3;
+ dx_geom = atoi(value);
+ if (dx_geom < 0 || dx_geom > 2)
+ return FAIL;
+ }
+ else if (STRCMP(name, "renmode") == 0)
+ {
+ dx_flags |= 1 << 4;
+ dx_renmode = atoi(value);
+ if (dx_renmode < 0 || dx_renmode > 6)
+ return FAIL;
+ }
+ else if (STRCMP(name, "taamode") == 0)
+ {
+ dx_flags |= 1 << 5;
+ dx_taamode = atoi(value);
+ if (dx_taamode < 0 || dx_taamode > 3)
+ return FAIL;
+ }
+ else
+ return FAIL;
+ }
+
+ /* Enable DirectX/DirectWrite */
+ if (dx_enable)
+ {
+ if (!directx_enabled())
+ return FAIL;
+ DWriteContext_SetRenderingParams(s_dwc, NULL);
+ if (dx_flags)
+ {
+ DWriteRenderingParams param;
+ DWriteContext_GetRenderingParams(s_dwc, &param);
+ if (dx_flags & (1 << 0))
+ param.gamma = dx_gamma;
+ if (dx_flags & (1 << 1))
+ param.enhancedContrast = dx_contrast;
+ if (dx_flags & (1 << 2))
+ param.clearTypeLevel = dx_level;
+ if (dx_flags & (1 << 3))
+ param.pixelGeometry = dx_geom;
+ if (dx_flags & (1 << 4))
+ param.renderingMode = dx_renmode;
+ if (dx_flags & (1 << 5))
+ param.textAntialiasMode = dx_taamode;
+ DWriteContext_SetRenderingParams(s_dwc, &param);
+ }
+ }
+ s_directx_enabled = dx_enable;
+
+ return OK;
+#else
+ return FAIL;
+#endif
+}
+#endif
+
/*
* These are new in Windows ME/XP, only defined in recent compilers.
*/
@@ -396,10 +537,6 @@ static void dyn_imm_load(void);
# define pImmSetConversionStatus ImmSetConversionStatus
#endif
-#ifndef ETO_IGNORELANGUAGE
-# define ETO_IGNORELANGUAGE 0x1000
-#endif
-
/* multi monitor support */
typedef struct _MONITORINFOstruct
{
@@ -1527,6 +1664,14 @@ gui_mch_init(void)
if (s_textArea == NULL)
return FAIL;
+ /* Try loading an icon from $RUNTIMEPATH/bitmaps/vim.ico. */
+ {
+ HANDLE hIcon = NULL;
+
+ if (mch_icon_load(&hIcon) == OK && hIcon != NULL)
+ SendMessage(s_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
+ }
+
#ifdef FEAT_MENU
s_menuBar = CreateMenu();
#endif
@@ -1624,6 +1769,11 @@ gui_mch_init(void)
set_vim_var_nr(VV_WINDOWID, HandleToLong(s_hwnd));
#endif
+#ifdef FEAT_RENDER_OPTIONS
+ if (p_rop)
+ (void)gui_mch_set_rendering_options(p_rop);
+#endif
+
theend:
/* Display any pending error messages */
display_errors();
@@ -1695,9 +1845,9 @@ gui_mch_set_shellsize(int width, int height,
/* compute the size of the outside of the window */
win_width = width + (GetSystemMetrics(SM_CXFRAME) +
- GetSystemMetrics(SM_CXPADDEDBORDER)) * 2;
+ GetSystemMetrics(SM_CXPADDEDBORDER)) * 2;
win_height = height + (GetSystemMetrics(SM_CYFRAME) +
- GetSystemMetrics(SM_CXPADDEDBORDER)) * 2
+ GetSystemMetrics(SM_CXPADDEDBORDER)) * 2
+ GetSystemMetrics(SM_CYCAPTION)
#ifdef FEAT_MENU
+ gui_mswin_get_menu_height(FALSE)
@@ -2239,6 +2389,9 @@ gui_mch_draw_string(
#endif
HPEN hpen, old_pen;
int y;
+#ifdef FEAT_DIRECTX
+ int font_is_ttf_or_vector = 0;
+#endif
#ifndef MSWIN16_FASTTEXT
/*
@@ -2326,6 +2479,20 @@ gui_mch_draw_string(
SetTextColor(s_hdc, gui.currFgColor);
SelectFont(s_hdc, gui.currFont);
+#ifdef FEAT_DIRECTX
+ if (IS_ENABLE_DIRECTX())
+ {
+ TEXTMETRIC tm;
+
+ GetTextMetrics(s_hdc, &tm);
+ if (tm.tmPitchAndFamily & (TMPF_TRUETYPE | TMPF_VECTOR))
+ {
+ font_is_ttf_or_vector = 1;
+ DWriteContext_SetFont(s_dwc, (HFONT)gui.currFont);
+ }
+ }
+#endif
+
if (pad_size != Columns || padding == NULL || padding[0] != gui.char_width)
{
vim_free(padding);
@@ -2339,12 +2506,6 @@ gui_mch_draw_string(
padding[i] = gui.char_width;
}
- /* On NT, tell the font renderer not to "help" us with Hebrew and Arabic
- * text. This doesn't work in 9x, so we have to deal with it manually on
- * those systems. */
- if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT)
- foptions |= ETO_IGNORELANGUAGE;
-
/*
* We have to provide the padding argument because italic and bold versions
* of fixed-width fonts are often one pixel or so wider than their normal
@@ -2360,6 +2521,14 @@ gui_mch_draw_string(
if (text[n] >= 0x80)
break;
+#if defined(FEAT_DIRECTX)
+ /* Quick hack to enable DirectWrite. To use DirectWrite (antialias), it is
+ * required that unicode drawing routine, currently. So this forces it
+ * enabled. */
+ if (enc_utf8 && IS_ENABLE_DIRECTX())
+ n = 0; /* Keep n < len, to enter block for unicode. */
+#endif
+
/* Check if the Unicode buffer exists and is big enough. Create it
* with the same length as the multi-byte string, the number of wide
* characters is always equal or smaller. */
@@ -2418,8 +2587,18 @@ gui_mch_draw_string(
i += utfc_ptr2len_len(text + i, len - i);
++clen;
}
- ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row),
- foptions, pcliprect, unicodebuf, wlen, unicodepdy);
+#if defined(FEAT_DIRECTX)
+ if (IS_ENABLE_DIRECTX() && font_is_ttf_or_vector)
+ {
+ /* Add one to "cells" for italics. */
+ DWriteContext_DrawText(s_dwc, s_hdc, unicodebuf, wlen,
+ TEXT_X(col), TEXT_Y(row), FILL_X(cells + 1), FILL_Y(1),
+ gui.char_width, gui.currFgColor);
+ }
+ else
+#endif
+ ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row),
+ foptions, pcliprect, unicodebuf, wlen, unicodepdy);
len = cells; /* used for underlining */
}
else if ((enc_codepage > 0 && (int)GetACP() != enc_codepage) || enc_latin9)
@@ -2462,10 +2641,9 @@ gui_mch_draw_string(
#endif
{
#ifdef FEAT_RIGHTLEFT
- /* If we can't use ETO_IGNORELANGUAGE, we can't tell Windows not to
- * mess up RL text, so we have to draw it character-by-character.
- * Only do this if RL is on, since it's slow. */
- if (curwin->w_p_rl && !(foptions & ETO_IGNORELANGUAGE))
+ /* Windows will mess up RL text, so we have to draw it character by
+ * character. Only do this if RL is on, since it's slow. */
+ if (curwin->w_p_rl)
RevOut(s_hdc, TEXT_X(col), TEXT_Y(row),
foptions, pcliprect, (char *)text, len, padding);
else
@@ -2549,14 +2727,14 @@ gui_mch_get_screen_dimensions(int *screen_w, int *screen_h)
*screen_w = workarea_rect.right - workarea_rect.left
- (GetSystemMetrics(SM_CXFRAME) +
- GetSystemMetrics(SM_CXPADDEDBORDER)) * 2;
+ GetSystemMetrics(SM_CXPADDEDBORDER)) * 2;
/* FIXME: dirty trick: Because the gui_get_base_height() doesn't include
* the menubar for MSwin, we subtract it from the screen height, so that
* the window size can be made to fit on the screen. */
*screen_h = workarea_rect.bottom - workarea_rect.top
- (GetSystemMetrics(SM_CYFRAME) +
- GetSystemMetrics(SM_CXPADDEDBORDER)) * 2
+ GetSystemMetrics(SM_CXPADDEDBORDER)) * 2
- GetSystemMetrics(SM_CYCAPTION)
#ifdef FEAT_MENU
- gui_mswin_get_menu_height(FALSE)
@@ -3188,13 +3366,13 @@ gui_mch_dialog(
GetWindowRect(s_hwnd, &rect);
maxDialogWidth = rect.right - rect.left
- (GetSystemMetrics(SM_CXFRAME) +
- GetSystemMetrics(SM_CXPADDEDBORDER)) * 2;
+ GetSystemMetrics(SM_CXPADDEDBORDER)) * 2;
if (maxDialogWidth < DLG_MIN_MAX_WIDTH)
maxDialogWidth = DLG_MIN_MAX_WIDTH;
maxDialogHeight = rect.bottom - rect.top
- (GetSystemMetrics(SM_CYFRAME) +
- GetSystemMetrics(SM_CXPADDEDBORDER)) * 4
+ GetSystemMetrics(SM_CXPADDEDBORDER)) * 4
- GetSystemMetrics(SM_CYCAPTION);
if (maxDialogHeight < DLG_MIN_MAX_HEIGHT)
maxDialogHeight = DLG_MIN_MAX_HEIGHT;
@@ -3351,11 +3529,11 @@ gui_mch_dialog(
/* Restrict the size to a maximum. Causes a scrollbar to show up. */
if (dlgheight > maxDialogHeight)
{
- msgheight = msgheight - (dlgheight - maxDialogHeight);
- dlgheight = maxDialogHeight;
- scroll_flag = WS_VSCROLL;
- /* Make sure scrollbar doesn't appear in the middle of the dialog */
- messageWidth = dlgwidth - DLG_ICON_WIDTH - 3 * dlgPaddingX;
+ msgheight = msgheight - (dlgheight - maxDialogHeight);
+ dlgheight = maxDialogHeight;
+ scroll_flag = WS_VSCROLL;
+ /* Make sure scrollbar doesn't appear in the middle of the dialog */
+ messageWidth = dlgwidth - DLG_ICON_WIDTH - 3 * dlgPaddingX;
}
add_word(PixelToDialogY(dlgheight));
diff --git a/src/gui_w48.c b/src/gui_w48.c
index 89b6090..cd7fdde 100644
--- a/src/gui_w48.c
+++ b/src/gui_w48.c
@@ -614,6 +614,8 @@ _OnChar(
char_u string[40];
int len = 0;
+ dead_key = 0;
+
len = char_to_string(ch, string, 40, FALSE);
if (len == 1 && string[0] == Ctrl_C && ctrl_c_interrupts)
{
@@ -1788,24 +1790,21 @@ process_message(void)
if (msg.message == WM_KEYDOWN || msg.message == WM_SYSKEYDOWN)
{
vk = (int) msg.wParam;
- /* handle key after dead key, but ignore shift, alt and control */
- if (dead_key && vk != VK_SHIFT && vk != VK_MENU && vk != VK_CONTROL)
+ /*
+ * If a dead key was pressed and the user presses VK_SPACE, VK_BACK, or
+ * VK_ESCAPE it means that he actually wants to deal with the dead char
+ * now, so do nothing special and let Windows handle it.
+ *
+ * Note that VK_SPACE combines with the dead_key's character and only
+ * one WM_CHAR will be generated by TranslateMessage(), in the two
+ * other cases two WM_CHAR will be generated: the dead char and VK_BACK
+ * or VK_ESCAPE. That is most likely what the user expects.
+ */
+ if (dead_key && (vk == VK_SPACE || vk == VK_BACK || vk == VK_ESCAPE))
{
dead_key = 0;
- /* handle non-alphabetic keys (ones that hopefully cannot generate
- * umlaut-characters), unless when control is down */
- if (vk < 'A' || vk > 'Z' || (GetKeyState(VK_CONTROL) & 0x8000))
- {
- MSG dm;
-
- dm.message = msg.message;
- dm.hwnd = msg.hwnd;
- dm.wParam = VK_SPACE;
- MyTranslateMessage(&dm); /* generate dead character */
- if (vk != VK_SPACE) /* and send current character once more */
- PostMessage(msg.hwnd, msg.message, msg.wParam, msg.lParam);
- return;
- }
+ MyTranslateMessage(&msg);
+ return;
}
/* Check for CTRL-BREAK */
@@ -2785,6 +2784,10 @@ _OnPaint(
out_flush(); /* make sure all output has been processed */
(void)BeginPaint(hwnd, &ps);
+#if defined(FEAT_DIRECTX)
+ if (IS_ENABLE_DIRECTX())
+ DWriteContext_BeginDraw(s_dwc);
+#endif
#ifdef FEAT_MBYTE
/* prevent multi-byte characters from misprinting on an invalid
@@ -2800,9 +2803,20 @@ _OnPaint(
#endif
if (!IsRectEmpty(&ps.rcPaint))
+ {
+#if defined(FEAT_DIRECTX)
+ if (IS_ENABLE_DIRECTX())
+ DWriteContext_BindDC(s_dwc, s_hdc, &ps.rcPaint);
+#endif
gui_redraw(ps.rcPaint.left, ps.rcPaint.top,
ps.rcPaint.right - ps.rcPaint.left + 1,
ps.rcPaint.bottom - ps.rcPaint.top + 1);
+ }
+
+#if defined(FEAT_DIRECTX)
+ if (IS_ENABLE_DIRECTX())
+ DWriteContext_EndDraw(s_dwc);
+#endif
EndPaint(hwnd, &ps);
}
}
@@ -3043,6 +3057,12 @@ gui_mch_insert_lines(
void
gui_mch_exit(int rc)
{
+#if defined(FEAT_DIRECTX)
+ DWriteContext_Close(s_dwc);
+ DWrite_Final();
+ s_dwc = NULL;
+#endif
+
ReleaseDC(s_textArea, s_hdc);
DeleteObject(s_brush);
diff --git a/src/hardcopy.c b/src/hardcopy.c
index 1df2fda..1e795e6 100644
--- a/src/hardcopy.c
+++ b/src/hardcopy.c
@@ -2960,12 +2960,12 @@ mch_print_begin(psettings)
if (!prt_find_resource("prolog", res_prolog))
{
EMSG(_("E456: Can't find PostScript resource file \"prolog.ps\""));
- return FALSE;
+ goto theend;
}
if (!prt_open_resource(res_prolog))
- return FALSE;
+ goto theend;
if (!prt_check_resource(res_prolog, PRT_PROLOG_VERSION))
- return FALSE;
+ goto theend;
#ifdef FEAT_MBYTE
if (prt_out_mbyte)
{
@@ -2973,12 +2973,12 @@ mch_print_begin(psettings)
if (!prt_find_resource("cidfont", res_cidfont))
{
EMSG(_("E456: Can't find PostScript resource file \"cidfont.ps\""));
- return FALSE;
+ goto theend;
}
if (!prt_open_resource(res_cidfont))
- return FALSE;
+ goto theend;
if (!prt_check_resource(res_cidfont, PRT_CID_PROLOG_VERSION))
- return FALSE;
+ goto theend;
}
#endif
@@ -3012,12 +3012,12 @@ mch_print_begin(psettings)
{
EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""),
p_encoding);
- return FALSE;
+ goto theend;
}
}
}
if (!prt_open_resource(res_encoding))
- return FALSE;
+ goto theend;
/* For the moment there are no checks on encoding resource files to
* perform */
#ifdef FEAT_MBYTE
@@ -3034,10 +3034,10 @@ mch_print_begin(psettings)
{
EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""),
prt_ascii_encoding);
- return FALSE;
+ goto theend;
}
if (!prt_open_resource(res_encoding))
- return FALSE;
+ goto theend;
/* For the moment there are no checks on encoding resource files to
* perform */
}
@@ -3050,7 +3050,7 @@ mch_print_begin(psettings)
{
EMSG2(_("E620: Unable to convert to print encoding \"%s\""),
p_encoding);
- return FALSE;
+ goto theend;
}
prt_do_conv = TRUE;
}
@@ -3063,10 +3063,10 @@ mch_print_begin(psettings)
{
EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""),
prt_cmap);
- return FALSE;
+ goto theend;
}
if (!prt_open_resource(res_cmap))
- return FALSE;
+ goto theend;
}
#endif
@@ -3140,15 +3140,15 @@ mch_print_begin(psettings)
/* Add required procsets - NOTE: order is important! */
if (!prt_add_resource(res_prolog))
- return FALSE;
+ goto theend;
#ifdef FEAT_MBYTE
if (prt_out_mbyte)
{
/* Add CID font procset, and any user supplied CMap */
if (!prt_add_resource(res_cidfont))
- return FALSE;
+ goto theend;
if (prt_custom_cmap && !prt_add_resource(res_cmap))
- return FALSE;
+ goto theend;
}
#endif
@@ -3158,7 +3158,7 @@ mch_print_begin(psettings)
/* There will be only one Roman font encoding to be included in the PS
* file. */
if (!prt_add_resource(res_encoding))
- return FALSE;
+ goto theend;
prt_dsc_noarg("EndProlog");
diff --git a/src/if_py_both.h b/src/if_py_both.h
index bf5ea4c..5044afb 100644
--- a/src/if_py_both.h
+++ b/src/if_py_both.h
@@ -4196,7 +4196,9 @@ SetBufferLineList(
break;
}
}
- if (buf == curbuf)
+ if (buf == curbuf && (save_curwin != NULL || save_curbuf == NULL))
+ /* Using an existing window for the buffer, adjust the cursor
+ * position. */
py_fix_cursor((linenr_T)lo, (linenr_T)hi, (linenr_T)-n);
if (save_curbuf == NULL)
/* Only adjust marks if we managed to switch to a window that
diff --git a/src/if_ruby.c b/src/if_ruby.c
index 4fc093a..f6b8721 100644
--- a/src/if_ruby.c
+++ b/src/if_ruby.c
@@ -96,11 +96,11 @@
# define rb_num2int rb_num2int_stub
#endif
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 21
+#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 21
/* Ruby 2.1 adds new GC called RGenGC and RARRAY_PTR uses
* rb_gc_writebarrier_unprotect_promoted if USE_RGENGC */
-# define rb_gc_writebarrier_unprotect_promoted rb_gc_writebarrier_unprotect_promoted_stub
-# endif
+# define rb_gc_writebarrier_unprotect_promoted rb_gc_writebarrier_unprotect_promoted_stub
+#endif
#ifdef FEAT_GUI_MACVIM
# include <Ruby/ruby.h>
@@ -426,10 +426,11 @@ VALUE rb_num2ulong(VALUE x)
# endif
# endif
-# if defined(USE_RGENGC) && USE_RGENGC
+ /* Do not generate a prototype here, VALUE isn't always defined. */
+# if defined(USE_RGENGC) && USE_RGENGC && !defined(PROTO)
void rb_gc_writebarrier_unprotect_promoted_stub(VALUE obj)
{
- return dll_rb_gc_writebarrier_unprotect_promoted(obj);
+ dll_rb_gc_writebarrier_unprotect_promoted(obj);
}
# endif
@@ -770,7 +771,8 @@ static int ensure_ruby_initialized(void)
/* suggested by Ariya Mizutani */
int argc = 1;
char *argv[] = {"gvim.exe"};
- NtInitialize(&argc, &argv);
+ char **argvp = argv;
+ NtInitialize(&argc, &argvp);
#endif
{
#if defined(RUBY19_OR_LATER) || defined(RUBY_INIT_STACK)
diff --git a/src/macros.h b/src/macros.h
index 2706a02..01207d9 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -128,13 +128,18 @@
* Adjust chars in a language according to 'langmap' option.
* NOTE that there is no noticeable overhead if 'langmap' is not set.
* When set the overhead for characters < 256 is small.
- * Don't apply 'langmap' if the character comes from the Stuff buffer.
+ * Don't apply 'langmap' if the character comes from the Stuff buffer or from
+ * a mapping and the langnoremap option was set.
* The do-while is just to ignore a ';' after the macro.
*/
# ifdef FEAT_MBYTE
# define LANGMAP_ADJUST(c, condition) \
do { \
- if (*p_langmap && (condition) && !KeyStuffed && (c) >= 0) \
+ if (*p_langmap \
+ && (condition) \
+ && (!p_lnr || (p_lnr && typebuf_maplen() == 0)) \
+ && !KeyStuffed \
+ && (c) >= 0) \
{ \
if ((c) < 256) \
c = langmap_mapchar[c]; \
@@ -145,7 +150,11 @@
# else
# define LANGMAP_ADJUST(c, condition) \
do { \
- if (*p_langmap && (condition) && !KeyStuffed && (c) >= 0 && (c) < 256) \
+ if (*p_langmap \
+ && (condition) \
+ && (!p_lnr || (p_lnr && typebuf_maplen() == 0)) \
+ && !KeyStuffed \
+ && (c) >= 0 && (c) < 256) \
c = langmap_mapchar[c]; \
} while (0)
# endif
diff --git a/src/main.c b/src/main.c
index 5f458ba..88be21c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -185,6 +185,14 @@ main
*/
mch_early_init();
+#if defined(WIN32) && defined(FEAT_MBYTE)
+ /*
+ * MingW expands command line arguments, which confuses our code to
+ * convert when 'encoding' changes. Get the unexpanded arguments.
+ */
+ argc = get_cmd_argsW(&argv);
+#endif
+
/* Many variables are in "params" so that we can pass them to invoked
* functions without a lot of arguments. "argc" and "argv" are also
* copied, so that they can be changed. */
@@ -862,8 +870,8 @@ vim_main2(int argc UNUSED, char **argv UNUSED)
#ifdef FEAT_CRYPT
if (params.ask_for_key)
{
- (void)blowfish_self_test();
- (void)get_crypt_key(TRUE, TRUE);
+ crypt_check_current_method();
+ (void)crypt_get_key(TRUE, TRUE);
TIME_MSG("getting crypt key");
}
#endif
@@ -994,8 +1002,17 @@ vim_main2(int argc UNUSED, char **argv UNUSED)
if (p_im)
need_start_insertmode = TRUE;
+#ifdef FEAT_CLIPBOARD
+ if (clip_unnamed)
+ /* do not overwrite system clipboard while starting up */
+ clip_did_set_selection = -1;
+#endif
#ifdef FEAT_AUTOCMD
apply_autocmds(EVENT_VIMENTER, NULL, NULL, FALSE, curbuf);
+# ifdef FEAT_CLIPBOARD
+ if (clip_did_set_selection < 0)
+ clip_did_set_selection = TRUE;
+# endif
TIME_MSG("VimEnter autocommands");
#endif
@@ -1305,9 +1322,9 @@ main_loop(cmdwin, noexmode)
char_u *p;
/* msg_attr_keep() will set keep_msg to NULL, must free the
- * string here. */
+ * string here. Don't reset keep_msg, msg_attr_keep() uses it
+ * to check for duplicates. */
p = keep_msg;
- keep_msg = NULL;
msg_attr(p, keep_msg_attr);
vim_free(p);
}
@@ -1570,6 +1587,9 @@ getout(exitval)
if (garbage_collect_at_exit)
garbage_collect();
#endif
+#if defined(WIN32) && defined(FEAT_MBYTE)
+ free_cmd_argsW();
+#endif
mch_exit(exitval);
}
diff --git a/src/mbyte.c b/src/mbyte.c
index 9e05f0d..1320db7 100644
--- a/src/mbyte.c
+++ b/src/mbyte.c
@@ -405,6 +405,7 @@ enc_alias_table[] =
{"unix-jis", IDX_EUC_JP},
{"ujis", IDX_EUC_JP},
{"shift-jis", IDX_SJIS},
+ {"pck", IDX_SJIS}, /* Sun: PCK */
{"euckr", IDX_EUC_KR},
{"5601", IDX_EUC_KR}, /* Sun: KS C 5601 */
{"euccn", IDX_EUC_CN},
@@ -2537,6 +2538,7 @@ utf_class(c)
{0x2900, 0x2998, 1}, /* arrows, brackets, etc. */
{0x29d8, 0x29db, 1},
{0x29fc, 0x29fd, 1},
+ {0x2e00, 0x2e7f, 1}, /* supplemental punctuation */
{0x3000, 0x3000, 0}, /* ideographic space */
{0x3001, 0x3020, 1}, /* ideographic punctuation */
{0x3030, 0x3030, 1},
diff --git a/src/memline.c b/src/memline.c
index fb438d2..7adb2dc 100644
--- a/src/memline.c
+++ b/src/memline.c
@@ -63,6 +63,15 @@ typedef struct pointer_entry PTR_EN; /* block/line-count pair */
#define BLOCK0_ID1 '0' /* block 0 id 1 */
#define BLOCK0_ID1_C0 'c' /* block 0 id 1 'cm' 0 */
#define BLOCK0_ID1_C1 'C' /* block 0 id 1 'cm' 1 */
+#define BLOCK0_ID1_C2 'd' /* block 0 id 1 'cm' 2 */
+
+#if defined(FEAT_CRYPT)
+static int id1_codes[] = {
+ BLOCK0_ID1_C0, /* CRYPT_M_ZIP */
+ BLOCK0_ID1_C1, /* CRYPT_M_BF */
+ BLOCK0_ID1_C2, /* CRYPT_M_BF2 */
+};
+#endif
/*
* pointer to a block, used in a pointer block
@@ -151,7 +160,7 @@ struct data_block
struct block0
{
char_u b0_id[2]; /* id for block 0: BLOCK0_ID0 and BLOCK0_ID1,
- * BLOCK0_ID1_C0, BLOCK0_ID1_C1 */
+ * BLOCK0_ID1_C0, BLOCK0_ID1_C1, etc. */
char_u b0_version[10]; /* Vim version string */
char_u b0_page_size[4];/* number of bytes per page */
char_u b0_mtime[4]; /* last modification time of file */
@@ -226,6 +235,7 @@ typedef enum {
} upd_block0_T;
#ifdef FEAT_CRYPT
+static void ml_set_mfp_crypt __ARGS((buf_T *buf));
static void ml_set_b0_crypt __ARGS((buf_T *buf, ZERO_BL *b0p));
#endif
static int ml_check_b0_id __ARGS((ZERO_BL *b0p));
@@ -256,7 +266,7 @@ static long char_to_long __ARGS((char_u *));
static char_u *make_percent_swname __ARGS((char_u *dir, char_u *name));
#endif
#ifdef FEAT_CRYPT
-static void ml_crypt_prepare __ARGS((memfile_T *mfp, off_t offset, int reading));
+static cryptstate_T *ml_crypt_prepare __ARGS((memfile_T *mfp, off_t offset, int reading));
#endif
#ifdef FEAT_BYTEOFF
static void ml_updatechunk __ARGS((buf_T *buf, long line, long len, int updtype));
@@ -359,8 +369,7 @@ ml_open(buf)
b0p->b0_hname[B0_HNAME_SIZE - 1] = NUL;
long_to_char(mch_get_pid(), b0p->b0_pid);
#ifdef FEAT_CRYPT
- if (*buf->b_p_key != NUL)
- ml_set_b0_crypt(buf, b0p);
+ ml_set_b0_crypt(buf, b0p);
#endif
}
@@ -425,6 +434,25 @@ error:
#if defined(FEAT_CRYPT) || defined(PROTO)
/*
+ * Prepare encryption for "buf" for the current key and method.
+ */
+ static void
+ml_set_mfp_crypt(buf)
+ buf_T *buf;
+{
+ if (*buf->b_p_key != NUL)
+ {
+ int method_nr = crypt_get_method_nr(buf);
+
+ if (method_nr > CRYPT_M_ZIP)
+ {
+ /* Generate a seed and store it in the memfile. */
+ sha2_seed(buf->b_ml.ml_mfp->mf_seed, MF_SEED_LEN, NULL, 0);
+ }
+ }
+}
+
+/*
* Prepare encryption for "buf" with block 0 "b0p".
*/
static void
@@ -436,11 +464,11 @@ ml_set_b0_crypt(buf, b0p)
b0p->b0_id[1] = BLOCK0_ID1;
else
{
- if (get_crypt_method(buf) == 0)
- b0p->b0_id[1] = BLOCK0_ID1_C0;
- else
+ int method_nr = crypt_get_method_nr(buf);
+
+ b0p->b0_id[1] = id1_codes[method_nr];
+ if (method_nr > CRYPT_M_ZIP)
{
- b0p->b0_id[1] = BLOCK0_ID1_C1;
/* Generate a seed and store it in block 0 and in the memfile. */
sha2_seed(&b0p->b0_seed, MF_SEED_LEN, NULL, 0);
mch_memmove(buf->b_ml.ml_mfp->mf_seed, &b0p->b0_seed, MF_SEED_LEN);
@@ -887,7 +915,8 @@ ml_check_b0_id(b0p)
if (b0p->b0_id[0] != BLOCK0_ID0
|| (b0p->b0_id[1] != BLOCK0_ID1
&& b0p->b0_id[1] != BLOCK0_ID1_C0
- && b0p->b0_id[1] != BLOCK0_ID1_C1)
+ && b0p->b0_id[1] != BLOCK0_ID1_C1
+ && b0p->b0_id[1] != BLOCK0_ID1_C2)
)
return FAIL;
return OK;
@@ -906,8 +935,19 @@ ml_upd_block0(buf, what)
ZERO_BL *b0p;
mfp = buf->b_ml.ml_mfp;
- if (mfp == NULL || (hp = mf_get(mfp, (blocknr_T)0, 1)) == NULL)
+ if (mfp == NULL)
+ return;
+ hp = mf_get(mfp, (blocknr_T)0, 1);
+ if (hp == NULL)
+ {
+#ifdef FEAT_CRYPT
+ /* Possibly update the seed in the memfile before there is a block0. */
+ if (what == UB_CRYPT)
+ ml_set_mfp_crypt(buf);
+#endif
return;
+ }
+
b0p = (ZERO_BL *)(hp->bh_data);
if (ml_check_b0_id(b0p) == FAIL)
EMSG(_("E304: ml_upd_block0(): Didn't get block 0??"));
@@ -1255,14 +1295,12 @@ ml_recover()
}
#ifdef FEAT_CRYPT
- if (b0p->b0_id[1] == BLOCK0_ID1_C0)
- b0_cm = 0;
- else if (b0p->b0_id[1] == BLOCK0_ID1_C1)
- {
- b0_cm = 1;
+ for (i = 0; i < (int)(sizeof(id1_codes) / sizeof(int)); ++i)
+ if (id1_codes[i] == b0p->b0_id[1])
+ b0_cm = i;
+ if (b0_cm > 0)
mch_memmove(mfp->mf_seed, &b0p->b0_seed, MF_SEED_LEN);
- }
- set_crypt_method(buf, b0_cm);
+ crypt_set_cm_option(buf, b0_cm < 0 ? 0 : b0_cm);
#else
if (b0p->b0_id[1] != BLOCK0_ID1)
{
@@ -1389,7 +1427,7 @@ ml_recover()
}
else
smsg((char_u *)_(need_key_msg), fname_used);
- buf->b_p_key = get_crypt_key(FALSE, FALSE);
+ buf->b_p_key = crypt_get_key(FALSE, FALSE);
if (buf->b_p_key == NULL)
buf->b_p_key = curbuf->b_p_key;
else if (*buf->b_p_key == NUL)
@@ -4816,6 +4854,7 @@ ml_encrypt_data(mfp, data, offset, size)
char_u *text_start;
char_u *new_data;
int text_len;
+ cryptstate_T *state;
if (dp->db_id != DATA_ID)
return data;
@@ -4831,10 +4870,9 @@ ml_encrypt_data(mfp, data, offset, size)
mch_memmove(new_data, dp, head_end - (char_u *)dp);
/* Encrypt the text. */
- crypt_push_state();
- ml_crypt_prepare(mfp, offset, FALSE);
- crypt_encode(text_start, text_len, new_data + dp->db_txt_start);
- crypt_pop_state();
+ state = ml_crypt_prepare(mfp, offset, FALSE);
+ crypt_encode(state, text_start, text_len, new_data + dp->db_txt_start);
+ crypt_free_state(state);
/* Clear the gap. */
if (head_end < text_start)
@@ -4857,6 +4895,7 @@ ml_decrypt_data(mfp, data, offset, size)
char_u *head_end;
char_u *text_start;
int text_len;
+ cryptstate_T *state;
if (dp->db_id == DATA_ID)
{
@@ -4869,17 +4908,17 @@ ml_decrypt_data(mfp, data, offset, size)
return; /* data was messed up */
/* Decrypt the text in place. */
- crypt_push_state();
- ml_crypt_prepare(mfp, offset, TRUE);
- crypt_decode(text_start, text_len);
- crypt_pop_state();
+ state = ml_crypt_prepare(mfp, offset, TRUE);
+ crypt_decode_inplace(state, text_start, text_len);
+ crypt_free_state(state);
}
}
/*
* Prepare for encryption/decryption, using the key, seed and offset.
+ * Return an allocated cryptstate_T *.
*/
- static void
+ static cryptstate_T *
ml_crypt_prepare(mfp, offset, reading)
memfile_T *mfp;
off_t offset;
@@ -4887,38 +4926,37 @@ ml_crypt_prepare(mfp, offset, reading)
{
buf_T *buf = mfp->mf_buffer;
char_u salt[50];
- int method;
+ int method_nr;
char_u *key;
char_u *seed;
if (reading && mfp->mf_old_key != NULL)
{
/* Reading back blocks with the previous key/method/seed. */
- method = mfp->mf_old_cm;
+ method_nr = mfp->mf_old_cm;
key = mfp->mf_old_key;
seed = mfp->mf_old_seed;
}
else
{
- method = get_crypt_method(buf);
+ method_nr = crypt_get_method_nr(buf);
key = buf->b_p_key;
seed = mfp->mf_seed;
}
- use_crypt_method = method; /* select pkzip or blowfish */
- if (method == 0)
+ if (method_nr == CRYPT_M_ZIP)
{
+ /* For PKzip: Append the offset to the key, so that we use a different
+ * key for every block. */
vim_snprintf((char *)salt, sizeof(salt), "%s%ld", key, (long)offset);
- crypt_init_keys(salt);
- }
- else
- {
- /* Using blowfish, add salt and seed. We use the byte offset of the
- * block for the salt. */
- vim_snprintf((char *)salt, sizeof(salt), "%ld", (long)offset);
- bf_key_init(key, salt, (int)STRLEN(salt));
- bf_cfb_init(seed, MF_SEED_LEN);
+ return crypt_create(method_nr, salt, NULL, 0, NULL, 0);
}
+
+ /* Using blowfish or better: add salt and seed. We use the byte offset
+ * of the block for the salt. */
+ vim_snprintf((char *)salt, sizeof(salt), "%ld", (long)offset);
+ return crypt_create(method_nr, key, salt, (int)STRLEN(salt),
+ seed, MF_SEED_LEN);
}
#endif
diff --git a/src/misc1.c b/src/misc1.c
index e24d3b2..b9980fb 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -78,7 +78,8 @@ get_indent_str(ptr, ts, list)
if (!list || lcs_tab1) /* count a tab for what it is worth */
count += ts - (count % ts);
else
- /* in list mode, when tab is not set, count screen char width for Tab: ^I */
+ /* In list mode, when tab is not set, count screen char width
+ * for Tab, displays: ^I */
count += ptr2cells(ptr);
}
else if (*ptr == ' ')
@@ -5509,7 +5510,7 @@ cin_has_js_key(text)
char_u *text;
{
char_u *s = skipwhite(text);
- int quote = 0;
+ int quote = -1;
if (*s == '\'' || *s == '"')
{
@@ -7001,6 +7002,7 @@ get_c_indent()
char_u *linecopy;
pos_T *trypos;
pos_T *tryposBrace = NULL;
+ pos_T tryposBraceCopy;
pos_T our_paren_pos;
char_u *start;
int start_brace;
@@ -7538,7 +7540,11 @@ get_c_indent()
/*
* We are inside braces, there is a { before this line at the position
* stored in tryposBrace.
+ * Make a copy of tryposBrace, it may point to pos_copy inside
+ * find_start_brace(), which may be changed somewhere.
*/
+ tryposBraceCopy = *tryposBrace;
+ tryposBrace = &tryposBraceCopy;
trypos = tryposBrace;
ourscope = trypos->lnum;
start = ml_get(ourscope);
@@ -10768,7 +10774,7 @@ gen_expand_wildcards(num_pat, pat, num_file, file, flags)
vim_free(p);
ga_clear_strings(&ga);
i = mch_expand_wildcards(num_pat, pat, num_file, file,
- flags);
+ flags|EW_KEEPDOLLAR);
recursive = FALSE;
return i;
}
diff --git a/src/misc2.c b/src/misc2.c
index dbbb61b..e27928e 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -1040,7 +1040,8 @@ free_all_mem()
entered = TRUE;
# ifdef FEAT_AUTOCMD
- block_autocmds(); /* don't want to trigger autocommands here */
+ /* Don't want to trigger autocommands from here on. */
+ block_autocmds();
# endif
# ifdef FEAT_WINDOWS
@@ -2470,6 +2471,7 @@ static struct key_name_entry
{K_SNR, (char_u *)"SNR"},
#endif
{K_PLUG, (char_u *)"Plug"},
+ {K_CURSORHOLD, (char_u *)"CursorHold"},
#ifdef FEAT_GUI_MACVIM
{K_SWIPELEFT, (char_u *)"SwipeLeft"},
{K_SWIPERIGHT, (char_u *)"SwipeRight"},
@@ -3809,322 +3811,6 @@ update_mouseshape(shape_idx)
#endif /* CURSOR_SHAPE */
-#ifdef FEAT_CRYPT
-/*
- * Optional encryption support.
- * Mohsin Ahmed, mosh@sasi.com, 98-09-24
- * Based on zip/crypt sources.
- *
- * NOTE FOR USA: Since 2000 exporting this code from the USA is allowed to
- * most countries. There are a few exceptions, but that still should not be a
- * problem since this code was originally created in Europe and India.
- *
- * Blowfish addition originally made by Mohsin Ahmed,
- * http://www.cs.albany.edu/~mosh 2010-03-14
- * Based on blowfish by Bruce Schneier (http://www.schneier.com/blowfish.html)
- * and sha256 by Christophe Devine.
- */
-
-/* from zip.h */
-
-typedef unsigned short ush; /* unsigned 16-bit value */
-typedef unsigned long ulg; /* unsigned 32-bit value */
-
-static void make_crc_tab __ARGS((void));
-
-static ulg crc_32_tab[256];
-
-/*
- * Fill the CRC table.
- */
- static void
-make_crc_tab()
-{
- ulg s,t,v;
- static int done = FALSE;
-
- if (done)
- return;
- for (t = 0; t < 256; t++)
- {
- v = t;
- for (s = 0; s < 8; s++)
- v = (v >> 1) ^ ((v & 1) * (ulg)0xedb88320L);
- crc_32_tab[t] = v;
- }
- done = TRUE;
-}
-
-#define CRC32(c, b) (crc_32_tab[((int)(c) ^ (b)) & 0xff] ^ ((c) >> 8))
-
-static ulg keys[3]; /* keys defining the pseudo-random sequence */
-
-/*
- * Return the next byte in the pseudo-random sequence.
- */
-#define DECRYPT_BYTE_ZIP(t) { \
- ush temp; \
- \
- temp = (ush)keys[2] | 2; \
- t = (int)(((unsigned)(temp * (temp ^ 1U)) >> 8) & 0xff); \
-}
-
-/*
- * Update the encryption keys with the next byte of plain text.
- */
-#define UPDATE_KEYS_ZIP(c) { \
- keys[0] = CRC32(keys[0], (c)); \
- keys[1] += keys[0] & 0xff; \
- keys[1] = keys[1] * 134775813L + 1; \
- keys[2] = CRC32(keys[2], (int)(keys[1] >> 24)); \
-}
-
-static int crypt_busy = 0;
-static ulg saved_keys[3];
-static int saved_crypt_method;
-
-/*
- * Return int value for crypt method string:
- * 0 for "zip", the old method. Also for any non-valid value.
- * 1 for "blowfish".
- */
- int
-crypt_method_from_string(s)
- char_u *s;
-{
- return *s == 'b' ? 1 : 0;
-}
-
-/*
- * Get the crypt method for buffer "buf" as a number.
- */
- int
-get_crypt_method(buf)
- buf_T *buf;
-{
- return crypt_method_from_string(*buf->b_p_cm == NUL ? p_cm : buf->b_p_cm);
-}
-
-/*
- * Set the crypt method for buffer "buf" to "method" using the int value as
- * returned by crypt_method_from_string().
- */
- void
-set_crypt_method(buf, method)
- buf_T *buf;
- int method;
-{
- free_string_option(buf->b_p_cm);
- buf->b_p_cm = vim_strsave((char_u *)(method == 0 ? "zip" : "blowfish"));
-}
-
-/*
- * Prepare for initializing encryption. If already doing encryption then save
- * the state.
- * Must always be called symmetrically with crypt_pop_state().
- */
- void
-crypt_push_state()
-{
- if (crypt_busy == 1)
- {
- /* save the state */
- if (use_crypt_method == 0)
- {
- saved_keys[0] = keys[0];
- saved_keys[1] = keys[1];
- saved_keys[2] = keys[2];
- }
- else
- bf_crypt_save();
- saved_crypt_method = use_crypt_method;
- }
- else if (crypt_busy > 1)
- EMSG2(_(e_intern2), "crypt_push_state()");
- ++crypt_busy;
-}
-
-/*
- * End encryption. If doing encryption before crypt_push_state() then restore
- * the saved state.
- * Must always be called symmetrically with crypt_push_state().
- */
- void
-crypt_pop_state()
-{
- --crypt_busy;
- if (crypt_busy == 1)
- {
- use_crypt_method = saved_crypt_method;
- if (use_crypt_method == 0)
- {
- keys[0] = saved_keys[0];
- keys[1] = saved_keys[1];
- keys[2] = saved_keys[2];
- }
- else
- bf_crypt_restore();
- }
-}
-
-/*
- * Encrypt "from[len]" into "to[len]".
- * "from" and "to" can be equal to encrypt in place.
- */
- void
-crypt_encode(from, len, to)
- char_u *from;
- size_t len;
- char_u *to;
-{
- size_t i;
- int ztemp, t;
-
- if (use_crypt_method == 0)
- for (i = 0; i < len; ++i)
- {
- ztemp = from[i];
- DECRYPT_BYTE_ZIP(t);
- UPDATE_KEYS_ZIP(ztemp);
- to[i] = t ^ ztemp;
- }
- else
- bf_crypt_encode(from, len, to);
-}
-
-/*
- * Decrypt "ptr[len]" in place.
- */
- void
-crypt_decode(ptr, len)
- char_u *ptr;
- long len;
-{
- char_u *p;
-
- if (use_crypt_method == 0)
- for (p = ptr; p < ptr + len; ++p)
- {
- ush temp;
-
- temp = (ush)keys[2] | 2;
- temp = (int)(((unsigned)(temp * (temp ^ 1U)) >> 8) & 0xff);
- UPDATE_KEYS_ZIP(*p ^= temp);
- }
- else
- bf_crypt_decode(ptr, len);
-}
-
-/*
- * Initialize the encryption keys and the random header according to
- * the given password.
- * If "passwd" is NULL or empty, don't do anything.
- */
- void
-crypt_init_keys(passwd)
- char_u *passwd; /* password string with which to modify keys */
-{
- if (passwd != NULL && *passwd != NUL)
- {
- if (use_crypt_method == 0)
- {
- char_u *p;
-
- make_crc_tab();
- keys[0] = 305419896L;
- keys[1] = 591751049L;
- keys[2] = 878082192L;
- for (p = passwd; *p!= NUL; ++p)
- {
- UPDATE_KEYS_ZIP((int)*p);
- }
- }
- else
- bf_crypt_init_keys(passwd);
- }
-}
-
-/*
- * Free an allocated crypt key. Clear the text to make sure it doesn't stay
- * in memory anywhere.
- */
- void
-free_crypt_key(key)
- char_u *key;
-{
- char_u *p;
-
- if (key != NULL)
- {
- for (p = key; *p != NUL; ++p)
- *p = 0;
- vim_free(key);
- }
-}
-
-/*
- * Ask the user for a crypt key.
- * When "store" is TRUE, the new key is stored in the 'key' option, and the
- * 'key' option value is returned: Don't free it.
- * When "store" is FALSE, the typed key is returned in allocated memory.
- * Returns NULL on failure.
- */
- char_u *
-get_crypt_key(store, twice)
- int store;
- int twice; /* Ask for the key twice. */
-{
- char_u *p1, *p2 = NULL;
- int round;
-
- for (round = 0; ; ++round)
- {
- cmdline_star = TRUE;
- cmdline_row = msg_row;
- p1 = getcmdline_prompt(NUL, round == 0
- ? (char_u *)_("Enter encryption key: ")
- : (char_u *)_("Enter same key again: "), 0, EXPAND_NOTHING,
- NULL);
- cmdline_star = FALSE;
-
- if (p1 == NULL)
- break;
-
- if (round == twice)
- {
- if (p2 != NULL && STRCMP(p1, p2) != 0)
- {
- MSG(_("Keys don't match!"));
- free_crypt_key(p1);
- free_crypt_key(p2);
- p2 = NULL;
- round = -1; /* do it again */
- continue;
- }
-
- if (store)
- {
- set_option_value((char_u *)"key", 0L, p1, OPT_LOCAL);
- free_crypt_key(p1);
- p1 = curbuf->b_p_key;
- }
- break;
- }
- p2 = p1;
- }
-
- /* since the user typed this, no need to wait for return */
- if (msg_didout)
- msg_putchar('\n');
- need_wait_return = FALSE;
- msg_didout = FALSE;
-
- free_crypt_key(p2);
- return p1;
-}
-
-#endif /* FEAT_CRYPT */
-
/* TODO: make some #ifdef for this */
/*--------[ file searching ]-------------------------------------------------*/
/*
@@ -6594,8 +6280,23 @@ put_time(fd, the_time)
FILE *fd;
time_t the_time;
{
+ char_u buf[8];
+
+ time_to_bytes(the_time, buf);
+ fwrite(buf, (size_t)8, (size_t)1, fd);
+}
+
+/*
+ * Write time_t to "buf[8]".
+ */
+ void
+time_to_bytes(the_time, buf)
+ time_t the_time;
+ char_u *buf;
+{
int c;
int i;
+ int bi = 0;
time_t wtime = the_time;
/* time_t can be up to 8 bytes in size, more than long_u, thus we
@@ -6609,7 +6310,7 @@ put_time(fd, the_time)
{
if (i + 1 > (int)sizeof(time_t))
/* ">>" doesn't work well when shifting more bits than avail */
- putc(0, fd);
+ buf[bi++] = 0;
else
{
#if defined(SIZEOF_TIME_T) && SIZEOF_TIME_T > 4
@@ -6617,7 +6318,7 @@ put_time(fd, the_time)
#else
c = (int)((long_u)wtime >> (i * 8));
#endif
- putc(c, fd);
+ buf[bi++] = c;
}
}
}
diff --git a/src/move.c b/src/move.c
index 42f7784..2e0efec 100644
--- a/src/move.c
+++ b/src/move.c
@@ -183,6 +183,18 @@ update_topline()
if (!screen_valid(TRUE))
return;
+ /* If the window height is zero just use the cursor line. */
+ if (curwin->w_height == 0)
+ {
+ curwin->w_topline = curwin->w_cursor.lnum;
+ curwin->w_botline = curwin->w_topline;
+ curwin->w_valid |= VALID_BOTLINE|VALID_BOTLINE_AP;
+#ifdef FEAT_SCROLLBIND
+ curwin->w_scbind_pos = 1;
+#endif
+ return;
+ }
+
check_cursor_moved(curwin);
if (curwin->w_valid & VALID_TOPLINE)
return;
diff --git a/src/normal.c b/src/normal.c
index 3f00eed..5c61f17 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -1380,6 +1380,9 @@ do_pending_operator(cap, old_col, gui_yank)
pos_T old_cursor;
int empty_region_error;
int restart_edit_save;
+#ifdef FEAT_LINEBREAK
+ int lbr_saved = curwin->w_p_lbr;
+#endif
/* The visual area is remembered for redo */
static int redo_VIsual_mode = NUL; /* 'v', 'V', or Ctrl-V */
@@ -1390,6 +1393,10 @@ do_pending_operator(cap, old_col, gui_yank)
int include_line_break = FALSE;
#endif
+#ifdef FEAT_LINEBREAK
+ curwin->w_p_lbr = FALSE; /* Avoid a problem with unwanted linebreaks in
+ * block mode. */
+#endif
#if defined(FEAT_CLIPBOARD)
/*
* Yank the visual area into the GUI selection register before we operate
@@ -2136,6 +2143,9 @@ do_pending_operator(cap, old_col, gui_yank)
oap->block_mode = FALSE;
clearop(oap);
}
+#ifdef FEAT_LINEBREAK
+ curwin->w_p_lbr = lbr_saved;
+#endif
}
/*
@@ -4514,13 +4524,21 @@ nv_screengo(oap, dir, dist)
#if defined(FEAT_LINEBREAK) || defined(FEAT_MBYTE)
if (curwin->w_cursor.col > 0 && curwin->w_p_wrap)
{
+ colnr_T virtcol;
+
/*
* Check for landing on a character that got split at the end of the
* last line. We want to advance a screenline, not end up in the same
* screenline or move two screenlines.
*/
validate_virtcol();
- if (curwin->w_virtcol > curwin->w_curswant
+ virtcol = curwin->w_virtcol;
+# if defined(FEAT_LINEBREAK)
+ if (virtcol > (colnr_T)width1 && *p_sbr != NUL)
+ virtcol -= vim_strsize(p_sbr);
+# endif
+
+ if (virtcol > curwin->w_curswant
&& (curwin->w_curswant < (colnr_T)width1
? (curwin->w_curswant > (colnr_T)width1 / 2)
: ((curwin->w_curswant - width1) % width2
@@ -9300,7 +9318,7 @@ nv_put(cap)
if (cap->oap->op_type == OP_DELETE && cap->cmdchar == 'p')
{
clearop(cap->oap);
- nv_diffgetput(TRUE);
+ nv_diffgetput(TRUE, cap->opcount);
}
else
#endif
@@ -9423,7 +9441,7 @@ nv_open(cap)
if (cap->oap->op_type == OP_DELETE && cap->cmdchar == 'o')
{
clearop(cap->oap);
- nv_diffgetput(FALSE);
+ nv_diffgetput(FALSE, cap->opcount);
}
else
#endif
diff --git a/src/ops.c b/src/ops.c
index 265cf3a..edc84a0 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -609,6 +609,26 @@ block_insert(oap, s, b_insert, bdp)
}
}
+#ifdef FEAT_MBYTE
+ if (has_mbyte && spaces > 0)
+ {
+ /* Avoid starting halfway a multi-byte character. */
+ if (b_insert)
+ {
+ int off = (*mb_head_off)(oldp, oldp + offset + spaces);
+ spaces -= off;
+ count -= off;
+ }
+ else
+ {
+ int off = (*mb_off_next)(oldp, oldp + offset);
+ offset += off;
+ spaces = 0;
+ count = 0;
+ }
+ }
+#endif
+
newp = alloc_check((unsigned)(STRLEN(oldp)) + s_len + count + 1);
if (newp == NULL)
continue;
@@ -1597,9 +1617,15 @@ adjust_clip_reg(rp)
{
/* If no reg. specified, and "unnamed" or "unnamedplus" is in 'clipboard',
* use '*' or '+' reg, respectively. "unnamedplus" prevails. */
- if (*rp == 0 && clip_unnamed != 0)
- *rp = ((clip_unnamed & CLIP_UNNAMED_PLUS) && clip_plus.available)
+ if (*rp == 0 && (clip_unnamed != 0 || clip_unnamed_saved != 0))
+ {
+ if (clip_unnamed != 0)
+ *rp = ((clip_unnamed & CLIP_UNNAMED_PLUS) && clip_plus.available)
? '+' : '*';
+ else
+ *rp = ((clip_unnamed_saved & CLIP_UNNAMED_PLUS) && clip_plus.available)
+ ? '+' : '*';
+ }
if (!clip_star.available && *rp == '*')
*rp = 0;
if (!clip_plus.available && *rp == '+')
@@ -3203,7 +3229,7 @@ op_yank(oap, deleting, mess)
if (clip_star.available
&& (curr == &(y_regs[STAR_REGISTER])
|| (!deleting && oap->regname == 0
- && (clip_unnamed & CLIP_UNNAMED))))
+ && ((clip_unnamed | clip_unnamed_saved) & CLIP_UNNAMED))))
{
if (curr != &(y_regs[STAR_REGISTER]))
/* Copy the text from register 0 to the clipboard register. */
@@ -3224,7 +3250,8 @@ op_yank(oap, deleting, mess)
if (clip_plus.available
&& (curr == &(y_regs[PLUS_REGISTER])
|| (!deleting && oap->regname == 0
- && (clip_unnamed & CLIP_UNNAMED_PLUS))))
+ && ((clip_unnamed | clip_unnamed_saved) &
+ CLIP_UNNAMED_PLUS))))
{
if (curr != &(y_regs[PLUS_REGISTER]))
/* Copy the text from register 0 to the clipboard register. */
@@ -3804,6 +3831,9 @@ do_put(regname, dir, count, flags)
lnum++;
} while (VIsual_active && lnum <= curbuf->b_visual.vi_end.lnum);
+ if (VIsual_active) /* reset lnum to the last visual line */
+ lnum--;
+
curbuf->b_op_end = curwin->w_cursor;
/* For "CTRL-O p" in Insert mode, put cursor after last char */
if (totlen && (restart_edit != 0 || (flags & PUT_CURSEND)))
diff --git a/src/option.c b/src/option.c
index e815218..a26e77d 100644
--- a/src/option.c
+++ b/src/option.c
@@ -56,6 +56,7 @@
*/
#define PV_AI OPT_BUF(BV_AI)
#define PV_AR OPT_BOTH(OPT_BUF(BV_AR))
+#define PV_BKC OPT_BOTH(OPT_BUF(BV_BKC))
#ifdef FEAT_QUICKFIX
# define PV_BH OPT_BUF(BV_BH)
# define PV_BT OPT_BUF(BV_BT)
@@ -591,7 +592,7 @@ static struct vimoption
(char_u *)&p_bk, PV_NONE,
{(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
{"backupcopy", "bkc", P_STRING|P_VIM|P_COMMA|P_NODUP,
- (char_u *)&p_bkc, PV_NONE,
+ (char_u *)&p_bkc, PV_BKC,
#ifdef UNIX
{(char_u *)"yes", (char_u *)"auto"}
#else
@@ -1723,6 +1724,13 @@ static struct vimoption
(char_u *)NULL, PV_NONE,
#endif
{(char_u *)"", (char_u *)0L} SCRIPTID_INIT},
+ {"langnoremap", "lnr", P_BOOL|P_VI_DEF,
+#ifdef FEAT_LANGMAP
+ (char_u *)&p_lnr, PV_NONE,
+#else
+ (char_u *)NULL, PV_NONE,
+#endif
+ {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
{"laststatus", "ls", P_NUM|P_VI_DEF|P_RALL,
#ifdef FEAT_WINDOWS
(char_u *)&p_ls, PV_NONE,
@@ -2164,6 +2172,15 @@ static struct vimoption
{"remap", NULL, P_BOOL|P_VI_DEF,
(char_u *)&p_remap, PV_NONE,
{(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT},
+ {"renderoptions", "rop", P_STRING|P_COMMA|P_RCLR|P_VI_DEF,
+#ifdef FEAT_RENDER_OPTIONS
+ (char_u *)&p_rop, PV_NONE,
+ {(char_u *)"", (char_u *)0L}
+#else
+ (char_u *)NULL, PV_NONE,
+ {(char_u *)NULL, (char_u *)0L}
+#endif
+ SCRIPTID_INIT},
{"report", NULL, P_NUM|P_VI_DEF,
(char_u *)&p_report, PV_NONE,
{(char_u *)2L, (char_u *)0L} SCRIPTID_INIT},
@@ -3027,7 +3044,7 @@ static char *(p_bg_values[]) = {"light", "dark", NULL};
static char *(p_nf_values[]) = {"octal", "hex", "alpha", NULL};
static char *(p_ff_values[]) = {FF_UNIX, FF_DOS, FF_MAC, NULL};
#ifdef FEAT_CRYPT
-static char *(p_cm_values[]) = {"zip", "blowfish", NULL};
+static char *(p_cm_values[]) = {"zip", "blowfish", "blowfish2", NULL};
#endif
#ifdef FEAT_CMDL_COMPL
static char *(p_wop_values[]) = {"tagfile", NULL};
@@ -3135,6 +3152,9 @@ static void fill_breakat_flags __ARGS((void));
static int opt_strings_flags __ARGS((char_u *val, char **values, unsigned *flagp, int list));
static int check_opt_strings __ARGS((char_u *val, char **values, int));
static int check_opt_wim __ARGS((void));
+#ifdef FEAT_LINEBREAK
+static int briopt_check __ARGS((win_T *wp));
+#endif
#ifdef FEAT_FULLSCREEN
static int check_fuoptions __ARGS((char_u *, unsigned *, int *));
#endif
@@ -3701,6 +3721,9 @@ set_options_default(opt_flags)
#else
win_comp_scroll(curwin);
#endif
+#ifdef FEAT_CINDENT
+ parse_cino(curbuf);
+#endif
}
/*
@@ -5352,7 +5375,7 @@ didset_options()
(void)check_cedit();
#endif
#ifdef FEAT_LINEBREAK
- briopt_check();
+ briopt_check(curwin);
#endif
}
@@ -5469,6 +5492,7 @@ check_buf_options(buf)
#ifdef FEAT_LISP
check_string_option(&buf->b_p_lw);
#endif
+ check_string_option(&buf->b_p_bkc);
}
/*
@@ -5623,6 +5647,7 @@ set_string_option_direct(name, opt_idx, val, opt_flags, set_sid)
if (idx < 0) /* not found (should not happen) */
{
EMSG2(_(e_intern2), "set_string_option_direct()");
+ EMSG2(_("For option %s"), name);
return;
}
}
@@ -5786,17 +5811,32 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
}
/* 'backupcopy' */
- else if (varp == &p_bkc)
+ else if (gvarp == &p_bkc)
{
- if (opt_strings_flags(p_bkc, p_bkc_values, &bkc_flags, TRUE) != OK)
- errmsg = e_invarg;
- if (((bkc_flags & BKC_AUTO) != 0)
- + ((bkc_flags & BKC_YES) != 0)
- + ((bkc_flags & BKC_NO) != 0) != 1)
+ char_u *bkc = p_bkc;
+ unsigned int *flags = &bkc_flags;
+
+ if (opt_flags & OPT_LOCAL)
{
- /* Must have exactly one of "auto", "yes" and "no". */
- (void)opt_strings_flags(oldval, p_bkc_values, &bkc_flags, TRUE);
- errmsg = e_invarg;
+ bkc = curbuf->b_p_bkc;
+ flags = &curbuf->b_bkc_flags;
+ }
+
+ if ((opt_flags & OPT_LOCAL) && *bkc == NUL)
+ /* make the local value empty: use the global value */
+ *flags = 0;
+ else
+ {
+ if (opt_strings_flags(bkc, p_bkc_values, flags, TRUE) != OK)
+ errmsg = e_invarg;
+ if ((((int)*flags & BKC_AUTO) != 0)
+ + (((int)*flags & BKC_YES) != 0)
+ + (((int)*flags & BKC_NO) != 0) != 1)
+ {
+ /* Must have exactly one of "auto", "yes" and "no". */
+ (void)opt_strings_flags(oldval, p_bkc_values, flags, TRUE);
+ errmsg = e_invarg;
+ }
}
}
@@ -5811,7 +5851,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
/* 'breakindentopt' */
else if (varp == &curwin->w_p_briopt)
{
- if (briopt_check() == FAIL)
+ if (briopt_check(curwin) == FAIL)
errmsg = e_invarg;
}
#endif
@@ -6207,7 +6247,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
# endif
if (STRCMP(curbuf->b_p_key, oldval) != 0)
/* Need to update the swapfile. */
- ml_set_crypt_key(curbuf, oldval, get_crypt_method(curbuf));
+ ml_set_crypt_key(curbuf, oldval, crypt_get_method_nr(curbuf));
}
else if (gvarp == &p_cm)
@@ -6218,7 +6258,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
p = p_cm;
if (check_opt_strings(p, p_cm_values, TRUE) != OK)
errmsg = e_invarg;
- else if (get_crypt_method(curbuf) > 0 && blowfish_self_test() == FAIL)
+ else if (crypt_self_test() == FAIL)
errmsg = e_invarg;
else
{
@@ -6230,6 +6270,14 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
p_cm = vim_strsave((char_u *)"zip");
new_value_alloced = TRUE;
}
+ /* When using ":set cm=name" the local value is going to be empty.
+ * Do that here, otherwise the crypt functions will still use the
+ * local value. */
+ if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)
+ {
+ free_string_option(curbuf->b_p_cm);
+ curbuf->b_p_cm = empty_option;
+ }
/* Need to update the swapfile when the effective method changed.
* Set "s" to the effective old value, "p" to the effective new
@@ -6244,7 +6292,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
p = curbuf->b_p_cm;
if (STRCMP(s, p) != 0)
ml_set_crypt_key(curbuf, curbuf->b_p_key,
- crypt_method_from_string(s));
+ crypt_method_nr_from_name(s));
/* If the global value changes need to update the swapfile for all
* buffers using that value. */
@@ -6255,7 +6303,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
for (buf = firstbuf; buf != NULL; buf = buf->b_next)
if (buf != curbuf && *buf->b_p_cm == NUL)
ml_set_crypt_key(buf, buf->b_p_key,
- crypt_method_from_string(oldval));
+ crypt_method_nr_from_name(oldval));
}
}
}
@@ -6736,15 +6784,16 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
#ifdef FEAT_SPELL
/* When 'spelllang' or 'spellfile' is set and there is a window for this
* buffer in which 'spell' is set load the wordlists. */
- else if (varp == &(curbuf->b_s.b_p_spl) || varp == &(curbuf->b_s.b_p_spf))
+ else if (varp == &(curwin->w_s->b_p_spl)
+ || varp == &(curwin->w_s->b_p_spf))
{
win_T *wp;
int l;
- if (varp == &(curbuf->b_s.b_p_spf))
+ if (varp == &(curwin->w_s->b_p_spf))
{
- l = (int)STRLEN(curbuf->b_s.b_p_spf);
- if (l > 0 && (l < 4 || STRCMP(curbuf->b_s.b_p_spf + l - 4,
+ l = (int)STRLEN(curwin->w_s->b_p_spf);
+ if (l > 0 && (l < 4 || STRCMP(curwin->w_s->b_p_spf + l - 4,
".add") != 0))
errmsg = e_invarg;
}
@@ -7086,6 +7135,14 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
}
#endif
+#if defined(FEAT_RENDER_OPTIONS)
+ else if (varp == &p_rop && gui.in_use)
+ {
+ if (!gui_mch_set_rendering_options(p_rop))
+ errmsg = e_invarg;
+ }
+#endif
+
/* Options that are a list of flags. */
else
{
@@ -9132,12 +9189,13 @@ get_option_value_strict(name, numval, stringval, opt_type, from)
}
/*
- * Iterate over options. First argument is a pointer to a pointer to a structure
- * inside options[] array, second is option type like in the above function.
+ * Iterate over options. First argument is a pointer to a pointer to a
+ * structure inside options[] array, second is option type like in the above
+ * function.
*
- * If first argument points to NULL it is assumed that iteration just started
+ * If first argument points to NULL it is assumed that iteration just started
* and caller needs the very first value.
- * If first argument points to the end marker function returns NULL and sets
+ * If first argument points to the end marker function returns NULL and sets
* first argument to NULL.
*
* Returns full option name for current option on each call.
@@ -9963,6 +10021,10 @@ unset_global_local_option(name, from)
case PV_AR:
buf->b_p_ar = -1;
break;
+ case PV_BKC:
+ clear_string_option(&buf->b_p_bkc);
+ buf->b_bkc_flags = 0;
+ break;
case PV_TAGS:
clear_string_option(&buf->b_p_tags);
break;
@@ -10068,6 +10130,7 @@ get_varp_scope(p, opt_flags)
#ifdef FEAT_LISP
case PV_LW: return (char_u *)&(curbuf->b_p_lw);
#endif
+ case PV_BKC: return (char_u *)&(curbuf->b_p_bkc);
}
return NULL; /* "cannot happen" */
}
@@ -10100,6 +10163,8 @@ get_varp(p)
? (char_u *)&(curbuf->b_p_ar) : p->var;
case PV_TAGS: return *curbuf->b_p_tags != NUL
? (char_u *)&(curbuf->b_p_tags) : p->var;
+ case PV_BKC: return *curbuf->b_p_bkc != NUL
+ ? (char_u *)&(curbuf->b_p_bkc) : p->var;
#ifdef FEAT_FIND_ID
case PV_DEF: return *curbuf->b_p_def != NUL
? (char_u *)&(curbuf->b_p_def) : p->var;
@@ -10348,6 +10413,9 @@ win_copy_options(wp_from, wp_to)
wp_to->w_farsi = wp_from->w_farsi;
# endif
# endif
+#if defined(FEAT_LINEBREAK)
+ briopt_check(wp_to);
+#endif
}
#endif
@@ -10695,6 +10763,8 @@ buf_copy_options(buf, flags)
* are not copied, start using the global value */
buf->b_p_ar = -1;
buf->b_p_ul = NO_LOCAL_UNDOLEVEL;
+ buf->b_p_bkc = empty_option;
+ buf->b_bkc_flags = 0;
#ifdef FEAT_QUICKFIX
buf->b_p_gp = empty_option;
buf->b_p_mp = empty_option;
@@ -12213,15 +12283,16 @@ check_fuoptions(p_fuoptions, flags, bgcolor)
* This is called when 'breakindentopt' is changed and when a window is
* initialized.
*/
- int
-briopt_check()
+ static int
+briopt_check(wp)
+ win_T *wp;
{
char_u *p;
int bri_shift = 0;
long bri_min = 20;
int bri_sbr = FALSE;
- p = curwin->w_p_briopt;
+ p = wp->w_p_briopt;
while (*p != NUL)
{
if (STRNCMP(p, "shift:", 6) == 0
@@ -12246,10 +12317,20 @@ briopt_check()
++p;
}
- curwin->w_p_brishift = bri_shift;
- curwin->w_p_brimin = bri_min;
- curwin->w_p_brisbr = bri_sbr;
+ wp->w_p_brishift = bri_shift;
+ wp->w_p_brimin = bri_min;
+ wp->w_p_brisbr = bri_sbr;
return OK;
}
#endif
+
+/*
+ * Get the local or global value of 'backupcopy'.
+ */
+ unsigned int
+get_bkc_value(buf)
+ buf_T *buf;
+{
+ return buf->b_bkc_flags ? buf->b_bkc_flags : bkc_flags;
+}
diff --git a/src/option.h b/src/option.h
index e3e7b86..0f2e1cb 100644
--- a/src/option.h
+++ b/src/option.h
@@ -327,7 +327,7 @@ EXTERN char_u *p_bs; /* 'backspace' */
EXTERN char_u *p_bg; /* 'background' */
EXTERN int p_bk; /* 'backup' */
EXTERN char_u *p_bkc; /* 'backupcopy' */
-EXTERN unsigned bkc_flags;
+EXTERN unsigned bkc_flags; /* flags from 'backupcopy' */
#ifdef IN_OPTION_C
static char *(p_bkc_values[]) = {"yes", "auto", "no", "breaksymlink", "breakhardlink", NULL};
#endif
@@ -588,6 +588,7 @@ EXTERN char_u *p_kp; /* 'keywordprg' */
EXTERN char_u *p_km; /* 'keymodel' */
#ifdef FEAT_LANGMAP
EXTERN char_u *p_langmap; /* 'langmap'*/
+EXTERN int p_lnr; /* 'langnoremap' */
#endif
#if defined(FEAT_MENU) && defined(FEAT_MULTI_LANG)
EXTERN char_u *p_lm; /* 'langmenu' */
@@ -667,6 +668,9 @@ EXTERN long p_rdt; /* 'redrawtime' */
#endif
EXTERN int p_remap; /* 'remap' */
EXTERN long p_re; /* 'regexpengine' */
+#ifdef FEAT_RENDER_OPTIONS
+EXTERN char_u *p_rop; /* 'renderoptions' */
+#endif
EXTERN long p_report; /* 'report' */
#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
EXTERN long p_pvh; /* 'previewheight' */
@@ -930,6 +934,9 @@ enum
, BV_AR
#ifdef FEAT_QUICKFIX
, BV_BH
+#endif
+ , BV_BKC
+#ifdef FEAT_QUICKFIX
, BV_BT
, BV_EFM
, BV_GP
diff --git a/src/os_mswin.c b/src/os_mswin.c
index 871afad..b50b86c 100644
--- a/src/os_mswin.c
+++ b/src/os_mswin.c
@@ -277,10 +277,6 @@ mch_early_init(void)
AnsiUpperBuff(toupper_tab, 256);
AnsiLowerBuff(tolower_tab, 256);
#endif
-
-#if defined(FEAT_MBYTE) && !defined(FEAT_GUI)
- (void)get_cmd_argsW(NULL);
-#endif
}
@@ -348,7 +344,7 @@ mch_restore_title(
int which)
{
#ifndef FEAT_GUI_MSWIN
- mch_settitle((which & 1) ? g_szOrigTitle : NULL, NULL);
+ SetConsoleTitle(g_szOrigTitle);
#endif
}
@@ -415,7 +411,7 @@ mch_FullName(
* - convert the result from UCS2 to 'encoding'.
*/
wname = enc_to_utf16(fname, NULL);
- if (wname != NULL && _wfullpath(wbuf, wname, MAX_PATH - 1) != NULL)
+ if (wname != NULL && _wfullpath(wbuf, wname, MAX_PATH) != NULL)
{
cname = utf16_to_enc((short_u *)wbuf, NULL);
if (cname != NULL)
@@ -932,6 +928,33 @@ check_str_len(char_u *str)
}
# endif
+/*
+ * Passed to do_in_runtimepath() to load a vim.ico file.
+ */
+ static void
+mch_icon_load_cb(char_u *fname, void *cookie)
+{
+ HANDLE *h = (HANDLE *)cookie;
+
+ *h = LoadImage(NULL,
+ fname,
+ IMAGE_ICON,
+ 64,
+ 64,
+ LR_LOADFROMFILE | LR_LOADMAP3DCOLORS);
+}
+
+/*
+ * Try loading an icon file from 'runtimepath'.
+ */
+ int
+mch_icon_load(iconp)
+ HANDLE *iconp;
+{
+ return do_in_runtimepath((char_u *)"bitmaps/vim.ico",
+ FALSE, mch_icon_load_cb, iconp);
+}
+
int
mch_libcall(
char_u *libname,
@@ -1612,11 +1635,34 @@ mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
char_u *printer_name = (char_u *)devname + devname->wDeviceOffset;
char_u *port_name = (char_u *)devname +devname->wOutputOffset;
char_u *text = _("to %s on %s");
+#ifdef FEAT_MBYTE
+ char_u *printer_name_orig = printer_name;
+ char_u *port_name_orig = port_name;
+ if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
+ {
+ char_u *to_free = NULL;
+ int maxlen;
+
+ acp_to_enc(printer_name, (int)STRLEN(printer_name), &to_free,
+ &maxlen);
+ if (to_free != NULL)
+ printer_name = to_free;
+ acp_to_enc(port_name, (int)STRLEN(port_name), &to_free, &maxlen);
+ if (to_free != NULL)
+ port_name = to_free;
+ }
+#endif
prt_name = alloc((unsigned)(STRLEN(printer_name) + STRLEN(port_name)
+ STRLEN(text)));
if (prt_name != NULL)
wsprintf(prt_name, text, printer_name, port_name);
+#ifdef FEAT_MBYTE
+ if (printer_name != printer_name_orig)
+ vim_free(printer_name);
+ if (port_name != port_name_orig)
+ vim_free(port_name);
+#endif
}
GlobalUnlock(prt_dlg.hDevNames);
@@ -1650,16 +1696,22 @@ mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
*/
psettings->chars_per_line = prt_get_cpl();
psettings->lines_per_page = prt_get_lpp();
- psettings->n_collated_copies = (prt_dlg.Flags & PD_COLLATE)
- ? prt_dlg.nCopies : 1;
- psettings->n_uncollated_copies = (prt_dlg.Flags & PD_COLLATE)
- ? 1 : prt_dlg.nCopies;
+ if (prt_dlg.Flags & PD_USEDEVMODECOPIESANDCOLLATE)
+ {
+ psettings->n_collated_copies = (prt_dlg.Flags & PD_COLLATE)
+ ? prt_dlg.nCopies : 1;
+ psettings->n_uncollated_copies = (prt_dlg.Flags & PD_COLLATE)
+ ? 1 : prt_dlg.nCopies;
- if (psettings->n_collated_copies == 0)
- psettings->n_collated_copies = 1;
+ if (psettings->n_collated_copies == 0)
+ psettings->n_collated_copies = 1;
- if (psettings->n_uncollated_copies == 0)
+ if (psettings->n_uncollated_copies == 0)
+ psettings->n_uncollated_copies = 1;
+ } else {
+ psettings->n_collated_copies = 1;
psettings->n_uncollated_copies = 1;
+ }
psettings->jobname = jobname;
diff --git a/src/os_unix.c b/src/os_unix.c
index a620d28..6d4332d 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -1586,12 +1586,15 @@ x_IOerror_check(dpy)
* An X IO Error handler, used to catch terminal errors.
*/
static int x_IOerror_handler __ARGS((Display *dpy));
+static void may_restore_clipboard __ARGS((void));
+static int xterm_dpy_was_reset = FALSE;
static int
x_IOerror_handler(dpy)
Display *dpy UNUSED;
{
xterm_dpy = NULL;
+ xterm_dpy_was_reset = TRUE;
x11_window = 0;
x11_display = NULL;
xterm_Shell = (Widget)0;
@@ -1602,6 +1605,22 @@ x_IOerror_handler(dpy)
return 0; /* avoid the compiler complains about missing return value */
# endif
}
+
+/*
+ * If the X11 connection was lost try to restore it.
+ * Helps when the X11 server was stopped and restarted while Vim was inactive
+ * (e.g. though tmux).
+ */
+ static void
+may_restore_clipboard()
+{
+ if (xterm_dpy_was_reset)
+ {
+ xterm_dpy_was_reset = FALSE;
+ setup_term_clip();
+ get_x11_title(FALSE);
+ }
+}
#endif
/*
@@ -1610,8 +1629,6 @@ x_IOerror_handler(dpy)
static int
x_connect_to_server()
{
- regmatch_T regmatch;
-
#if defined(FEAT_CLIENTSERVER)
if (x_force_connect)
return TRUE;
@@ -1622,9 +1639,7 @@ x_connect_to_server()
/* Check for a match with "exclude:" from 'clipboard'. */
if (clip_exclude_prog != NULL)
{
- regmatch.rm_ic = FALSE; /* Don't ignore case */
- regmatch.regprog = clip_exclude_prog;
- if (vim_regexec(&regmatch, T_NAME, (colnr_T)0))
+ if (vim_regexec_prog(&clip_exclude_prog, FALSE, T_NAME, (colnr_T)0))
return FALSE;
}
return TRUE;
@@ -1960,9 +1975,12 @@ get_x11_thing(get_title, test_only)
return retval;
}
-/* Are Xutf8 functions available? Avoid error from old compilers. */
+/* Xutf8 functions are not avaialble on older systems. Note that on some
+ * systems X_HAVE_UTF8_STRING may be defined in a header file but
+ * Xutf8SetWMProperties() is not in the X11 library. Configure checks for
+ * that and defines HAVE_XUTF8SETWMPROPERTIES. */
#if defined(X_HAVE_UTF8_STRING) && defined(FEAT_MBYTE)
-# if X_HAVE_UTF8_STRING
+# if X_HAVE_UTF8_STRING && HAVE_XUTF8SETWMPROPERTIES
# define USE_UTF8_STRING
# endif
#endif
@@ -3673,8 +3691,6 @@ mch_setmouse(on)
void
check_mouse_termcode()
{
- xterm_conflict_mouse = FALSE;
-
# ifdef FEAT_MOUSE_XTERM
if (use_xterm_mouse()
# ifdef FEAT_MOUSE_URXVT
@@ -3719,7 +3735,7 @@ check_mouse_termcode()
# endif
# ifdef FEAT_MOUSE_JSB
- /* There is no conflict, but it was disabled for xterm before. */
+ /* Conflicts with xterm mouse: "\033[" and "\033[M" ??? */
if (!use_xterm_mouse()
# ifdef FEAT_GUI
&& !gui.in_use
@@ -3746,45 +3762,31 @@ check_mouse_termcode()
# endif
# ifdef FEAT_MOUSE_DEC
- /* Conflicts with xterm mouse: "\033[" and "\033[M".
- * Also conflicts with the xterm termresponse, skip this if it was
- * requested already. */
+ /* Conflicts with xterm mouse: "\033[" and "\033[M" */
if (!use_xterm_mouse()
-# ifdef FEAT_TERMRESPONSE
- && !did_request_esc_sequence()
-# endif
# ifdef FEAT_GUI
&& !gui.in_use
# endif
)
- {
set_mouse_termcode(KS_DEC_MOUSE, (char_u *)(term_is_8bit(T_NAME)
? IF_EB("\233", CSI_STR) : IF_EB("\033[", ESC_STR "[")));
- xterm_conflict_mouse = TRUE;
- }
else
del_mouse_termcode(KS_DEC_MOUSE);
# endif
# ifdef FEAT_MOUSE_PTERM
- /* same as the dec mouse */
+ /* same conflict as the dec mouse */
if (!use_xterm_mouse()
-# ifdef FEAT_TERMRESPONSE
- && !did_request_esc_sequence()
-# endif
# ifdef FEAT_GUI
&& !gui.in_use
# endif
)
- {
set_mouse_termcode(KS_PTERM_MOUSE,
(char_u *) IF_EB("\033[", ESC_STR "["));
- xterm_conflict_mouse = TRUE;
- }
else
del_mouse_termcode(KS_PTERM_MOUSE);
# endif
# ifdef FEAT_MOUSE_URXVT
- /* same as the dec mouse */
+ /* same conflict as the dec mouse */
if (use_xterm_mouse() == 3
# ifdef FEAT_GUI
&& !gui.in_use
@@ -3800,8 +3802,6 @@ check_mouse_termcode()
mch_setmouse(FALSE);
setmouse();
}
- /* It's OK to request the xterm version for uxterm. */
- resume_get_esc_sequence();
}
else
del_mouse_termcode(KS_URXVT_MOUSE);
@@ -5315,6 +5315,7 @@ RealWaitForChar(fd, msec, check_for_gpm)
}
# endif
# ifdef FEAT_XCLIPBOARD
+ may_restore_clipboard();
if (xterm_Shell != (Widget)0)
{
xterm_idx = nfd;
@@ -5467,6 +5468,7 @@ select_eintr:
}
# endif
# ifdef FEAT_XCLIPBOARD
+ may_restore_clipboard();
if (xterm_Shell != (Widget)0)
{
FD_SET(ConnectionNumber(xterm_dpy), &rfds);
@@ -5979,10 +5981,12 @@ mch_expand_wildcards(num_pat, pat, num_file, file, flags)
*p++ = '\\';
++j;
}
- else if (!intick && vim_strchr(SHELL_SPECIAL,
- pat[i][j]) != NULL)
+ else if (!intick
+ && ((flags & EW_KEEPDOLLAR) == 0 || pat[i][j] != '$')
+ && vim_strchr(SHELL_SPECIAL, pat[i][j]) != NULL)
/* Put a backslash before a special character, but not
- * when inside ``. */
+ * when inside ``. And not for $var when EW_KEEPDOLLAR is
+ * set. */
*p++ = '\\';
/* Copy one character. */
diff --git a/src/os_vms.c b/src/os_vms.c
index 55876b2..12eceed 100644
--- a/src/os_vms.c
+++ b/src/os_vms.c
@@ -12,7 +12,7 @@
#include "vim.h"
/* define _generic_64 for use in time functions */
-#ifndef VAX
+#if !defined(VAX) && !defined(PROTO)
# include <gen64def.h>
#else
/* based on Alpha's gen64def.h; the file is absent on VAX */
diff --git a/src/os_win32.c b/src/os_win32.c
index 0c896ef..9395638 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -135,6 +135,8 @@ typedef int BY_HANDLE_FILE_INFORMATION;
typedef int SE_OBJECT_TYPE;
typedef int PSNSECINFO;
typedef int PSNSECINFOW;
+typedef int STARTUPINFO;
+typedef int PROCESS_INFORMATION;
#endif
#ifndef FEAT_GUI_W32
@@ -1906,6 +1908,8 @@ executable_exists(char *name, char_u **path)
{
char *dum;
char fname[_MAX_PATH];
+ char *curpath, *newpath;
+ long n;
#ifdef FEAT_MBYTE
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
@@ -1913,11 +1917,19 @@ executable_exists(char *name, char_u **path)
WCHAR *p = enc_to_utf16(name, NULL);
WCHAR fnamew[_MAX_PATH];
WCHAR *dumw;
- long n;
+ WCHAR *wcurpath, *wnewpath;
if (p != NULL)
{
- n = (long)SearchPathW(NULL, p, NULL, _MAX_PATH, fnamew, &dumw);
+ wcurpath = _wgetenv(L"PATH");
+ wnewpath = (WCHAR*)alloc((unsigned)(wcslen(wcurpath) + 3)
+ * sizeof(WCHAR));
+ if (wnewpath == NULL)
+ return FALSE;
+ wcscpy(wnewpath, L".;");
+ wcscat(wnewpath, wcurpath);
+ n = (long)SearchPathW(wnewpath, p, NULL, _MAX_PATH, fnamew, &dumw);
+ vim_free(wnewpath);
vim_free(p);
if (n > 0 || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
{
@@ -1933,7 +1945,16 @@ executable_exists(char *name, char_u **path)
}
}
#endif
- if (SearchPath(NULL, name, NULL, _MAX_PATH, fname, &dum) == 0)
+
+ curpath = getenv("PATH");
+ newpath = (char*)alloc((unsigned)(STRLEN(curpath) + 3));
+ if (newpath == NULL)
+ return FALSE;
+ STRCPY(newpath, ".;");
+ STRCAT(newpath, curpath);
+ n = (long)SearchPath(newpath, name, NULL, _MAX_PATH, fname, &dum);
+ vim_free(newpath);
+ if (n == 0)
return FALSE;
if (mch_isdir(fname))
return FALSE;
@@ -2427,7 +2448,8 @@ SaveConsoleTitleAndIcon(void)
return;
/* Extract the first icon contained in the Vim executable. */
- g_hVimIcon = ExtractIcon(NULL, exe_name, 0);
+ if (mch_icon_load((HANDLE *)&g_hVimIcon) == FAIL || g_hVimIcon == NULL)
+ g_hVimIcon = ExtractIcon(NULL, exe_name, 0);
if (g_hVimIcon != NULL)
g_fCanChangeIcon = TRUE;
}
@@ -2755,9 +2777,10 @@ fname_case(
if (p != NULL)
{
char_u *q;
- WCHAR buf[_MAX_PATH + 2];
+ WCHAR buf[_MAX_PATH + 1];
- wcscpy(buf, p);
+ wcsncpy(buf, p, _MAX_PATH);
+ buf[_MAX_PATH] = L'\0';
vim_free(p);
if (fname_casew(buf, (len > 0) ? _MAX_PATH : 0) == OK)
@@ -4625,21 +4648,52 @@ mch_call_shell(
int x = 0;
int tmode = cur_tmode;
#ifdef FEAT_TITLE
- char szShellTitle[512];
+ char szShellTitle[512];
+# ifdef FEAT_MBYTE
+ int did_set_title = FALSE;
/* Change the title to reflect that we are in a subshell. */
- if (GetConsoleTitle(szShellTitle, sizeof(szShellTitle) - 4) > 0)
+ if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{
- if (cmd == NULL)
- strcat(szShellTitle, " :sh");
- else
+ WCHAR szShellTitle[512];
+
+ if (GetConsoleTitleW(szShellTitle,
+ sizeof(szShellTitle)/sizeof(WCHAR) - 4) > 0)
{
- strcat(szShellTitle, " - !");
- if ((strlen(szShellTitle) + strlen(cmd) < sizeof(szShellTitle)))
- strcat(szShellTitle, cmd);
+ if (cmd == NULL)
+ wcscat(szShellTitle, L" :sh");
+ else
+ {
+ WCHAR *wn = enc_to_utf16(cmd, NULL);
+
+ if (wn != NULL)
+ {
+ wcscat(szShellTitle, L" - !");
+ if ((wcslen(szShellTitle) + wcslen(wn) <
+ sizeof(szShellTitle)/sizeof(WCHAR)))
+ wcscat(szShellTitle, wn);
+ SetConsoleTitleW(szShellTitle);
+ vim_free(wn);
+ did_set_title = TRUE;
+ }
+ }
}
- mch_settitle(szShellTitle, NULL);
}
+ if (!did_set_title)
+# endif
+ /* Change the title to reflect that we are in a subshell. */
+ if (GetConsoleTitle(szShellTitle, sizeof(szShellTitle) - 4) > 0)
+ {
+ if (cmd == NULL)
+ strcat(szShellTitle, " :sh");
+ else
+ {
+ strcat(szShellTitle, " - !");
+ if ((strlen(szShellTitle) + strlen(cmd) < sizeof(szShellTitle)))
+ strcat(szShellTitle, cmd);
+ }
+ SetConsoleTitle(szShellTitle);
+ }
#endif
out_flush();
@@ -6087,6 +6141,13 @@ mch_open(char *name, int flags, int mode)
}
# endif
+ /* open() can open a file which name is longer than _MAX_PATH bytes
+ * and shorter than _MAX_PATH characters successfully, but sometimes it
+ * causes unexpected error in another part. We make it an error explicitly
+ * here. */
+ if (strlen(name) >= _MAX_PATH)
+ return -1;
+
return open(name, flags, mode);
}
@@ -6136,6 +6197,13 @@ mch_fopen(char *name, char *mode)
* the _wfopen() fails for missing wide functions. */
}
+ /* fopen() can open a file which name is longer than _MAX_PATH bytes
+ * and shorter than _MAX_PATH characters successfully, but sometimes it
+ * causes unexpected error in another part. We make it an error explicitly
+ * here. */
+ if (strlen(name) >= _MAX_PATH)
+ return NULL;
+
return fopen(name, mode);
}
#endif
@@ -6442,6 +6510,7 @@ get_cmd_argsW(char ***argvp)
int argc = 0;
int i;
+ free_cmd_argsW();
ArglistW = CommandLineToArgvW(GetCommandLineW(), &nArgsW);
if (ArglistW != NULL)
{
@@ -6474,7 +6543,11 @@ get_cmd_argsW(char ***argvp)
global_argc = argc;
global_argv = argv;
if (argc > 0)
+ {
+ if (used_file_indexes != NULL)
+ free(used_file_indexes);
used_file_indexes = malloc(argc * sizeof(int));
+ }
if (argvp != NULL)
*argvp = argv;
diff --git a/src/po/sjiscorr.c b/src/po/sjiscorr.c
index fec4740..b8f7e63 100644
--- a/src/po/sjiscorr.c
+++ b/src/po/sjiscorr.c
@@ -23,9 +23,8 @@ main(argc, argv)
fputs("charset=cp932", stdout);
p += 12;
}
- else if (strncmp(p, "ja.po - Japanese message file", 29) == 0)
+ else if (strncmp(p, "# Original translations", 23) == 0)
{
- fputs("ja.sjis.po - Japanese message file for Vim (version 6.x)\n", stdout);
fputs("# generated from ja.po, DO NOT EDIT", stdout);
while (p[1] != '\n')
++p;
diff --git a/src/proto.h b/src/proto.h
index 14f5a6b..9e7ba67 100644
--- a/src/proto.h
+++ b/src/proto.h
@@ -70,6 +70,8 @@ extern int _stricoll __ARGS((char *a, char *b));
# ifdef FEAT_CRYPT
# include "blowfish.pro"
+# include "crypt.pro"
+# include "crypt_zip.pro"
# endif
# include "buffer.pro"
# include "charset.pro"
diff --git a/src/proto/blowfish.pro b/src/proto/blowfish.pro
index 4d64e10..66d029c 100644
--- a/src/proto/blowfish.pro
+++ b/src/proto/blowfish.pro
@@ -1,10 +1,6 @@
/* blowfish.c */
-void bf_key_init __ARGS((char_u *password, char_u *salt, int salt_len));
-void bf_cfb_init __ARGS((char_u *iv, int iv_len));
-void bf_crypt_encode __ARGS((char_u *from, size_t len, char_u *to));
-void bf_crypt_decode __ARGS((char_u *ptr, long len));
-void bf_crypt_init_keys __ARGS((char_u *passwd));
-void bf_crypt_save __ARGS((void));
-void bf_crypt_restore __ARGS((void));
+void crypt_blowfish_encode __ARGS((cryptstate_T *state, char_u *from, size_t len, char_u *to));
+void crypt_blowfish_decode __ARGS((cryptstate_T *state, char_u *from, size_t len, char_u *to));
+void crypt_blowfish_init __ARGS((cryptstate_T *state, char_u *key, char_u *salt, int salt_len, char_u *seed, int seed_len));
int blowfish_self_test __ARGS((void));
/* vim: set ft=c : */
diff --git a/src/proto/crypt.pro b/src/proto/crypt.pro
new file mode 100644
index 0000000..7b29026
--- /dev/null
+++ b/src/proto/crypt.pro
@@ -0,0 +1,26 @@
+/* crypt.c */
+int crypt_method_nr_from_name __ARGS((char_u *name));
+int crypt_method_nr_from_magic __ARGS((char *ptr, int len));
+int crypt_works_inplace __ARGS((cryptstate_T *state));
+int crypt_get_method_nr __ARGS((buf_T *buf));
+int crypt_whole_undofile __ARGS((int method_nr));
+int crypt_get_header_len __ARGS((int method_nr));
+void crypt_set_cm_option __ARGS((buf_T *buf, int method_nr));
+int crypt_self_test __ARGS((void));
+cryptstate_T *crypt_create __ARGS((int method_nr, char_u *key, char_u *salt, int salt_len, char_u *seed, int seed_len));
+cryptstate_T *crypt_create_from_header __ARGS((int method_nr, char_u *key, char_u *header));
+cryptstate_T *crypt_create_from_file __ARGS((FILE *fp, char_u *key));
+cryptstate_T *crypt_create_for_writing __ARGS((int method_nr, char_u *key, char_u **header, int *header_len));
+void crypt_free_state __ARGS((cryptstate_T *state));
+long crypt_encode_alloc __ARGS((cryptstate_T *state, char_u *from, size_t len, char_u **newptr));
+long crypt_decode_alloc __ARGS((cryptstate_T *state, char_u *ptr, long len, char_u **newptr));
+void crypt_encode __ARGS((cryptstate_T *state, char_u *from, size_t len, char_u *to));
+void crypt_decode __ARGS((cryptstate_T *state, char_u *from, size_t len, char_u *to));
+void crypt_encode_inplace __ARGS((cryptstate_T *state, char_u *buf, size_t len));
+void crypt_decode_inplace __ARGS((cryptstate_T *state, char_u *buf, size_t len));
+void crypt_free_key __ARGS((char_u *key));
+void crypt_check_method __ARGS((int method));
+void crypt_check_current_method __ARGS((void));
+char_u *crypt_get_key __ARGS((int store, int twice));
+void crypt_append_msg __ARGS((buf_T *buf));
+/* vim: set ft=c : */
diff --git a/src/proto/crypt_zip.pro b/src/proto/crypt_zip.pro
new file mode 100644
index 0000000..5f4e137
--- /dev/null
+++ b/src/proto/crypt_zip.pro
@@ -0,0 +1,5 @@
+/* crypt_zip.c */
+void crypt_zip_init __ARGS((cryptstate_T *state, char_u *key, char_u *salt, int salt_len, char_u *seed, int seed_len));
+void crypt_zip_encode __ARGS((cryptstate_T *state, char_u *from, size_t len, char_u *to));
+void crypt_zip_decode __ARGS((cryptstate_T *state, char_u *from, size_t len, char_u *to));
+/* vim: set ft=c : */
diff --git a/src/proto/diff.pro b/src/proto/diff.pro
index 18c4265..3234fde 100644
--- a/src/proto/diff.pro
+++ b/src/proto/diff.pro
@@ -18,7 +18,7 @@ int diffopt_changed __ARGS((void));
int diffopt_horizontal __ARGS((void));
int diff_find_change __ARGS((win_T *wp, linenr_T lnum, int *startp, int *endp));
int diff_infold __ARGS((win_T *wp, linenr_T lnum));
-void nv_diffgetput __ARGS((int put));
+void nv_diffgetput __ARGS((int put, long count));
void ex_diffgetput __ARGS((exarg_T *eap));
int diff_mode_buf __ARGS((buf_T *buf));
int diff_move_to __ARGS((int dir, long count));
diff --git a/src/proto/ex_cmds.pro b/src/proto/ex_cmds.pro
index a94f5d0..8757637 100644
--- a/src/proto/ex_cmds.pro
+++ b/src/proto/ex_cmds.pro
@@ -44,6 +44,7 @@ void write_viminfo_sub_string __ARGS((FILE *fp));
void free_old_sub __ARGS((void));
int prepare_tagpreview __ARGS((int undo_sync));
void ex_help __ARGS((exarg_T *eap));
+void ex_helpclose __ARGS((exarg_T *eap));
char_u *check_help_lang __ARGS((char_u *arg));
int help_heuristic __ARGS((char_u *matched_string, int offset, int wrong_case));
int find_help_tags __ARGS((char_u *arg, int *num_matches, char_u ***matches, int keep_lang));
diff --git a/src/proto/fileio.pro b/src/proto/fileio.pro
index 7aa99cf..45e7b38 100644
--- a/src/proto/fileio.pro
+++ b/src/proto/fileio.pro
@@ -4,8 +4,6 @@ int readfile __ARGS((char_u *fname, char_u *sfname, linenr_T from, linenr_T line
int prep_exarg __ARGS((exarg_T *eap, buf_T *buf));
void set_file_options __ARGS((int set_options, exarg_T *eap));
void set_forced_fenc __ARGS((exarg_T *eap));
-int prepare_crypt_read __ARGS((FILE *fp));
-char_u *prepare_crypt_write __ARGS((buf_T *buf, int *lenp));
int check_file_readonly __ARGS((char_u *fname, int perm));
int buf_write __ARGS((buf_T *buf, char_u *fname, char_u *sfname, linenr_T start, linenr_T end, exarg_T *eap, int append, int forceit, int reset_changed, int filtering));
void msg_add_fname __ARGS((buf_T *buf, char_u *fname));
@@ -49,6 +47,8 @@ int has_cursormovedI __ARGS((void));
int has_textchanged __ARGS((void));
int has_textchangedI __ARGS((void));
int has_insertcharpre __ARGS((void));
+int has_cmdundefined __ARGS((void));
+int has_funcundefined __ARGS((void));
void block_autocmds __ARGS((void));
void unblock_autocmds __ARGS((void));
int is_autocmd_blocked __ARGS((void));
@@ -59,7 +59,6 @@ char_u *set_context_in_autocmd __ARGS((expand_T *xp, char_u *arg, int doautocmd)
char_u *get_event_name __ARGS((expand_T *xp, int idx));
int autocmd_supported __ARGS((char_u *name));
int au_exists __ARGS((char_u *arg));
-int match_file_pat __ARGS((char_u *pattern, regprog_T *prog, char_u *fname, char_u *sfname, char_u *tail, int allow_dirs));
int match_file_list __ARGS((char_u *list, char_u *sfname, char_u *ffname));
char_u *file_pat_to_reg_pat __ARGS((char_u *pat, char_u *pat_end, char *allow_dirs, int no_bslash));
long read_eintr __ARGS((int fd, void *buf, size_t bufsize));
diff --git a/src/proto/getchar.pro b/src/proto/getchar.pro
index 897cad3..e90b505 100644
--- a/src/proto/getchar.pro
+++ b/src/proto/getchar.pro
@@ -15,6 +15,7 @@ void AppendToRedobuffLit __ARGS((char_u *str, int len));
void AppendCharToRedobuff __ARGS((int c));
void AppendNumberToRedobuff __ARGS((long n));
void stuffReadbuff __ARGS((char_u *s));
+void stuffRedoReadbuff __ARGS((char_u *s));
void stuffReadbuffLen __ARGS((char_u *s, long len));
void stuffReadbuffSpec __ARGS((char_u *s));
void stuffcharReadbuff __ARGS((int c));
diff --git a/src/proto/gui_w32.pro b/src/proto/gui_w32.pro
index a333233..88fbf67 100644
--- a/src/proto/gui_w32.pro
+++ b/src/proto/gui_w32.pro
@@ -1,4 +1,6 @@
/* gui_w32.c */
+int directx_enabled __ARGS((void));
+int gui_mch_set_rendering_options __ARGS((char_u *s));
void gui_mch_set_blinking __ARGS((long wait, long on, long off));
void gui_mch_stop_blink __ARGS((void));
void gui_mch_start_blink __ARGS((void));
diff --git a/src/proto/misc2.pro b/src/proto/misc2.pro
index 4fd4573..b2f72d8 100644
--- a/src/proto/misc2.pro
+++ b/src/proto/misc2.pro
@@ -84,16 +84,6 @@ int illegal_slash __ARGS((char *name));
char_u *parse_shape_opt __ARGS((int what));
int get_shape_idx __ARGS((int mouse));
void update_mouseshape __ARGS((int shape_idx));
-int crypt_method_from_string __ARGS((char_u *s));
-int get_crypt_method __ARGS((buf_T *buf));
-void set_crypt_method __ARGS((buf_T *buf, int method));
-void crypt_push_state __ARGS((void));
-void crypt_pop_state __ARGS((void));
-void crypt_encode __ARGS((char_u *from, size_t len, char_u *to));
-void crypt_decode __ARGS((char_u *ptr, long len));
-void crypt_init_keys __ARGS((char_u *passwd));
-void free_crypt_key __ARGS((char_u *key));
-char_u *get_crypt_key __ARGS((int store, int twice));
void *vim_findfile_init __ARGS((char_u *path, char_u *filename, char_u *stopdirs, int level, int free_visited, int find_what, void *search_ctx_arg, int tagfile, char_u *rel_fname));
char_u *vim_findfile_stopdir __ARGS((char_u *buf));
void vim_findfile_cleanup __ARGS((void *ctx));
@@ -116,5 +106,6 @@ time_t get8ctime __ARGS((FILE *fd));
char_u *read_string __ARGS((FILE *fd, int cnt));
int put_bytes __ARGS((FILE *fd, long_u nr, int len));
void put_time __ARGS((FILE *fd, time_t the_time));
+void time_to_bytes __ARGS((time_t the_time, char_u *buf));
int has_non_ascii __ARGS((char_u *s));
/* vim: set ft=c : */
diff --git a/src/proto/option.pro b/src/proto/option.pro
index e426e6c..2fe05aa 100644
--- a/src/proto/option.pro
+++ b/src/proto/option.pro
@@ -62,5 +62,5 @@ int check_ff_value __ARGS((char_u *p));
long get_sw_value __ARGS((buf_T *buf));
long get_sts_value __ARGS((void));
void find_mps_values __ARGS((int *initc, int *findc, int *backwards, int switchit));
-int briopt_check __ARGS((void));
+unsigned int get_bkc_value __ARGS((buf_T *buf));
/* vim: set ft=c : */
diff --git a/src/proto/os_mswin.pro b/src/proto/os_mswin.pro
index 0d29979..b56ee56 100644
--- a/src/proto/os_mswin.pro
+++ b/src/proto/os_mswin.pro
@@ -21,6 +21,7 @@ int mch_has_wildcard __ARGS((char_u *p));
int mch_chdir __ARGS((char *path));
int can_end_termcap_mode __ARGS((int give_msg));
int mch_screenmode __ARGS((char_u *arg));
+int mch_icon_load __ARGS((HANDLE *iconp));
int mch_libcall __ARGS((char_u *libname, char_u *funcname, char_u *argstring, int argint, char_u **string_result, int *number_result));
void DumpPutS __ARGS((const char *psz));
int mch_get_winpos __ARGS((int *x, int *y));
diff --git a/src/proto/regexp.pro b/src/proto/regexp.pro
index a42c594..099121e 100644
--- a/src/proto/regexp.pro
+++ b/src/proto/regexp.pro
@@ -13,6 +13,7 @@ char_u *reg_submatch __ARGS((int no));
list_T *reg_submatch_list __ARGS((int no));
regprog_T *vim_regcomp __ARGS((char_u *expr_arg, int re_flags));
void vim_regfree __ARGS((regprog_T *prog));
+int vim_regexec_prog __ARGS((regprog_T **prog, int ignore_case, char_u *line, colnr_T col));
int vim_regexec __ARGS((regmatch_T *rmp, char_u *line, colnr_T col));
int vim_regexec_nl __ARGS((regmatch_T *rmp, char_u *line, colnr_T col));
long vim_regexec_multi __ARGS((regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum, colnr_T col, proftime_T *tm));
diff --git a/src/proto/term.pro b/src/proto/term.pro
index 89d58a0..b3d0df3 100644
--- a/src/proto/term.pro
+++ b/src/proto/term.pro
@@ -34,8 +34,6 @@ void set_shellsize __ARGS((int width, int height, int mustset));
void settmode __ARGS((int tmode));
void starttermcap __ARGS((void));
void stoptermcap __ARGS((void));
-int did_request_esc_sequence __ARGS((void));
-void resume_get_esc_sequence __ARGS((void));
void may_req_termresponse __ARGS((void));
void may_req_ambiguous_char_width __ARGS((void));
int swapping_screen __ARGS((void));
diff --git a/src/proto/ui.pro b/src/proto/ui.pro
index 234e99f..4100aa7 100644
--- a/src/proto/ui.pro
+++ b/src/proto/ui.pro
@@ -14,6 +14,8 @@ void clip_init __ARGS((int can_use));
void clip_update_selection __ARGS((VimClipboard *clip));
void clip_own_selection __ARGS((VimClipboard *cbd));
void clip_lose_selection __ARGS((VimClipboard *cbd));
+void start_global_changes __ARGS((void));
+void end_global_changes __ARGS((void));
void clip_auto_select __ARGS((void));
int clip_isautosel_star __ARGS((void));
int clip_isautosel_plus __ARGS((void));
diff --git a/src/regexp.c b/src/regexp.c
index dcb9a3b..d36ac49 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -358,6 +358,8 @@ static void regdump __ARGS((char_u *, bt_regprog_T *));
static char_u *regprop __ARGS((char_u *));
#endif
+static int re_mult_next __ARGS((char *what));
+
static char_u e_missingbracket[] = N_("E769: Missing ] after %s[");
static char_u e_unmatchedpp[] = N_("E53: Unmatched %s%%(");
static char_u e_unmatchedp[] = N_("E54: Unmatched %s(");
@@ -2166,9 +2168,13 @@ regatom(flagp)
#endif
case 's': ret = regnode(MOPEN + 0);
+ if (re_mult_next("\\zs") == FAIL)
+ return NULL;
break;
case 'e': ret = regnode(MCLOSE + 0);
+ if (re_mult_next("\\ze") == FAIL)
+ return NULL;
break;
default: EMSG_RET_NULL(_("E68: Invalid character after \\z"));
@@ -3733,7 +3739,7 @@ static int bt_regexec_nl __ARGS((regmatch_T *rmp, char_u *line, colnr_T col, in
* Uses curbuf for line count and 'iskeyword'.
* if "line_lbr" is TRUE consider a "\n" in "line" to be a line break.
*
- * Return TRUE if there is a match, FALSE if not.
+ * Returns 0 for failure, number of lines contained in the match otherwise.
*/
static int
bt_regexec_nl(rmp, line, col, line_lbr)
@@ -3753,7 +3759,8 @@ bt_regexec_nl(rmp, line, col, line_lbr)
ireg_icombine = FALSE;
#endif
ireg_maxcol = 0;
- return (bt_regexec_both(line, col, NULL) != 0);
+
+ return bt_regexec_both(line, col, NULL);
}
static long bt_regexec_multi __ARGS((regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum, colnr_T col, proftime_T *tm));
@@ -3775,8 +3782,6 @@ bt_regexec_multi(rmp, win, buf, lnum, col, tm)
colnr_T col; /* column to start looking for match */
proftime_T *tm; /* timeout limit or NULL */
{
- long r;
-
reg_match = NULL;
reg_mmatch = rmp;
reg_buf = buf;
@@ -3790,14 +3795,13 @@ bt_regexec_multi(rmp, win, buf, lnum, col, tm)
#endif
ireg_maxcol = rmp->rmm_maxcol;
- r = bt_regexec_both(NULL, col, tm);
-
- return r;
+ return bt_regexec_both(NULL, col, tm);
}
/*
* Match a regexp against a string ("line" points to the string) or multiple
* lines ("line" is NULL, use reg_getline()).
+ * Returns 0 for failure, number of lines contained in the match otherwise.
*/
static long
bt_regexec_both(line, col, tm)
@@ -3805,9 +3809,9 @@ bt_regexec_both(line, col, tm)
colnr_T col; /* column to start looking for match */
proftime_T *tm UNUSED; /* timeout limit or NULL */
{
- bt_regprog_T *prog;
- char_u *s;
- long retval = 0L;
+ bt_regprog_T *prog;
+ char_u *s;
+ long retval = 0L;
/* Create "regstack" and "backpos" if they are not allocated yet.
* We allocate *_INITIAL amount of bytes first and then set the grow size
@@ -7005,6 +7009,18 @@ regprop(op)
}
#endif /* DEBUG */
+/*
+ * Used in a place where no * or \+ can follow.
+ */
+ static int
+re_mult_next(what)
+ char *what;
+{
+ if (re_multi_type(peekchr()) == MULTI_MULT)
+ EMSG2_RET_FAIL(_("E888: (NFA regexp) cannot repeat %s"), what);
+ return OK;
+}
+
#ifdef FEAT_MBYTE
static void mb_decompose __ARGS((int c, int *c1, int *c2, int *c3));
@@ -7993,13 +8009,10 @@ static regengine_T bt_regengine =
bt_regcomp,
bt_regfree,
bt_regexec_nl,
- bt_regexec_multi
-#ifdef DEBUG
- ,(char_u *)""
-#endif
+ bt_regexec_multi,
+ (char_u *)""
};
-
#include "regexp_nfa.c"
static regengine_T nfa_regengine =
@@ -8007,18 +8020,14 @@ static regengine_T nfa_regengine =
nfa_regcomp,
nfa_regfree,
nfa_regexec_nl,
- nfa_regexec_multi
-#ifdef DEBUG
- ,(char_u *)""
-#endif
+ nfa_regexec_multi,
+ (char_u *)""
};
/* Which regexp engine to use? Needed for vim_regcomp().
* Must match with 'regexpengine'. */
static int regexp_engine = 0;
-#define AUTOMATIC_ENGINE 0
-#define BACKTRACKING_ENGINE 1
-#define NFA_ENGINE 2
+
#ifdef DEBUG
static char_u regname[][30] = {
"AUTOMATIC Regexp Engine",
@@ -8065,10 +8074,8 @@ vim_regcomp(expr_arg, re_flags)
regexp_engine = AUTOMATIC_ENGINE;
}
}
-#ifdef DEBUG
bt_regengine.expr = expr;
nfa_regengine.expr = expr;
-#endif
/*
* First try the NFA engine, unless backtracking was requested.
@@ -8078,7 +8085,8 @@ vim_regcomp(expr_arg, re_flags)
else
prog = bt_regengine.regcomp(expr, re_flags);
- if (prog == NULL) /* error compiling regexp with initial engine */
+ /* Check for error compiling regexp with initial engine. */
+ if (prog == NULL)
{
#ifdef BT_REGEXP_DEBUG_LOG
if (regexp_engine != BACKTRACKING_ENGINE) /* debugging log for NFA */
@@ -8096,13 +8104,27 @@ vim_regcomp(expr_arg, re_flags)
}
#endif
/*
- * If the NFA engine failed, the backtracking engine won't work either.
+ * If the NFA engine failed, try the backtracking engine.
+ * Disabled for now, both engines fail on the same patterns.
+ * Re-enable when regcomp() fails when the pattern would work better
+ * with the other engine.
*
if (regexp_engine == AUTOMATIC_ENGINE)
+ {
prog = bt_regengine.regcomp(expr, re_flags);
+ regexp_engine == BACKTRACKING_ENGINE;
+ }
*/
}
+ if (prog != NULL)
+ {
+ /* Store the info needed to call regcomp() again when the engine turns
+ * out to be very slow when executing it. */
+ prog->re_engine = regexp_engine;
+ prog->re_flags = re_flags;
+ }
+
return prog;
}
@@ -8117,40 +8139,124 @@ vim_regfree(prog)
prog->engine->regfree(prog);
}
+#ifdef FEAT_EVAL
+static void report_re_switch __ARGS((char_u *pat));
+
+ static void
+report_re_switch(pat)
+ char_u *pat;
+{
+ if (p_verbose > 0)
+ {
+ verbose_enter();
+ MSG_PUTS(_("Switching to backtracking RE engine for pattern: "));
+ MSG_PUTS(pat);
+ verbose_leave();
+ }
+}
+#endif
+
+static int vim_regexec_both __ARGS((regmatch_T *rmp, char_u *line, colnr_T col, int nl));
+
/*
* Match a regexp against a string.
* "rmp->regprog" is a compiled regexp as returned by vim_regcomp().
+ * Note: "rmp->regprog" may be freed and changed.
* Uses curbuf for line count and 'iskeyword'.
+ * When "nl" is TRUE consider a "\n" in "line" to be a line break.
*
* Return TRUE if there is a match, FALSE if not.
*/
+ static int
+vim_regexec_both(rmp, line, col, nl)
+ regmatch_T *rmp;
+ char_u *line; /* string to match against */
+ colnr_T col; /* column to start looking for match */
+ int nl;
+{
+ int result = rmp->regprog->engine->regexec_nl(rmp, line, col, nl);
+
+ /* NFA engine aborted because it's very slow. */
+ if (rmp->regprog->re_engine == AUTOMATIC_ENGINE
+ && result == NFA_TOO_EXPENSIVE)
+ {
+ int save_p_re = p_re;
+ int re_flags = rmp->regprog->re_flags;
+ char_u *pat = vim_strsave(((nfa_regprog_T *)rmp->regprog)->pattern);
+
+ p_re = BACKTRACKING_ENGINE;
+ vim_regfree(rmp->regprog);
+ if (pat != NULL)
+ {
+#ifdef FEAT_EVAL
+ report_re_switch(pat);
+#endif
+ rmp->regprog = vim_regcomp(pat, re_flags);
+ if (rmp->regprog != NULL)
+ result = rmp->regprog->engine->regexec_nl(rmp, line, col, nl);
+ vim_free(pat);
+ }
+
+ p_re = save_p_re;
+ }
+ return result > 0;
+}
+
+/*
+ * Note: "*prog" may be freed and changed.
+ * Return TRUE if there is a match, FALSE if not.
+ */
+ int
+vim_regexec_prog(prog, ignore_case, line, col)
+ regprog_T **prog;
+ int ignore_case;
+ char_u *line;
+ colnr_T col;
+{
+ int r;
+ regmatch_T regmatch;
+
+ regmatch.regprog = *prog;
+ regmatch.rm_ic = ignore_case;
+ r = vim_regexec_both(&regmatch, line, col, FALSE);
+ *prog = regmatch.regprog;
+ return r;
+}
+
+/*
+ * Note: "rmp->regprog" may be freed and changed.
+ * Return TRUE if there is a match, FALSE if not.
+ */
int
vim_regexec(rmp, line, col)
- regmatch_T *rmp;
- char_u *line; /* string to match against */
- colnr_T col; /* column to start looking for match */
+ regmatch_T *rmp;
+ char_u *line;
+ colnr_T col;
{
- return rmp->regprog->engine->regexec_nl(rmp, line, col, FALSE);
+ return vim_regexec_both(rmp, line, col, FALSE);
}
#if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) \
|| defined(FIND_REPLACE_DIALOG) || defined(PROTO)
/*
* Like vim_regexec(), but consider a "\n" in "line" to be a line break.
+ * Note: "rmp->regprog" may be freed and changed.
+ * Return TRUE if there is a match, FALSE if not.
*/
int
vim_regexec_nl(rmp, line, col)
- regmatch_T *rmp;
- char_u *line;
- colnr_T col;
+ regmatch_T *rmp;
+ char_u *line;
+ colnr_T col;
{
- return rmp->regprog->engine->regexec_nl(rmp, line, col, TRUE);
+ return vim_regexec_both(rmp, line, col, TRUE);
}
#endif
/*
* Match a regexp against multiple lines.
* "rmp->regprog" is a compiled regexp as returned by vim_regcomp().
+ * Note: "rmp->regprog" may be freed and changed.
* Uses curbuf for line count and 'iskeyword'.
*
* Return zero if there is no match. Return number of lines contained in the
@@ -8165,5 +8271,32 @@ vim_regexec_multi(rmp, win, buf, lnum, col, tm)
colnr_T col; /* column to start looking for match */
proftime_T *tm; /* timeout limit or NULL */
{
- return rmp->regprog->engine->regexec_multi(rmp, win, buf, lnum, col, tm);
+ int result = rmp->regprog->engine->regexec_multi(
+ rmp, win, buf, lnum, col, tm);
+
+ /* NFA engine aborted because it's very slow. */
+ if (rmp->regprog->re_engine == AUTOMATIC_ENGINE
+ && result == NFA_TOO_EXPENSIVE)
+ {
+ int save_p_re = p_re;
+ int re_flags = rmp->regprog->re_flags;
+ char_u *pat = vim_strsave(((nfa_regprog_T *)rmp->regprog)->pattern);
+
+ p_re = BACKTRACKING_ENGINE;
+ vim_regfree(rmp->regprog);
+ if (pat != NULL)
+ {
+#ifdef FEAT_EVAL
+ report_re_switch(pat);
+#endif
+ rmp->regprog = vim_regcomp(pat, re_flags);
+ if (rmp->regprog != NULL)
+ result = rmp->regprog->engine->regexec_multi(
+ rmp, win, buf, lnum, col, tm);
+ vim_free(pat);
+ }
+ p_re = save_p_re;
+ }
+
+ return result <= 0 ? 0 : result;
}
diff --git a/src/regexp.h b/src/regexp.h
index cd619da..6617cd2 100644
--- a/src/regexp.h
+++ b/src/regexp.h
@@ -27,6 +27,18 @@
*/
#define NFA_MAX_BRACES 20
+/*
+ * In the NFA engine: how many states are allowed
+ */
+#define NFA_MAX_STATES 100000
+#define NFA_TOO_EXPENSIVE -1
+
+/* Which regexp engine to use? Needed for vim_regcomp().
+ * Must match with 'regexpengine'. */
+#define AUTOMATIC_ENGINE 0
+#define BACKTRACKING_ENGINE 1
+#define NFA_ENGINE 2
+
typedef struct regengine regengine_T;
/*
@@ -38,6 +50,8 @@ typedef struct regprog
{
regengine_T *engine;
unsigned regflags;
+ unsigned re_engine; /* automatic, backtracking or nfa engine */
+ unsigned re_flags; /* second argument for vim_regcomp() */
} regprog_T;
/*
@@ -47,9 +61,11 @@ typedef struct regprog
*/
typedef struct
{
- /* These two members implement regprog_T */
+ /* These four members implement regprog_T */
regengine_T *engine;
unsigned regflags;
+ unsigned re_engine;
+ unsigned re_flags; /* second argument for vim_regcomp() */
int regstart;
char_u reganch;
@@ -81,9 +97,11 @@ struct nfa_state
*/
typedef struct
{
- /* These two members implement regprog_T */
+ /* These three members implement regprog_T */
regengine_T *engine;
unsigned regflags;
+ unsigned re_engine;
+ unsigned re_flags; /* second argument for vim_regcomp() */
nfa_state_T *start; /* points into state[] */
@@ -96,9 +114,7 @@ typedef struct
#ifdef FEAT_SYN_HL
int reghasz;
#endif
-#ifdef DEBUG
char_u *pattern;
-#endif
int nsubexp; /* number of () */
int nstate;
nfa_state_T state[1]; /* actually longer.. */
@@ -151,9 +167,7 @@ struct regengine
void (*regfree)(regprog_T *);
int (*regexec_nl)(regmatch_T*, char_u*, colnr_T, int);
long (*regexec_multi)(regmmatch_T*, win_T*, buf_T*, linenr_T, colnr_T, proftime_T*);
-#ifdef DEBUG
char_u *expr;
-#endif
};
#endif /* _REGEXP_H */
diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c
index a7fbe7b..8e069f3 100644
--- a/src/regexp_nfa.c
+++ b/src/regexp_nfa.c
@@ -1323,10 +1323,14 @@ nfa_regatom()
{
case 's':
EMIT(NFA_ZSTART);
+ if (re_mult_next("\\zs") == FAIL)
+ return FAIL;
break;
case 'e':
EMIT(NFA_ZEND);
nfa_has_zend = TRUE;
+ if (re_mult_next("\\ze") == FAIL)
+ return FAIL;
break;
#ifdef FEAT_SYN_HL
case '1':
@@ -4403,7 +4407,6 @@ skip_add:
switch (state->c)
{
case NFA_MATCH:
-// nfa_match = TRUE;
break;
case NFA_SPLIT:
@@ -5519,6 +5522,13 @@ nfa_regmatch(prog, start, submatch, m)
nextlist->n = 0; /* clear nextlist */
nextlist->has_pim = FALSE;
++nfa_listid;
+ if (prog->re_engine == AUTOMATIC_ENGINE && nfa_listid >= NFA_MAX_STATES)
+ {
+ /* too many states, retry with old engine */
+ nfa_match = NFA_TOO_EXPENSIVE;
+ goto theend;
+ }
+
thislist->id = nfa_listid;
nextlist->id = nfa_listid + 1;
@@ -5701,6 +5711,11 @@ nfa_regmatch(prog, start, submatch, m)
*/
result = recursive_regmatch(t->state, NULL, prog,
submatch, m, &listids);
+ if (result == NFA_TOO_EXPENSIVE)
+ {
+ nfa_match = result;
+ goto theend;
+ }
/* for \@! and \@<! it is a match when the result is
* FALSE */
@@ -5814,6 +5829,11 @@ nfa_regmatch(prog, start, submatch, m)
/* First try matching the pattern. */
result = recursive_regmatch(t->state, NULL, prog,
submatch, m, &listids);
+ if (result == NFA_TOO_EXPENSIVE)
+ {
+ nfa_match = result;
+ goto theend;
+ }
if (result)
{
int bytelen;
@@ -6747,7 +6767,7 @@ theend:
/*
* Try match of "prog" with at regline["col"].
- * Returns 0 for failure, number of lines contained in the match otherwise.
+ * Returns <= 0 for failure, number of lines contained in the match otherwise.
*/
static long
nfa_regtry(prog, col)
@@ -6757,6 +6777,7 @@ nfa_regtry(prog, col)
int i;
regsubs_T subs, m;
nfa_state_T *start = prog->start;
+ int result;
#ifdef ENABLE_LOG
FILE *f;
#endif
@@ -6788,8 +6809,11 @@ nfa_regtry(prog, col)
clear_sub(&m.synt);
#endif
- if (nfa_regmatch(prog, start, &subs, &m) == FALSE)
+ result = nfa_regmatch(prog, start, &subs, &m);
+ if (result == FALSE)
return 0;
+ else if (result == NFA_TOO_EXPENSIVE)
+ return result;
cleanup_subexpr();
if (REG_MULTI)
@@ -6873,7 +6897,7 @@ nfa_regtry(prog, col)
* Match a regexp against a string ("line" points to the string) or multiple
* lines ("line" is NULL, use reg_getline()).
*
- * Returns 0 for failure, number of lines contained in the match otherwise.
+ * Returns <= 0 for failure, number of lines contained in the match otherwise.
*/
static long
nfa_regexec_both(line, startcol)
@@ -6926,9 +6950,7 @@ nfa_regexec_both(line, startcol)
nfa_nsubexpr = prog->nsubexp;
nfa_listid = 1;
nfa_alt_listid = 2;
-#ifdef DEBUG
nfa_regengine.expr = prog->pattern;
-#endif
if (prog->reganch && col > 0)
return 0L;
@@ -6976,9 +6998,7 @@ nfa_regexec_both(line, startcol)
retval = nfa_regtry(prog, col);
-#ifdef DEBUG
nfa_regengine.expr = NULL;
-#endif
theend:
return retval;
@@ -7000,9 +7020,7 @@ nfa_regcomp(expr, re_flags)
if (expr == NULL)
return NULL;
-#ifdef DEBUG
nfa_regengine.expr = expr;
-#endif
init_class_tab();
@@ -7079,10 +7097,8 @@ nfa_regcomp(expr, re_flags)
/* Remember whether this pattern has any \z specials in it. */
prog->reghasz = re_has_z;
#endif
-#ifdef DEBUG
prog->pattern = vim_strsave(expr);
nfa_regengine.expr = NULL;
-#endif
out:
vim_free(post_start);
@@ -7096,9 +7112,7 @@ fail:
#ifdef ENABLE_LOG
nfa_postfix_dump(expr, FAIL);
#endif
-#ifdef DEBUG
nfa_regengine.expr = NULL;
-#endif
goto out;
}
@@ -7112,9 +7126,7 @@ nfa_regfree(prog)
if (prog != NULL)
{
vim_free(((nfa_regprog_T *)prog)->match_text);
-#ifdef DEBUG
vim_free(((nfa_regprog_T *)prog)->pattern);
-#endif
vim_free(prog);
}
}
@@ -7125,7 +7137,7 @@ nfa_regfree(prog)
* Uses curbuf for line count and 'iskeyword'.
* If "line_lbr" is TRUE consider a "\n" in "line" to be a line break.
*
- * Return TRUE if there is a match, FALSE if not.
+ * Returns <= 0 for failure, number of lines contained in the match otherwise.
*/
static int
nfa_regexec_nl(rmp, line, col, line_lbr)
@@ -7145,7 +7157,7 @@ nfa_regexec_nl(rmp, line, col, line_lbr)
ireg_icombine = FALSE;
#endif
ireg_maxcol = 0;
- return (nfa_regexec_both(line, col) != 0);
+ return nfa_regexec_both(line, col);
}
@@ -7154,7 +7166,7 @@ nfa_regexec_nl(rmp, line, col, line_lbr)
* "rmp->regprog" is a compiled regexp as returned by vim_regcomp().
* Uses curbuf for line count and 'iskeyword'.
*
- * Return zero if there is no match. Return number of lines contained in the
+ * Return <= 0 if there is no match. Return number of lines contained in the
* match otherwise.
*
* Note: the body is the same as bt_regexec() except for nfa_regexec_both()
diff --git a/src/screen.c b/src/screen.c
index bb89f50..8209802 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -1584,9 +1584,17 @@ win_update(wp)
*/
if (VIsual_mode == Ctrl_V)
{
- colnr_T fromc, toc;
+ colnr_T fromc, toc;
+#if defined(FEAT_VIRTUALEDIT) && defined(FEAT_LINEBREAK)
+ int save_ve_flags = ve_flags;
+ if (curwin->w_p_lbr)
+ ve_flags = VE_ALL;
+#endif
getvcols(wp, &VIsual, &curwin->w_cursor, &fromc, &toc);
+#if defined(FEAT_VIRTUALEDIT) && defined(FEAT_LINEBREAK)
+ ve_flags = save_ve_flags;
+#endif
++toc;
if (curwin->w_curswant == MAXCOL)
toc = MAXCOL;
@@ -3702,7 +3710,12 @@ win_line(wp, lnum, startrow, endrow, nochange)
char_attr = 0; /* was: hl_attr(HLF_AT); */
#ifdef FEAT_DIFF
if (diff_hlf != (hlf_T)0)
+ {
char_attr = hl_attr(diff_hlf);
+ if (wp->w_p_cul && lnum == wp->w_cursor.lnum)
+ char_attr = hl_combine_attr(char_attr,
+ hl_attr(HLF_CUL));
+ }
#endif
p_extra = NULL;
c_extra = ' ';
@@ -3753,7 +3766,8 @@ win_line(wp, lnum, startrow, endrow, nochange)
#ifdef FEAT_SYN_HL
/* combine 'showbreak' with 'cursorline' */
if (wp->w_p_cul && lnum == wp->w_cursor.lnum)
- char_attr = hl_combine_attr(char_attr, HLF_CLN);
+ char_attr = hl_combine_attr(char_attr,
+ hl_attr(HLF_CUL));
#endif
}
# endif
@@ -3852,7 +3866,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
{
shl->attr_cur = shl->attr;
}
- else if (v >= (long)shl->endcol)
+ else if (v >= (long)shl->endcol && shl->lnum == lnum)
{
shl->attr_cur = 0;
next_search_hl(wp, shl, lnum, (colnr_T)v, cur);
@@ -3931,6 +3945,8 @@ win_line(wp, lnum, startrow, endrow, nochange)
&& n_extra == 0)
diff_hlf = HLF_CHD; /* changed line */
line_attr = hl_attr(diff_hlf);
+ if (wp->w_p_cul && lnum == wp->w_cursor.lnum)
+ line_attr = hl_combine_attr(line_attr, hl_attr(HLF_CUL));
}
#endif
@@ -4440,6 +4456,10 @@ win_line(wp, lnum, startrow, endrow, nochange)
/* TODO: is passing p for start of the line OK? */
n_extra = win_lbr_chartabsize(wp, line, p, (colnr_T)vcol,
NULL) - 1;
+ if (c == TAB && n_extra + col > W_WIDTH(wp))
+ n_extra = (int)wp->w_buffer->b_p_ts
+ - vcol % (int)wp->w_buffer->b_p_ts - 1;
+
c_extra = ' ';
if (vim_iswhite(c))
{
@@ -4494,7 +4514,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
tab_len = (int)wp->w_buffer->b_p_ts
- vcol % (int)wp->w_buffer->b_p_ts - 1;
#ifdef FEAT_LINEBREAK
- if (!wp->w_p_lbr)
+ if (!wp->w_p_lbr || !wp->w_p_list)
#endif
/* tab amount depends on current column */
n_extra = tab_len;
@@ -4506,6 +4526,11 @@ win_line(wp, lnum, startrow, endrow, nochange)
int i;
int saved_nextra = n_extra;
+#ifdef FEAT_CONCEAL
+ if (is_concealing && vcol_off > 0)
+ /* there are characters to conceal */
+ tab_len += vcol_off;
+#endif
/* if n_extra > 0, it gives the number of chars, to
* use for a tab, else we need to calculate the width
* for a tab */
@@ -4531,6 +4556,12 @@ win_line(wp, lnum, startrow, endrow, nochange)
#endif
}
p_extra = p_extra_free;
+#ifdef FEAT_CONCEAL
+ /* n_extra will be increased by FIX_FOX_BOGUSCOLS
+ * macro below, so need to adjust for that here */
+ if (is_concealing && vcol_off > 0)
+ n_extra -= vcol_off;
+#endif
}
#endif
#ifdef FEAT_CONCEAL
@@ -4729,7 +4760,12 @@ win_line(wp, lnum, startrow, endrow, nochange)
{
diff_hlf = HLF_CHD;
if (attr == 0 || char_attr != attr)
+ {
char_attr = hl_attr(diff_hlf);
+ if (wp->w_p_cul && lnum == wp->w_cursor.lnum)
+ char_attr = hl_combine_attr(char_attr,
+ hl_attr(HLF_CUL));
+ }
}
# endif
}
@@ -4874,6 +4910,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
* special character (via 'listchars' option "precedes:<char>".
*/
if (lcs_prec_todo != NUL
+ && wp->w_p_list
&& (wp->w_p_wrap ? wp->w_skipcol > 0 : wp->w_leftcol > 0)
#ifdef FEAT_DIFF
&& filler_todo <= 0
@@ -7564,6 +7601,12 @@ next_search_hl(win, shl, lnum, mincol, cur)
shl->lnum = lnum;
if (shl->rm.regprog != NULL)
{
+ /* Remember whether shl->rm is using a copy of the regprog in
+ * cur->match. */
+ int regprog_is_copy = (shl != &search_hl && cur != NULL
+ && shl == &cur->hl
+ && cur->match.regprog == cur->hl.rm.regprog);
+
nmatched = vim_regexec_multi(&shl->rm, win, shl->buf, lnum,
matchcol,
#ifdef FEAT_RELTIME
@@ -7572,6 +7615,10 @@ next_search_hl(win, shl, lnum, mincol, cur)
NULL
#endif
);
+ /* Copy the regprog, in case it got freed and recompiled. */
+ if (regprog_is_copy)
+ cur->match.regprog = cur->hl.rm.regprog;
+
if (called_emsg || got_int)
{
/* Error while handling regexp: stop using this regexp. */
@@ -10203,9 +10250,9 @@ draw_tabline()
break;
screen_puts_len(NameBuff, len, 0, col,
#if defined(FEAT_SYN_HL)
- hl_combine_attr(attr, hl_attr(HLF_T))
+ hl_combine_attr(attr, hl_attr(HLF_T))
#else
- attr
+ attr
#endif
);
col += len;
diff --git a/src/search.c b/src/search.c
index fc3a2d7..557d833 100644
--- a/src/search.c
+++ b/src/search.c
@@ -561,6 +561,7 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum, tm)
int match_ok;
long nmatched;
int submatch = 0;
+ int first_match = TRUE;
int save_called_emsg = called_emsg;
#ifdef FEAT_SEARCH_EXTRA
int break_loop = FALSE;
@@ -574,33 +575,33 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum, tm)
return FAIL;
}
- /* When not accepting a match at the start position set "extra_col" to a
- * non-zero value. Don't do that when starting at MAXCOL, since MAXCOL +
- * 1 is zero. */
- if ((options & SEARCH_START) || pos->col == MAXCOL)
- extra_col = 0;
-#ifdef FEAT_MBYTE
- /* Watch out for the "col" being MAXCOL - 2, used in a closed fold. */
- else if (dir != BACKWARD && has_mbyte
- && pos->lnum >= 1 && pos->lnum <= buf->b_ml.ml_line_count
- && pos->col < MAXCOL - 2)
- {
- ptr = ml_get_buf(buf, pos->lnum, FALSE) + pos->col;
- if (*ptr == NUL)
- extra_col = 1;
- else
- extra_col = (*mb_ptr2len)(ptr);
- }
-#endif
- else
- extra_col = 1;
-
/*
* find the string
*/
called_emsg = FALSE;
do /* loop for count */
{
+ /* When not accepting a match at the start position set "extra_col" to
+ * a non-zero value. Don't do that when starting at MAXCOL, since
+ * MAXCOL + 1 is zero. */
+ if ((options & SEARCH_START) || pos->col == MAXCOL)
+ extra_col = 0;
+#ifdef FEAT_MBYTE
+ /* Watch out for the "col" being MAXCOL - 2, used in a closed fold. */
+ else if (dir != BACKWARD && has_mbyte
+ && pos->lnum >= 1 && pos->lnum <= buf->b_ml.ml_line_count
+ && pos->col < MAXCOL - 2)
+ {
+ ptr = ml_get_buf(buf, pos->lnum, FALSE) + pos->col;
+ if (*ptr == NUL)
+ extra_col = 1;
+ else
+ extra_col = (*mb_ptr2len)(ptr);
+ }
+#endif
+ else
+ extra_col = 1;
+
start_pos = *pos; /* remember start pos for detecting no match */
found = 0; /* default: not found */
at_first_line = TRUE; /* default: start in first line */
@@ -686,7 +687,7 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum, tm)
* otherwise "/$" will get stuck on end of line.
*/
while (matchpos.lnum == 0
- && ((options & SEARCH_END)
+ && ((options & SEARCH_END) && first_match
? (nmatched == 1
&& (int)endpos.col - 1
< (int)start_pos.col + extra_col)
@@ -917,6 +918,7 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum, tm)
pos->coladd = 0;
#endif
found = 1;
+ first_match = FALSE;
/* Set variables used for 'incsearch' highlighting. */
search_match_lines = endpos.lnum - matchpos.lnum;
diff --git a/src/spell.c b/src/spell.c
index 5063642..9d7f933 100644
--- a/src/spell.c
+++ b/src/spell.c
@@ -1154,11 +1154,14 @@ spell_check(wp, ptr, attrp, capcol, docount)
if (capcol != NULL && wp->w_s->b_cap_prog != NULL)
{
regmatch_T regmatch;
+ int r;
/* Check for end of sentence. */
regmatch.regprog = wp->w_s->b_cap_prog;
regmatch.rm_ic = FALSE;
- if (vim_regexec(&regmatch, ptr, 0))
+ r = vim_regexec(&regmatch, ptr, 0);
+ wp->w_s->b_cap_prog = regmatch.regprog;
+ if (r)
*capcol = (int)(regmatch.endp[0] - ptr);
}
@@ -1786,7 +1789,6 @@ can_compound(slang, word, flags)
char_u *word;
char_u *flags;
{
- regmatch_T regmatch;
#ifdef FEAT_MBYTE
char_u uflags[MAXWLEN * 2];
int i;
@@ -1808,9 +1810,7 @@ can_compound(slang, word, flags)
else
#endif
p = flags;
- regmatch.regprog = slang->sl_compprog;
- regmatch.rm_ic = FALSE;
- if (!vim_regexec(&regmatch, p, 0))
+ if (!vim_regexec_prog(&slang->sl_compprog, FALSE, p, 0))
return FALSE;
/* Count the number of syllables. This may be slow, do it last. If there
@@ -1930,8 +1930,7 @@ valid_word_prefix(totprefcnt, arridx, flags, word, slang, cond_req)
{
int prefcnt;
int pidx;
- regprog_T *rp;
- regmatch_T regmatch;
+ regprog_T **rp;
int prefid;
prefid = (unsigned)flags >> 24;
@@ -1950,12 +1949,10 @@ valid_word_prefix(totprefcnt, arridx, flags, word, slang, cond_req)
/* Check the condition, if there is one. The condition index is
* stored in the two bytes above the prefix ID byte. */
- rp = slang->sl_prefprog[((unsigned)pidx >> 8) & 0xffff];
- if (rp != NULL)
+ rp = &slang->sl_prefprog[((unsigned)pidx >> 8) & 0xffff];
+ if (*rp != NULL)
{
- regmatch.regprog = rp;
- regmatch.rm_ic = FALSE;
- if (!vim_regexec(&regmatch, word, 0))
+ if (!vim_regexec_prog(rp, FALSE, word, 0))
continue;
}
else if (cond_req)
@@ -4841,6 +4838,7 @@ typedef struct afffile_S
unsigned af_nosuggest; /* NOSUGGEST ID */
int af_pfxpostpone; /* postpone prefixes without chop string and
without flags */
+ int af_ignoreextra; /* IGNOREEXTRA present */
hashtab_T af_pref; /* hashtable for prefixes, affheader_T */
hashtab_T af_suff; /* hashtable for suffixes, affheader_T */
hashtab_T af_comp; /* hashtable for compound flags, compitem_T */
@@ -5605,6 +5603,10 @@ spell_read_aff(spin, fname)
{
aff->af_pfxpostpone = TRUE;
}
+ else if (is_aff_rule(items, itemcnt, "IGNOREEXTRA", 1))
+ {
+ aff->af_ignoreextra = TRUE;
+ }
else if ((STRCMP(items[0], "PFX") == 0
|| STRCMP(items[0], "SFX") == 0)
&& aff_todo == 0
@@ -5712,9 +5714,11 @@ spell_read_aff(spin, fname)
int lasti = 5;
/* Myspell allows extra text after the item, but that might
- * mean mistakes go unnoticed. Require a comment-starter.
- * Hunspell uses a "-" item. */
- if (itemcnt > lasti && *items[lasti] != '#'
+ * mean mistakes go unnoticed. Require a comment-starter,
+ * unless IGNOREEXTRA is used. Hunspell uses a "-" item. */
+ if (itemcnt > lasti
+ && !aff->af_ignoreextra
+ && *items[lasti] != '#'
&& (STRCMP(items[lasti], "-") != 0
|| itemcnt != lasti + 1))
smsg((char_u *)_(e_afftrailing), fname, lnum, items[lasti]);
@@ -6896,7 +6900,6 @@ store_aff_word(spin, word, afflist, affile, ht, xht, condit, flags,
hashitem_T *hi;
affheader_T *ah;
affentry_T *ae;
- regmatch_T regmatch;
char_u newword[MAXWLEN];
int retval = OK;
int i, j;
@@ -6937,15 +6940,14 @@ store_aff_word(spin, word, afflist, affile, ht, xht, condit, flags,
* When a previously added affix had CIRCUMFIX this one
* must have it too, if it had not then this one must not
* have one either. */
- regmatch.regprog = ae->ae_prog;
- regmatch.rm_ic = FALSE;
if ((xht != NULL || !affile->af_pfxpostpone
|| ae->ae_chop != NULL
|| ae->ae_flags != NULL)
&& (ae->ae_chop == NULL
|| STRLEN(ae->ae_chop) < wordlen)
&& (ae->ae_prog == NULL
- || vim_regexec(&regmatch, word, (colnr_T)0))
+ || vim_regexec_prog(&ae->ae_prog, FALSE,
+ word, (colnr_T)0))
&& (((condit & CONDIT_CFIX) == 0)
== ((condit & CONDIT_AFF) == 0
|| ae->ae_flags == NULL
@@ -10471,6 +10473,7 @@ check_need_cap(lnum, col)
break;
}
}
+ curwin->w_s->b_cap_prog = regmatch.regprog;
}
vim_free(line_copy);
diff --git a/src/structs.h b/src/structs.h
index a06c855..1a79a0e 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -137,7 +137,7 @@ typedef struct
#ifdef FEAT_LINEBREAK
int wo_bri;
# define w_p_bri w_onebuf_opt.wo_bri /* 'breakindent' */
- char_u *wo_briopt;
+ char_u *wo_briopt;
# define w_p_briopt w_onebuf_opt.wo_briopt /* 'breakindentopt' */
#endif
#ifdef FEAT_DIFF
@@ -1251,6 +1251,24 @@ typedef struct {
} syn_time_T;
#endif
+#ifdef FEAT_CRYPT
+/*
+ * Structure to hold the type of encryption and the state of encryption or
+ * decryption.
+ */
+typedef struct {
+ int method_nr;
+ void *method_state; /* method-specific state information */
+} cryptstate_T;
+
+/* values for method_nr */
+# define CRYPT_M_ZIP 0
+# define CRYPT_M_BF 1
+# define CRYPT_M_BF2 2
+# define CRYPT_M_COUNT 3 /* number of crypt methods */
+#endif
+
+
/*
* These are items normally related to a buffer. But when using ":ownsyntax"
* a window may have its own instance.
@@ -1519,6 +1537,8 @@ struct file_buffer
int b_p_ai; /* 'autoindent' */
int b_p_ai_nopaste; /* b_p_ai saved for paste mode */
+ char_u *b_p_bkc; /* 'backupcopy' */
+ unsigned b_bkc_flags; /* flags for 'backupcopy' */
int b_p_ci; /* 'copyindent' */
int b_p_bin; /* 'binary' */
#ifdef FEAT_MBYTE
@@ -1781,12 +1801,17 @@ struct file_buffer
int b_was_netbeans_file;/* TRUE if b_netbeans_file was once set */
#endif
+#ifdef FEAT_CRYPT
+ cryptstate_T *b_cryptstate; /* Encryption state while reading or writing
+ * the file. NULL when not using encryption. */
+#endif
+
#ifdef FEAT_ODB_EDITOR
uint32_t b_odb_server_id; /* FourCC of the ODB server (0 if none) */
void *b_odb_token; /* NSAppleEventDescriptor (optional) */
char_u *b_odb_fname; /* Custom file name (optional) */
#endif
-};
+}; /* file_buffer */
#ifdef FEAT_DIFF
diff --git a/src/syntax.c b/src/syntax.c
index 6e28c45..d4c2996 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -992,13 +992,16 @@ syn_match_linecont(lnum)
linenr_T lnum;
{
regmmatch_T regmatch;
+ int r;
if (syn_block->b_syn_linecont_prog != NULL)
{
regmatch.rmm_ic = syn_block->b_syn_linecont_ic;
regmatch.regprog = syn_block->b_syn_linecont_prog;
- return syn_regexec(&regmatch, lnum, (colnr_T)0,
+ r = syn_regexec(&regmatch, lnum, (colnr_T)0,
IF_SYN_TIME(&syn_block->b_syn_linecont_time));
+ syn_block->b_syn_linecont_prog = regmatch.regprog;
+ return r;
}
return FALSE;
}
@@ -2075,6 +2078,8 @@ syn_current_attr(syncing, displaying, can_spell, keep_state)
cur_si->si_cont_list, &spp->sp_syn,
spp->sp_flags & HL_CONTAINED))))
{
+ int r;
+
/* If we already tried matching in this line, and
* there isn't a match before next_match_col, skip
* this item. */
@@ -2089,10 +2094,12 @@ syn_current_attr(syncing, displaying, can_spell, keep_state)
regmatch.rmm_ic = spp->sp_ic;
regmatch.regprog = spp->sp_prog;
- if (!syn_regexec(&regmatch,
+ r = syn_regexec(&regmatch,
current_lnum,
(colnr_T)lc_col,
- IF_SYN_TIME(&spp->sp_time)))
+ IF_SYN_TIME(&spp->sp_time));
+ spp->sp_prog = regmatch.regprog;
+ if (!r)
{
/* no match in this line, try another one */
spp->sp_startcol = MAXCOL;
@@ -2963,6 +2970,7 @@ find_endpos(idx, startpos, m_endpos, hl_endpos, flagsp, end_endpos,
for (idx = start_idx; idx < syn_block->b_syn_patterns.ga_len; ++idx)
{
int lc_col = matchcol;
+ int r;
spp = &(SYN_ITEMS(syn_block)[idx]);
if (spp->sp_type != SPTYPE_END) /* past last END pattern */
@@ -2973,8 +2981,10 @@ find_endpos(idx, startpos, m_endpos, hl_endpos, flagsp, end_endpos,
regmatch.rmm_ic = spp->sp_ic;
regmatch.regprog = spp->sp_prog;
- if (syn_regexec(&regmatch, startpos->lnum, lc_col,
- IF_SYN_TIME(&spp->sp_time)))
+ r = syn_regexec(&regmatch, startpos->lnum, lc_col,
+ IF_SYN_TIME(&spp->sp_time));
+ spp->sp_prog = regmatch.regprog;
+ if (r)
{
if (best_idx == -1 || regmatch.startpos[0].col
< best_regmatch.startpos[0].col)
@@ -3000,14 +3010,16 @@ find_endpos(idx, startpos, m_endpos, hl_endpos, flagsp, end_endpos,
if (spp_skip != NULL)
{
int lc_col = matchcol - spp_skip->sp_offsets[SPO_LC_OFF];
+ int r;
if (lc_col < 0)
lc_col = 0;
regmatch.rmm_ic = spp_skip->sp_ic;
regmatch.regprog = spp_skip->sp_prog;
- if (syn_regexec(&regmatch, startpos->lnum, lc_col,
- IF_SYN_TIME(&spp_skip->sp_time))
- && regmatch.startpos[0].col
+ r = syn_regexec(&regmatch, startpos->lnum, lc_col,
+ IF_SYN_TIME(&spp_skip->sp_time));
+ spp_skip->sp_prog = regmatch.regprog;
+ if (r && regmatch.startpos[0].col
<= best_regmatch.startpos[0].col)
{
/* Add offset to skip pattern match */
@@ -6292,11 +6304,10 @@ ex_ownsyntax(eap)
curwin->w_s = (synblock_T *)alloc(sizeof(synblock_T));
memset(curwin->w_s, 0, sizeof(synblock_T));
#ifdef FEAT_SPELL
+ /* TODO: keep the spell checking as it was. */
curwin->w_p_spell = FALSE; /* No spell checking */
clear_string_option(&curwin->w_s->b_p_spc);
clear_string_option(&curwin->w_s->b_p_spf);
- vim_regfree(curwin->w_s->b_cap_prog);
- curwin->w_s->b_cap_prog = NULL;
clear_string_option(&curwin->w_s->b_p_spl);
#endif
}
diff --git a/src/term.c b/src/term.c
index 95c29cc..a1ab537 100644
--- a/src/term.c
+++ b/src/term.c
@@ -153,11 +153,6 @@ char *UP, *BC, PC;
static char_u *vim_tgetstr __ARGS((char *s, char_u **pp));
#endif /* HAVE_TGETENT */
-#if defined(FEAT_TERMRESPONSE)
-static int xt_index_in = 0;
-static int xt_index_out = 0;
-#endif
-
static int detected_8bit = FALSE; /* detected 8-bit terminal */
static struct builtin_term builtin_termcaps[] =
@@ -3312,40 +3307,6 @@ stoptermcap()
}
#if defined(FEAT_TERMRESPONSE) || defined(PROTO)
-# if defined(UNIX) || defined(PROTO)
-/*
- * Return TRUE when the xterm version was requested or anything else that
- * would send an ESC sequence back to Vim.
- * If not sent yet, prevent it from being sent soon.
- * Used to check whether it is OK to enable checking for DEC mouse codes,
- * which conflict with may xterm ESC sequences.
- */
- int
-did_request_esc_sequence()
-{
- if (crv_status == CRV_GET)
- crv_status = 0;
- if (u7_status == U7_GET)
- u7_status = 0;
- return crv_status == CRV_SENT || u7_status == U7_SENT
- || xt_index_out > xt_index_in;
-}
-
-/*
- * If requesting the version was disabled in did_request_esc_sequence(),
- * enable it again.
- */
- void
-resume_get_esc_sequence()
-{
- if (crv_status == 0)
- crv_status = CRV_GET;
- if (u7_status == 0)
- u7_status = U7_GET;
-}
-# endif
-
-
/*
* Request version string (for xterm) when needed.
* Only do this after switching to raw mode, otherwise the result will be
@@ -3358,8 +3319,6 @@ resume_get_esc_sequence()
* Insert mode.
* On Unix only do it when both output and input are a tty (avoid writing
* request to terminal while reading from a file).
- * Do not do this when a mouse is being detected that starts with the same ESC
- * sequence as the termresponse.
* The result is caught in check_termcode().
*/
void
@@ -3373,7 +3332,6 @@ may_req_termresponse()
# ifdef UNIX
&& isatty(1)
&& isatty(read_cmd_fd)
- && !xterm_conflict_mouse
# endif
&& *T_CRV != NUL)
{
@@ -3742,8 +3700,8 @@ add_termcode(name, string, flags)
#if defined(WIN3264) && !defined(FEAT_GUI)
if (s[0] == K_NUL)
{
- STRMOVE(s + 1, s);
- s[1] = 3;
+ STRMOVE(s + 1, s);
+ s[1] = 3;
}
#endif
@@ -4212,24 +4170,31 @@ check_termcode(max_offset, buf, bufsize, buflen)
#ifdef FEAT_TERMRESPONSE
if (key_name[0] == NUL
- /* URXVT mouse uses <ESC>[#;#;#M, but we are matching <ESC>[ */
+ /* Mouse codes of DEC, pterm, and URXVT start with <ESC>[. When
+ * detecting the start of these mouse codes they might as well be
+ * another key code or terminal response. */
+# ifdef FEAT_MOUSE_DEC
+ || key_name[0] == KS_DEC_MOUSE
+# endif
+# ifdef FEAT_MOUSE_PTERM
+ || key_name[0] == KS_PTERM_MOUSE
+# endif
+# ifdef FEAT_MOUSE_URXVT
|| key_name[0] == KS_URXVT_MOUSE
-# ifdef FEAT_MBYTE
- || u7_status == U7_SENT
# endif
- )
+ )
{
- /* Check for some responses from terminal start with "<Esc>[" or
- * CSI.
+ /* Check for some responses from the terminal starting with
+ * "<Esc>[" or CSI:
*
- * - xterm version string: <Esc>[>{x};{vers};{y}c
+ * - Xterm version string: <Esc>[>{x};{vers};{y}c
* Also eat other possible responses to t_RV, rxvt returns
* "<Esc>[?1;2c". Also accept CSI instead of <Esc>[.
* mrxvt has been reported to have "+" in the version. Assume
* the escape sequence ends with a letter or one of "{|}~".
*
- * - cursor position report: <Esc>[{row};{col}R
- * The final byte is 'R'. now it is only used for checking for
+ * - Cursor position report: <Esc>[{row};{col}R
+ * The final byte must be 'R'. It is used for checking the
* ambiguous-width character state.
*/
p = tp[0] == CSI ? tp + 1 : tp + 2;
@@ -4269,36 +4234,42 @@ check_termcode(max_offset, buf, bufsize, buflen)
* u7_status is not "sent", it may be from a previous Vim that
* just exited. But not for <S-F3>, it sends something
* similar, check for row and column to make sense. */
- if (j == 1 && tp[i] == 'R' && row_char == '2' && col >= 2)
+ if (j == 1 && tp[i] == 'R')
{
- char *aw = NULL;
+ if (row_char == '2' && col >= 2)
+ {
+ char *aw = NULL;
- LOG_TR("Received U7 status");
- u7_status = U7_GOT;
+ LOG_TR("Received U7 status");
+ u7_status = U7_GOT;
# ifdef FEAT_AUTOCMD
- did_cursorhold = TRUE;
+ did_cursorhold = TRUE;
# endif
- if (col == 2)
- aw = "single";
- else if (col == 3)
- aw = "double";
- if (aw != NULL && STRCMP(aw, p_ambw) != 0)
- {
- /* Setting the option causes a screen redraw. Do that
- * right away if possible, keeping any messages. */
- set_option_value((char_u *)"ambw", 0L, (char_u *)aw, 0);
-# ifdef DEBUG_TERMRESPONSE
+ if (col == 2)
+ aw = "single";
+ else if (col == 3)
+ aw = "double";
+ if (aw != NULL && STRCMP(aw, p_ambw) != 0)
{
- char buf[100];
- int r = redraw_asap(CLEAR);
+ /* Setting the option causes a screen redraw. Do
+ * that right away if possible, keeping any
+ * messages. */
+ set_option_value((char_u *)"ambw", 0L,
+ (char_u *)aw, 0);
+# ifdef DEBUG_TERMRESPONSE
+ {
+ char buf[100];
+ int r = redraw_asap(CLEAR);
- sprintf(buf, "set 'ambiwidth', redraw_asap(): %d",
- r);
- log_tr(buf);
- }
+ sprintf(buf,
+ "set 'ambiwidth', redraw_asap(): %d",
+ r);
+ log_tr(buf);
+ }
# else
- redraw_asap(CLEAR);
+ redraw_asap(CLEAR);
# endif
+ }
}
key_name[0] = (int)KS_EXTRA;
key_name[1] = (int)KE_IGNORE;
@@ -4563,19 +4534,19 @@ check_termcode(max_offset, buf, bufsize, buflen)
return -1;
/* when mouse reporting is SGR, add 32 to mouse code */
- if (key_name[0] == KS_SGR_MOUSE)
- mouse_code += 32;
+ if (key_name[0] == KS_SGR_MOUSE)
+ mouse_code += 32;
mouse_col = getdigits(&p) - 1;
if (*p++ != ';')
return -1;
mouse_row = getdigits(&p) - 1;
- if (key_name[0] == KS_SGR_MOUSE && *p == 'm')
+ if (key_name[0] == KS_SGR_MOUSE && *p == 'm')
mouse_code |= MOUSE_RELEASE;
- else if (*p != 'M')
+ else if (*p != 'M')
return -1;
- p++;
+ p++;
slen += (int)(p - (tp + slen));
@@ -4592,7 +4563,7 @@ check_termcode(max_offset, buf, bufsize, buflen)
for (slen2 = slen; slen2 < len; slen2++)
{
if (tp[slen2] == 'M'
- || (key_name[0] == KS_SGR_MOUSE
+ || (key_name[0] == KS_SGR_MOUSE
&& tp[slen2] == 'm'))
{
cmd_complete = 1;
@@ -5769,6 +5740,9 @@ show_one_termcode(name, code, printit)
* termcap codes from the terminal itself.
* We get them one by one to avoid a very long response string.
*/
+static int xt_index_in = 0;
+static int xt_index_out = 0;
+
static void
req_codes_from_term()
{
diff --git a/src/testdir/Make_amiga.mak b/src/testdir/Make_amiga.mak
index 46cd6a9..a2e5db3 100644
--- a/src/testdir/Make_amiga.mak
+++ b/src/testdir/Make_amiga.mak
@@ -36,13 +36,20 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
test94.out test95.out test96.out test97.out test98.out \
test99.out test100.out test101.out test102.out test103.out \
test104.out test105.out test106.out test107.out \
+ test_argument_count.out \
test_autoformat_join.out \
test_breakindent.out \
+ test_changelist.out \
+ test_close_count.out \
+ test_eval.out \
+ test_insertcount.out \
test_listlbr.out \
test_listlbr_utf8.out \
+ test_mapping.out \
+ test_options.out \
test_qf_title.out \
- test_eval.out \
- test_options.out
+ test_signs.out \
+ test_utf8.out
.SUFFIXES: .in .out
@@ -166,10 +173,16 @@ test104.out: test104.in
test105.out: test105.in
test106.out: test106.in
test107.out: test107.in
+test_argument_count.out: test_argument_count.in
test_autoformat_join.out: test_autoformat_join.in
test_breakindent.out: test_breakindent.in
+test_changelist.out: test_changelist.in
+test_close_count.out: test_close_count.in
+test_eval.out: test_eval.in
+test_insertcount.out: test_insertcount.in
test_listlbr.out: test_listlbr.in
test_listlbr_utf8.out: test_listlbr_utf8.in
-test_qf_title.out: test_qf_title.in
-test_eval.out: test_eval.in
test_options.out: test_options.in
+test_qf_title.out: test_qf_title.in
+test_signs.out: test_signs.in
+test_utf8.out: test_utf8.in
diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak
index 86176ae..d2e070b 100644
--- a/src/testdir/Make_dos.mak
+++ b/src/testdir/Make_dos.mak
@@ -35,13 +35,20 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
test94.out test95.out test96.out test98.out test99.out \
test100.out test101.out test102.out test103.out test104.out \
test105.out test106.out test107.out\
+ test_argument_count.out \
test_autoformat_join.out \
test_breakindent.out \
+ test_changelist.out \
+ test_close_count.out \
+ test_eval.out \
+ test_insertcount.out \
test_listlbr.out \
test_listlbr_utf8.out \
+ test_mapping.out \
+ test_options.out \
test_qf_title.out \
- test_eval.out \
- test_options.out
+ test_signs.out \
+ test_utf8.out
SCRIPTS32 = test50.out test70.out
@@ -60,7 +67,7 @@ win32: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS32) report
fixff:
-$(VIMPROG) -u dos.vim --noplugin "+argdo set ff=dos|upd" +q *.in *.ok
-$(VIMPROG) -u dos.vim --noplugin "+argdo set ff=unix|upd" +q \
- dotest.in test60.ok test71.ok test74.ok
+ dotest.in test60.ok test71.ok test74.ok test100.ok
report:
@echo ""
@@ -82,6 +89,7 @@ clean:
-if exist Xfind rd /s /q Xfind
-if exist viminfo del viminfo
-del test.log
+ -if exist benchmark.out del benchmark.out
.in.out:
-if exist $*.failed del $*.failed
@@ -98,3 +106,11 @@ clean:
nolog:
-del test.log
+
+benchmark:
+ bench_re_freeze.out
+
+bench_re_freeze.out: bench_re_freeze.vim
+ -if exist benchmark.out del benchmark.out
+ $(VIMPROG) -u dos.vim -U NONE --noplugin $*.in
+ @IF EXIST benchmark.out ( type benchmark.out )
diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak
index cf10301..4a99cb9 100644
--- a/src/testdir/Make_ming.mak
+++ b/src/testdir/Make_ming.mak
@@ -12,11 +12,13 @@ ifneq (sh.exe, $(SHELL))
DEL = rm -f
MV = mv
CP = cp
+CAT = cat
DIRSLASH = /
else
DEL = del
MV = rename
CP = copy
+CAT = type
DIRSLASH = \\
endif
@@ -55,18 +57,27 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
test94.out test95.out test96.out test98.out test99.out \
test100.out test101.out test102.out test103.out test104.out \
test105.out test106.out test107.out \
+ test_argument_count.out \
test_autoformat_join.out \
test_breakindent.out \
+ test_changelist.out \
+ test_close_count.out \
+ test_eval.out \
+ test_insertcount.out \
test_listlbr.out \
test_listlbr_utf8.out \
+ test_mapping.out \
+ test_options.out \
test_qf_title.out \
- test_eval.out \
- test_options.out
+ test_signs.out \
+ test_utf8.out
SCRIPTS32 = test50.out test70.out
SCRIPTS_GUI = test16.out
+SCRIPTS_BENCH = bench_re_freeze.out
+
.SUFFIXES: .in .out
vimall: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS32)
@@ -75,6 +86,8 @@ vimall: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS32)
nongui: fixff $(SCRIPTS16) $(SCRIPTS)
echo ALL DONE
+benchmark: $(SCRIPTS_BENCH)
+
small:
echo ALL DONE
@@ -109,3 +122,8 @@ clean:
-$(DEL) X*
-$(DEL) test.ok
-$(DEL) viminfo
+
+bench_re_freeze.out: bench_re_freeze.vim
+ -$(DEL) benchmark.out
+ $(VIMPROG) -u dos.vim -U NONE --noplugin $*.in
+ $(CAT) benchmark.out
diff --git a/src/testdir/Make_os2.mak b/src/testdir/Make_os2.mak
index a7f3989..7a2571b 100644
--- a/src/testdir/Make_os2.mak
+++ b/src/testdir/Make_os2.mak
@@ -37,13 +37,22 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
test94.out test95.out test96.out test98.out test99.out \
test100.out test101.out test102.out test103.out test104.out \
test105.out test106.out test107.out \
+ test_argument_count.out \
test_autoformat_join.out \
- test_eval.out \
test_breakindent.out \
+ test_changelist.out \
+ test_close_count.out \
+ test_eval.out \
+ test_insertcount.out \
test_listlbr.out \
test_listlbr_utf8.out \
+ test_mapping.out \
+ test_options.out \
test_qf_title.out \
- test_options.out
+ test_signs.out \
+ test_utf8.out
+
+SCRIPTS_BENCH = bench_re_freeze.out
.SUFFIXES: .in .out
@@ -52,6 +61,8 @@ all: /tmp $(SCRIPTS)
$(SCRIPTS): $(VIMPROG)
+benchmark: $(SCRIPTS_BENCH)
+
clean:
-rm -rf *.out Xdotest test.ok tiny.vim small.vim mbyte.vim viminfo
@@ -70,3 +81,10 @@ clean:
# Create a directory for temp files
/tmp:
-mkdir /tmp
+
+bench_re_freeze.out: bench_re_freeze.vim
+ -del $*.failed test.ok benchmark.out
+ copy $*.ok test.ok
+ $(VIMPROG) -u os2.vim --noplugin -s dotest.in $*.in
+ type benchmark.out
+
diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms
index 9bf395b..93aa874 100644
--- a/src/testdir/Make_vms.mms
+++ b/src/testdir/Make_vms.mms
@@ -4,7 +4,7 @@
# Authors: Zoltan Arpadffy, <arpadffy@polarhome.com>
# Sandor Kopanyi, <sandor.kopanyi@mailbox.hu>
#
-# Last change: 2014 Jul 23
+# Last change: 2014 Nov 27
#
# This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
# Edit the lines in the Configuration section below to select.
@@ -45,7 +45,7 @@
# It fails because VMS does not support this feature yet.
# WANT_MZSCH = YES
-# Comment out if you have ODS-5 file system
+# Comment out if you have ODS-5 file system
# HAVE_ODS5 = YES
# Comment out if you have gzip on your system
@@ -54,10 +54,10 @@
# Comment out if you have GNU compatible diff on your system
# HAVE_GDIFF = YES
-# Comment out if you have GNU compatible cksum on your system
+# Comment out if you have GNU compatible cksum on your system
# HAVE_CKSUM = YES
-# Comment out if you have ICONV support
+# Comment out if you have ICONV support
# HAVE_ICONV = YES
# Comment out if you have LUA support
@@ -96,13 +96,20 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \
test95.out test96.out test98.out test99.out \
test100.out test101.out test103.out test104.out \
test105.out test106.out test107.out \
+ test_argument_count.out \
test_autoformat_join.out \
test_breakindent.out \
+ test_changelist.out \
+ test_close_count.out \
+ test_eval.out \
+ test_insertcount.out \
test_listlbr.out \
test_listlbr_utf8.out \
+ test_mapping.out \
+ test_options.out \
test_qf_title.out \
- test_eval.out \
- test_options.out
+ test_signs.out \
+ test_utf8.out
# Known problems:
# test17: ?
diff --git a/src/testdir/Makefile b/src/testdir/Makefile
index b5f5d18..aa0ef1f 100644
--- a/src/testdir/Makefile
+++ b/src/testdir/Makefile
@@ -33,22 +33,33 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
test94.out test95.out test96.out test97.out test98.out \
test99.out test100.out test101.out test102.out test103.out \
test104.out test105.out test106.out test107.out \
+ test_argument_count.out \
test_autoformat_join.out \
test_breakindent.out \
+ test_changelist.out \
+ test_close_count.out \
+ test_eval.out \
+ test_insertcount.out \
test_listlbr.out \
test_listlbr_utf8.out \
+ test_mapping.out \
+ test_options.out \
test_qf_title.out \
- test_eval.out \
- test_options.out
+ test_signs.out \
+ test_utf8.out
SCRIPTS_GUI = test16.out
+SCRIPTS_BENCH = bench_re_freeze.out
+
.SUFFIXES: .in .out
nongui: nolog $(SCRIPTS) report
gui: nolog $(SCRIPTS) $(SCRIPTS_GUI) report
+benchmark: $(SCRIPTS_BENCH)
+
report:
@echo
@echo 'Test results:'
@@ -60,7 +71,7 @@ report:
$(SCRIPTS) $(SCRIPTS_GUI): $(VIMPROG)
RM_ON_RUN = test.out X* viminfo
-RM_ON_START = tiny.vim small.vim mbyte.vim mzscheme.vim lua.vim test.ok
+RM_ON_START = tiny.vim small.vim mbyte.vim mzscheme.vim lua.vim test.ok benchmark.out
RUN_VIM = VIMRUNTIME=$(SCRIPTSOURCE); export VIMRUNTIME; $(VALGRIND) $(VIMPROG) -u unix.vim -U NONE --noplugin -s dotest.in
clean:
@@ -115,5 +126,14 @@ test49.out: test49.vim
test60.out: test60.vim
+bench_re_freeze.out: bench_re_freeze.vim
+ -rm -rf benchmark.out $(RM_ON_RUN)
+ # Sleep a moment to avoid that the xterm title is messed up.
+ # 200 msec is sufficient, but only modern sleep supports a fraction of
+ # a second, fall back to a second if it fails.
+ @-/bin/sh -c "sleep .2 > /dev/null 2>&1 || sleep 1"
+ -$(RUN_VIM) $*.in
+ @/bin/sh -c "if test -f benchmark.out; then cat benchmark.out; fi"
+
nolog:
-rm -f test.log
diff --git a/src/testdir/test100.in b/src/testdir/test100.in
index 61d28c1..7bd88fe 100644
--- a/src/testdir/test100.in
+++ b/src/testdir/test100.in
@@ -16,17 +16,19 @@ STARTTEST
:new one
:0put ='ONE: expecting global undolevels: 5, local undolevels: -123456 (default)'
:call FillBuffer()
-:call feedkeys(":earlier 10\n", 't')
+:earlier 10
:call UndoLevel()
+:set ff=unix
:%w! test.out
:new two
:0put ='TWO: expecting global undolevels: 5, local undolevels: 2 (first) then 10 (afterwards)'
:setlocal ul=2
:call FillBuffer()
-:call feedkeys(":earlier 10\n", 't')
+:earlier 10
:call UndoLevel()
:setlocal ul=10
:call UndoLevel()
+:set ff=unix
:%w >> test.out
:wincmd p
:redir >>test.out | echo "global value shouldn't be changed and still be 5!" | echo 'ONE: expecting global undolevels: 5, local undolevels: -123456 (default)'|:setglobal undolevels? | echon ' global' | setlocal undolevels? | echon ' local' |echo "" |redir end
@@ -35,6 +37,7 @@ STARTTEST
:1put ='global value should be changed to 50'
:2put ='THREE: expecting global undolevels: 50, local undolevels: -123456 (default)'
:call UndoLevel()
+:set ff=unix
:%w >> test.out
:"sleep 10
:"
diff --git a/src/testdir/test101.in b/src/testdir/test101.in
index 04c934f..31fc334 100644
--- a/src/testdir/test101.in
+++ b/src/testdir/test101.in
@@ -25,6 +25,9 @@ n:AddR
:AddR
/
:AddR
+:set nohls
+/
+:AddR
:let r1=r[0][0]
:" I guess it is not guaranteed that screenattr outputs always the same character
:call map(r, 'v:val[1].":".(v:val[0]==r1?"highlighted":"not highlighted")')
diff --git a/src/testdir/test101.ok b/src/testdir/test101.ok
index 3ed7436..f063b85 100644
--- a/src/testdir/test101.ok
+++ b/src/testdir/test101.ok
@@ -8,4 +8,5 @@ start:
1:highlighted
0:not highlighted
1:highlighted
+0:not highlighted
Vim(let):E706:
diff --git a/src/testdir/test102.in b/src/testdir/test102.in
index 35e9f6c..33b4019 100644
--- a/src/testdir/test102.in
+++ b/src/testdir/test102.in
@@ -1,6 +1,7 @@
Test if fnameescape is correct for special chars like !
STARTTEST
+:so small.vim
:%d
:let fname = 'Xspa ce'
:try | exe "w! " . fnameescape(fname) | put='Space' | endtry
diff --git a/src/testdir/test11.in b/src/testdir/test11.in
index 47de470..9e9e257 100644
--- a/src/testdir/test11.in
+++ b/src/testdir/test11.in
@@ -46,13 +46,13 @@ STARTTEST
:w>>test.out " Append it to the output file
:set shelltemp " need temp files here
:au FilterReadPre *.out call rename(expand("<afile>"), expand("<afile>") . ".t")
-:au FilterReadPre *.out exe '!sed s/e/E/ ' . shellescape(expand("<afile>")) . ".t >" . shellescape(expand("<afile>"))
-:au FilterReadPre *.out exe '!rm ' . shellescape(expand("<afile>")) . '.t'
+:au FilterReadPre *.out exe 'silent !sed s/e/E/ ' . shellescape(expand("<afile>")) . ".t >" . shellescape(expand("<afile>"))
+:au FilterReadPre *.out exe 'silent !rm ' . shellescape(expand("<afile>")) . '.t'
:au FilterReadPost *.out '[,']s/x/X/g
:e! test.out " Edit the output file
:23,$!cat
:23,$s/\r$// " remove CR for when sed adds them
-:au! FileReadPre *.gz exe '!gzip -d ' . shellescape(expand("<afile>"))
+:au! FileReadPre *.gz exe 'silent !gzip -d ' . shellescape(expand("<afile>"))
:au FileReadPre *.gz call rename(expand("<afile>:r"), expand("<afile>"))
:au! FileReadPost *.gz '[,']s/l/L/
:$r Xtestfile.gz " Read compressed file
diff --git a/src/testdir/test3.in b/src/testdir/test3.in
index de86700..7757569 100644
--- a/src/testdir/test3.in
+++ b/src/testdir/test3.in
@@ -464,6 +464,14 @@ label: if (asdf &&
asdfasdf
}
+{
+for ( int i = 0;
+ i < 10; i++ )
+{
+}
+ i = 0;
+}
+
class bob
{
int foo() {return 1;}
diff --git a/src/testdir/test3.ok b/src/testdir/test3.ok
index 0d0e76f..e75de0f 100644
--- a/src/testdir/test3.ok
+++ b/src/testdir/test3.ok
@@ -452,6 +452,14 @@ label: if (asdf &&
asdfasdf
}
+{
+ for ( int i = 0;
+ i < 10; i++ )
+ {
+ }
+ i = 0;
+}
+
class bob
{
int foo() {return 1;}
diff --git a/src/testdir/test39.in b/src/testdir/test39.in
index c1e1cc4..7d1c672 100644
--- a/src/testdir/test39.in
+++ b/src/testdir/test39.in
@@ -23,6 +23,9 @@ G$khhhhhkkcmno
/^aaaa/
:exe ":norm! l\<C-V>jjjlllI\<Right>\<Right> \<Esc>"
:/^aa/,/^$/w >> test.out
+/xaaa$/
+:exe ":norm! \<C-V>jjjI<>\<Left>p\<Esc>"
+:/xaaa$/,/^$/w >> test.out
:" Test for Visual block was created with the last <C-v>$
/^A23$/
:exe ":norm! l\<C-V>j$Aab\<Esc>"
@@ -77,6 +80,11 @@ bbbbbb
cccccc
dddddd
+xaaa
+bbbb
+cccc
+dddd
+
A23
4567
diff --git a/src/testdir/test39.ok b/src/testdir/test39.ok
index ef7a2c6442ca8ae973f2ca86e6105214a166180d..d8e901563af492e50b8f70c470fee5678644dc0c 100644
GIT binary patch
delta 39
lcmaFJ+{7|rqKr*}T}5JIA{UTO0s;`73<MxLWn)h$BLE9K4HN(X
delta 10
RcmZo-dB{9r;>Jw@i~tx91V8`)
diff --git a/src/testdir/test4.in b/src/testdir/test4.in
index 4aa2fe5..b8bd9fc 100644
--- a/src/testdir/test4.in
+++ b/src/testdir/test4.in
@@ -17,6 +17,9 @@ othis should be auto-indented
G?this is a
othis should be in column 1:wq " append text without autoindent to Xxx
G:r Xxx " include Xxx in the current file
+:set fo+=r " issue #57 do not move cursor on <c-o> when autoindent is set
+Go# abcdef2hi
+d0o# abcdef2hid0
:?startstart?,$w! test.out
:qa!
ENDTEST
diff --git a/src/testdir/test4.ok b/src/testdir/test4.ok
index dffecda..d032e4c 100644
--- a/src/testdir/test4.ok
+++ b/src/testdir/test4.ok
@@ -15,3 +15,6 @@ vim: set noai :
this is a test
this should be in column 1
end of test file Xxx
+# abc
+def
+def
diff --git a/src/testdir/test55.in b/src/testdir/test55.in
index 8e073f3..140cb7c 100644
--- a/src/testdir/test55.in
+++ b/src/testdir/test55.in
@@ -282,6 +282,21 @@ let l = [0, 1, 2, 3]
: $put =ps
: endfor
:endfor
+:unlet l
+:let l = [1, 2, 3, 4]
+:lockvar! l
+:$put =string(l)
+:unlockvar l[1]
+:unlet l[0:1]
+:$put =string(l)
+:unlet l[1:2]
+:$put =string(l)
+:unlockvar l[1]
+:let l[0:1] = [0, 1]
+:$put =string(l)
+:let l[1:2] = [0, 1]
+:$put =string(l)
+:unlet l
:" :lockvar/islocked() triggering script autoloading
:set rtp+=./sautest
:lockvar g:footest#x
diff --git a/src/testdir/test55.ok b/src/testdir/test55.ok
index dfd8060..e8560de 100644
--- a/src/testdir/test55.ok
+++ b/src/testdir/test55.ok
@@ -86,6 +86,11 @@ FFFFFFF
FFpFFpp
0000-000
ppppppp
+[1, 2, 3, 4]
+[1, 2, 3, 4]
+[1, 2, 3, 4]
+[1, 2, 3, 4]
+[1, 2, 3, 4]
locked g:footest#x:-1
exists g:footest#x:0
g:footest#x: 1
diff --git a/src/testdir/test63.in b/src/testdir/test63.in
index 5ec315a..1f073a7 100644
--- a/src/testdir/test63.in
+++ b/src/testdir/test63.in
@@ -3,12 +3,13 @@ Test for ":match", ":2match", ":3match", "clearmatches()", "getmatches()",
STARTTEST
:so small.vim
+:set encoding=utf8
:" --- Check that "matcharg()" returns the correct group and pattern if a match
:" --- is defined.
:let @r = "*** Test 1: "
-:highlight MyGroup1 ctermbg=red guibg=red
-:highlight MyGroup2 ctermbg=green guibg=green
-:highlight MyGroup3 ctermbg=blue guibg=blue
+:highlight MyGroup1 term=bold ctermbg=red guibg=red
+:highlight MyGroup2 term=italic ctermbg=green guibg=green
+:highlight MyGroup3 term=underline ctermbg=blue guibg=blue
:match MyGroup1 /TODO/
:2match MyGroup2 /FIXME/
:3match MyGroup3 /XXX/
@@ -164,7 +165,27 @@ STARTTEST
:if v1 != v5 && v6 == v1 && v8 == v5 && v10 == v5 && v11 == v1
: let @r .= "OK\n"
:else
-: let @r .= "FAILED\n"
+: let @r .= "FAILED: " . v5 . "/" . v6 . "/" . v8 . "/" . v10 . "/" . v11 . "\n"
+:endif
+:call clearmatches()
+:"
+:call setline(1, 'abcdΣabcdef')
+:call matchaddpos("MyGroup1", [[1, 4, 2], [1, 9, 2]])
+:1
+:redraw!
+:let v1 = screenattr(1, 1)
+:let v4 = screenattr(1, 4)
+:let v5 = screenattr(1, 5)
+:let v6 = screenattr(1, 6)
+:let v7 = screenattr(1, 7)
+:let v8 = screenattr(1, 8)
+:let v9 = screenattr(1, 9)
+:let v10 = screenattr(1, 10)
+:let @r .= string(getmatches())."\n"
+:if v1 != v4 && v5 == v4 && v6 == v1 && v7 == v1 && v8 == v4 && v9 == v4 && v10 == v1
+: let @r .= "OK\n"
+:else
+: let @r .= "FAILED: " . v4 . "/" . v5 . "/" . v6 . "/" . v7 . "/" . v8 . "/" . v9 . "/" . v10 . "\n"
:endif
:call clearmatches()
G"rp
diff --git a/src/testdir/test63.ok b/src/testdir/test63.ok
index f804b69..5d61939 100644
--- a/src/testdir/test63.ok
+++ b/src/testdir/test63.ok
@@ -12,3 +12,5 @@ Results of test63:
*** Test 11:
[{'group': 'MyGroup1', 'id': 3, 'priority': 10, 'pos1': [1, 5, 1], 'pos2': [1, 8, 3]}]
OK
+[{'group': 'MyGroup1', 'id': 11, 'priority': 10, 'pos1': [1, 4, 2], 'pos2': [1, 9, 2]}]
+OK
diff --git a/src/testdir/test64.in b/src/testdir/test64.in
index 2abdcd1..f2452fc 100644
--- a/src/testdir/test64.in
+++ b/src/testdir/test64.in
@@ -459,7 +459,7 @@ STARTTEST
: let text = t[2]
: let matchidx = 3
: for engine in [0, 1, 2]
-: if engine == 2 && re == 0 || engine == 1 && re ==1
+: if engine == 2 && re == 0 || engine == 1 && re == 1
: continue
: endif
: let &regexpengine = engine
@@ -608,6 +608,17 @@ yeGopA END:"
"ayb20gg/..\%$
"bybGo"apo"bp:"
:"
+:" Check for detecting error
+:set regexpengine=2
+:for pat in [' \ze*', ' \zs*']
+: try
+: let l = matchlist('x x', pat)
+: $put ='E888 NOT detected for ' . pat
+: catch
+: $put ='E888 detected for ' . pat
+: endtry
+:endfor
+:"
:""""" Write the results """""""""""""
:/\%#=1^Results/,$wq! test.out
ENDTEST
diff --git a/src/testdir/test64.ok b/src/testdir/test64.ok
index e7d1731..ffc0b53 100644
--- a/src/testdir/test64.ok
+++ b/src/testdir/test64.ok
@@ -1097,3 +1097,5 @@ Test
Test END
EN
E
+E888 detected for \ze*
+E888 detected for \zs*
diff --git a/src/testdir/test71.in b/src/testdir/test71.in
index 155fd41..944b69d 100644
--- a/src/testdir/test71.in
+++ b/src/testdir/test71.in
@@ -13,6 +13,8 @@ STARTTEST
:let cm0_bytes = getline('.', '.')
:/^start of cm=blowfish bytes/+1
:let cm1_bytes = getline('.', '.')
+:/^start of cm=blowfish2 bytes/+1
+:let cm2_bytes = getline('.', '.')
:bwipe!
:call append(0, text_lines)
:$d
@@ -36,6 +38,18 @@ barfoo
:e Xtestfile
barfoo
:let cm1_read_back = getline('.', '$')
+:set key=
+:set cryptmethod=blowfish2
+:" If the blowfish test fails 'cryptmethod' will be 'zip' now.
+:%s/^/\=&cryptmethod == 'blowfish2' ? "OK " : "blowfish test failed "/
+:X
+bar2foo
+bar2foo
+:w! Xtestfile
+:bwipe!
+:e Xtestfile
+bar2foo
+:let cm2_read_back = getline('.', '$')
:bwipe!
:set bin noeol key=
:call append(0, cm0_bytes)
@@ -57,7 +71,20 @@ foofoo
:set nobin
:e Xtestfile
barbar
+:let cm1_read_bin = getline('.', '$')
+:bwipe!
+:set bin noeol key=
+:call append(0, cm2_bytes)
+:$d
+:set fenc=latin1
+:w! Xtestfile
+:bwipe!
+:set nobin
+:e Xtestfile
+barburp
+:call append(0, cm1_read_bin)
:call append(0, cm0_read_bin)
+:call append(0, cm2_read_back)
:call append(0, cm1_read_back)
:call append(0, cm0_read_back)
:set key= fenc=latin1
diff --git a/src/testdir/test71.ok b/src/testdir/test71.ok
index 24652c4..de1b0ab 100644
--- a/src/testdir/test71.ok
+++ b/src/testdir/test71.ok
@@ -4,7 +4,12 @@ line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
OK 01234567890123456789012345678901234567
OK line 2 foo bar blah
OK line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+OK OK 01234567890123456789012345678901234567
+OK OK line 2 foo bar blah
+OK OK line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1234567890
aábbccddeëff
asdfasdfasdf
0001112223333
+abcdefghijklmnopqrstuvwxyz
+!@#$%^&*()_+=-`~
diff --git a/src/testdir/test71a.in b/src/testdir/test71a.in
index 85bd22c..e79a398 100644
--- a/src/testdir/test71a.in
+++ b/src/testdir/test71a.in
@@ -12,3 +12,7 @@ end of cm=zip bytes
start of cm=blowfish bytes
VimCrypt~02!k)¾—#ÝSœõ=ºàÈ#¥M´†JÃAÍ¥M´†!€›õáÒ‚˜÷
Ú
end of cm=blowfish bytes
+
+start of cm=blowfish2 bytes
+VimCrypt~03!ÑNã;ÓÀ ^C)÷.¶«FSà‹6Ò[T˧…ؾ9 2 Q³Ì@—ߚ­Ivª.ØÉîž`½$¯%Ð
+end of cm=blowfish2 bytes
diff --git a/src/testdir/test72.in b/src/testdir/test72.in
index 3b3a6a4..a407eea 100644
--- a/src/testdir/test72.in
+++ b/src/testdir/test72.in
@@ -81,7 +81,8 @@ uu:w >>test.out
:"
:" With encryption, cryptmethod=blowfish
:e! Xtestfile
-:set undofile cm=blowfish
+rubbish
+:set undofile cm=blowfish ff&
ggdGijan
feb
mar
@@ -104,6 +105,32 @@ u:.w >>test.out
u:.w >>test.out
u:.w >>test.out
:"
+:" With encryption, cryptmethod=blowfish2
+:e! Xtestfile
+rubbish
+:set undofile cm=blowfish2 ff&
+ggdGijan
+feb
+mar
+apr
+jun:set ul=100
+kk0ifoo :set ul=100
+dd:set ul=100
+ibar :set ul=100
+:X
+foo2bar
+foo2bar
+:w!
+:bwipe!
+:e Xtestfile
+foo2bar
+:set key=
+/bar
+:.w >>test.out
+u:.w >>test.out
+u:.w >>test.out
+u:.w >>test.out
+:"
:" Rename the undo file so that it gets cleaned up.
:if has("vms")
: call rename("_un_Xtestfile", "Xtestundo")
diff --git a/src/testdir/test72.ok b/src/testdir/test72.ok
index bb267d0..8d30ba1 100644
--- a/src/testdir/test72.ok
+++ b/src/testdir/test72.ok
@@ -25,3 +25,7 @@ bar apr
apr
foo mar
mar
+bar apr
+apr
+foo mar
+mar
diff --git a/src/testdir/test75.in b/src/testdir/test75.in
index b7f2783..8fabccd 100644
--- a/src/testdir/test75.in
+++ b/src/testdir/test75.in
@@ -23,16 +23,16 @@ STARTTEST
Go:"
:" Outside of the range, minimum
:inoremap <Char-0x1040> a
-:call feedkeys("a\u1040\<Esc>")
+:execute "normal a\u1040\<Esc>"
:" Inside of the range, minimum
:inoremap <Char-0x103f> b
-:call feedkeys("a\u103f\<Esc>")
+:execute "normal a\u103f\<Esc>"
:" Inside of the range, maximum
:inoremap <Char-0xf03f> c
-:call feedkeys("a\uf03f\<Esc>")
+:execute "normal a\uf03f\<Esc>"
:" Outside of the range, maximum
:inoremap <Char-0xf040> d
-:call feedkeys("a\uf040\<Esc>")
+:execute "normal a\uf040\<Esc>"
:"
:/^eof/+1,$w! test.out
:qa!
diff --git a/src/testdir/test86.in b/src/testdir/test86.in
index b169293..819ae95 100644
--- a/src/testdir/test86.in
+++ b/src/testdir/test86.in
@@ -1384,6 +1384,7 @@ EOF
:debug silent! py test_keyboard_interrupt()
:redir END
:0 debuggreedy
+:call inputrestore()
:silent $put =output
:unlet output
:py del test_keyboard_interrupt
diff --git a/src/testdir/test87.in b/src/testdir/test87.in
index 9111a49..e24df41 100644
--- a/src/testdir/test87.in
+++ b/src/testdir/test87.in
@@ -1361,6 +1361,7 @@ EOF
:debug silent! py3 test_keyboard_interrupt()
:redir END
:0 debuggreedy
+:call inputrestore()
:silent $put =output
:unlet output
:py3 del test_keyboard_interrupt
diff --git a/src/testdir/test91.in b/src/testdir/test91.in
index e900a52..b66776b 100644
--- a/src/testdir/test91.in
+++ b/src/testdir/test91.in
@@ -55,6 +55,7 @@ STARTTEST
:tabnew
:tabnew
:let t:var_list = [1, 2, 3]
+:let t:other = 777
:let def_list = [4, 5, 6, 7]
:tabrewind
:$put =string(gettabvar(3, 'var_list'))
diff --git a/src/testdir/test91.ok b/src/testdir/test91.ok
index 22e1572..809952b 100644
--- a/src/testdir/test91.ok
+++ b/src/testdir/test91.ok
@@ -26,8 +26,8 @@ iso-8859-2
0
[1, 2, 3]
[1, 2, 3]
-''
-[4, 5, 6, 7]
+{'var_list': [1, 2, 3], 'other': 777}
+{'var_list': [1, 2, 3], 'other': 777}
[4, 5, 6, 7]
''
[4, 5, 6, 7]
diff --git a/src/testdir/test_argument_count.in b/src/testdir/test_argument_count.in
new file mode 100644
index 0000000..cdac030
--- /dev/null
+++ b/src/testdir/test_argument_count.in
@@ -0,0 +1,48 @@
+Tests for :[count]argument! and :[count]argdelete vim: set ft=vim :
+
+STARTTEST
+:so small.vim
+:%argd
+:argadd a b c d
+:set hidden
+:let buffers = []
+:augroup TEST
+:au BufEnter * call add(buffers, expand('%:t'))
+:augroup END
+:$argu
+:$-argu
+:-argu
+:1argu
+:+2argu
+:augroup TEST
+:au!
+:augroup END
+:let arglists = []
+:.argd
+:call add(arglists, argv())
+:-argd
+:call add(arglists, argv())
+:$argd
+:call add(arglists, argv())
+:1arga c
+:1arga b
+:$argu
+:+arga d
+:$arga x
+:call add(arglists, argv())
+:$-10arga Y
+:call add(arglists, argv())
+:%argd
+:call add(arglists, argv())
+:arga a b c d e f
+:2,$-argd
+:call add(arglists, argv())
+:e! test.out
+:call append(0, buffers)
+:let lnr = line('$')
+:call append(lnr, map(copy(arglists), 'join(v:val, " ")'))
+:w
+:qa!
+ENDTEST
+
+
diff --git a/src/testdir/test_argument_count.ok b/src/testdir/test_argument_count.ok
new file mode 100644
index 0000000..f591bf2
--- /dev/null
+++ b/src/testdir/test_argument_count.ok
@@ -0,0 +1,13 @@
+d
+c
+b
+a
+c
+
+a b d
+a d
+a
+a b c d x
+Y a b c d x
+
+a f
diff --git a/src/testdir/test_breakindent.in b/src/testdir/test_breakindent.in
index 8f40e4f..a255457 100644
--- a/src/testdir/test_breakindent.in
+++ b/src/testdir/test_breakindent.in
@@ -6,18 +6,18 @@ STARTTEST
:10new|:vsp|:vert resize 20
:put =\"\tabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP\"
:set ts=4 sw=4 sts=4 breakindent
-:fu! ScreenChar(width)
+:fu! ScreenChar(line, width)
: let c=''
: for i in range(1,a:width)
-: let c.=nr2char(screenchar(line('.'), i))
+: let c.=nr2char(screenchar(a:line, i))
: endfor
: let c.="\n"
: for i in range(1,a:width)
-: let c.=nr2char(screenchar(line('.')+1, i))
+: let c.=nr2char(screenchar(a:line+1, i))
: endfor
: let c.="\n"
: for i in range(1,a:width)
-: let c.=nr2char(screenchar(line('.')+2, i))
+: let c.=nr2char(screenchar(a:line+2, i))
: endfor
: return c
:endfu
@@ -27,44 +27,45 @@ STARTTEST
: $put =g:line1
: wincmd p
:endfu
+:set briopt=min:0
:let g:test="Test 1: Simple breakindent"
-:let line1=ScreenChar(8)
+:let line1=ScreenChar(line('.'),8)
:call DoRecordScreen()
:let g:test="Test 2: Simple breakindent + sbr=>>"
:set sbr=>>
-:let line1=ScreenChar(8)
+:let line1=ScreenChar(line('.'),8)
:call DoRecordScreen()
:let g:test ="Test 3: Simple breakindent + briopt:sbr"
:set briopt=sbr,min:0 sbr=++
-:let line1=ScreenChar(8)
+:let line1=ScreenChar(line('.'),8)
:call DoRecordScreen()
:let g:test ="Test 4: Simple breakindent + min width: 18"
:set sbr= briopt=min:18
-:let line1=ScreenChar(8)
+:let line1=ScreenChar(line('.'),8)
:call DoRecordScreen()
:let g:test =" Test 5: Simple breakindent + shift by 2"
:set briopt=shift:2,min:0
-:let line1=ScreenChar(8)
+:let line1=ScreenChar(line('.'),8)
:call DoRecordScreen()
:let g:test=" Test 6: Simple breakindent + shift by -1"
:set briopt=shift:-1,min:0
-:let line1=ScreenChar(8)
+:let line1=ScreenChar(line('.'),8)
:call DoRecordScreen()
:let g:test=" Test 7: breakindent + shift by +1 + nu + sbr=? briopt:sbr"
:set briopt=shift:1,sbr,min:0 nu sbr=? nuw=4
-:let line1=ScreenChar(10)
+:let line1=ScreenChar(line('.'),10)
:call DoRecordScreen()
:let g:test=" Test 8: breakindent + shift:1 + nu + sbr=# list briopt:sbr"
:set briopt=shift:1,sbr,min:0 nu sbr=# list
-:let line1=ScreenChar(10)
+:let line1=ScreenChar(line('.'),10)
:call DoRecordScreen()
:let g:test=" Test 9: breakindent + shift by +1 + 'nu' + sbr=# list"
:set briopt-=sbr
-:let line1=ScreenChar(10)
+:let line1=ScreenChar(line('.'),10)
:call DoRecordScreen()
:let g:test=" Test 10: breakindent + shift by +1 + 'nu' + sbr=~ cpo+=n"
:set cpo+=n sbr=~ nu nuw=4 nolist briopt=sbr,min:0
-:let line1=ScreenChar(10)
+:let line1=ScreenChar(line('.'),10)
:call DoRecordScreen()
:wincmd p
:let g:test="\n Test 11: strdisplaywidth when breakindent is on"
@@ -73,6 +74,31 @@ STARTTEST
:let width = strlen(text[1:])+indent(2)*4+strlen(&sbr)*3 " text wraps 3 times
:$put =g:test
:$put =printf(\"strdisplaywidth: %d == calculated: %d\", strdisplaywidth(text), width)
+:let g:str="\t\t\t\t\t{"
+:let g:test=" Test 12: breakindent + long indent"
+:wincmd p
+:set all& breakindent linebreak briopt=min:10 nu numberwidth=3 ts=4
+:$put =g:str
+zt:let line1=ScreenChar(1,10)
+:wincmd p
+:call DoRecordScreen()
+:"
+:" Test, that the string " a\tb\tc\td\te" is correctly
+:" displayed in a 20 column wide window (see bug report
+:" https://groups.google.com/d/msg/vim_dev/ZOdg2mc9c9Y/TT8EhFjEy0IJ
+:only
+:vert 20new
+:set all& nocp breakindent briopt=min:10
+:call setline(1, [" a\tb\tc\td\te", " z y x w v"])
+:/^\s*a
+fbgjyl:let line1 = @0
+:?^\s*z
+fygjyl:let line2 = @0
+:quit!
+:$put ='Test 13: breakindent with wrapping Tab'
+:$put =line1
+:$put =line2
+:"
:%w! test.out
:qa!
ENDTEST
diff --git a/src/testdir/test_breakindent.ok b/src/testdir/test_breakindent.ok
index 723cb25..e50265e 100644
--- a/src/testdir/test_breakindent.ok
+++ b/src/testdir/test_breakindent.ok
@@ -53,3 +53,12 @@ Test 4: Simple breakindent + min width: 18
Test 11: strdisplaywidth when breakindent is on
strdisplaywidth: 46 == calculated: 64
+ {
+
+ Test 12: breakindent + long indent
+56
+
+~
+Test 13: breakindent with wrapping Tab
+d
+w
diff --git a/src/testdir/test_changelist.in b/src/testdir/test_changelist.in
new file mode 100644
index 0000000..6c7c430
--- /dev/null
+++ b/src/testdir/test_changelist.in
@@ -0,0 +1,22 @@
+Test changelist position after splitting window
+Set 'undolevels' to make changelist for sourced file
+
+STARTTEST
+:so small.vim
+Gkylp:set ul=100
+Gylp:set ul=100
+gg
+:vsplit
+:try
+: normal g;
+: normal ggVGcpass
+:catch
+: normal ggVGcfail
+:finally
+: %w! test.out
+:endtry
+:qa!
+ENDTEST
+
+1
+2
diff --git a/src/testdir/test_changelist.ok b/src/testdir/test_changelist.ok
new file mode 100644
index 0000000..2ae2839
--- /dev/null
+++ b/src/testdir/test_changelist.ok
@@ -0,0 +1 @@
+pass
diff --git a/src/testdir/test_close_count.in b/src/testdir/test_close_count.in
new file mode 100644
index 0000000..288945c
--- /dev/null
+++ b/src/testdir/test_close_count.in
@@ -0,0 +1,156 @@
+Tests for :[count]close! and :[count]hide vim: set ft=vim :
+
+STARTTEST
+:let tests = []
+:so tiny.vim
+:for i in range(5)
+:new
+:endfor
+:4wincmd w
+:close!
+:let buffers = []
+:windo call add(buffers, bufnr('%'))
+:call add(tests, buffers)
+:1close!
+:let buffers = []
+:windo call add(buffers, bufnr('%'))
+:call add(tests, buffers)
+:$close!
+:let buffers = []
+:windo call add(buffers, bufnr('%'))
+:call add(tests, buffers)
+:1wincmd w
+:2close!
+:let buffers = []
+:windo call add(buffers, bufnr('%'))
+:call add(tests, buffers)
+:1wincmd w
+:new
+:new
+:2wincmd w
+:-2close!
+:let buffers = []
+:windo call add(buffers, bufnr('%'))
+:call add(tests, buffers)
+:2wincmd w
+:+1close!
+:let buffers = []
+:windo call add(buffers, bufnr('%'))
+:call add(tests, buffers)
+:e! test.out
+:call append(0, map(copy(tests), 'join(v:val, " ")'))
+:w
+:only!
+:b1
+ENDTEST
+
+STARTTEST
+:let tests = []
+:so tiny.vim
+:for i in range(5)
+:new
+:endfor
+:let buffers = []
+:windo call add(buffers, bufnr('%'))
+:call add(tests, buffers)
+:4wincmd w
+:.hide
+:let buffers = []
+:windo call add(buffers, bufnr('%'))
+:call add(tests, buffers)
+:1hide
+:let buffers = []
+:windo call add(buffers, bufnr('%'))
+:call add(tests, buffers)
+:9hide
+:let buffers = []
+:windo call add(buffers, bufnr('%'))
+:call add(tests, buffers)
+:1wincmd w
+:2hide
+:let buffers = []
+:windo call add(buffers, bufnr('%'))
+:call add(tests, buffers)
+:1wincmd w
+:new
+:new
+:3wincmd w
+:-hide
+:let buffers = []
+:windo call add(buffers, bufnr('%'))
+:call add(tests, buffers)
+:2wincmd w
+:+hide
+:let buffers = []
+:windo call add(buffers, bufnr('%'))
+:call add(tests, buffers)
+:e! test.out
+:call append(line('$'), map(copy(tests), 'join(v:val, " ")'))
+Go
+:w
+:only!
+:b1
+ENDTEST
+
+STARTTEST
+:let tests = []
+:so tiny.vim
+:set hidden
+:for i in range(5)
+:new
+:endfor
+:1wincmd w
+:$ hide
+:let buffers = []
+:windo call add(buffers, bufnr('%'))
+:call add(tests, buffers)
+:$-1 close!
+:let buffers = []
+:windo call add(buffers, bufnr('%'))
+:call add(tests, buffers)
+:1wincmd w
+:.+close!
+:let buffers = []
+:windo call add(buffers, bufnr('%'))
+:call add(tests, buffers)
+:e! test.out
+:call append(line('$'), map(copy(tests), 'join(v:val, " ")'))
+Go
+:w
+:only!
+:b1
+ENDTEST
+
+STARTTEST
+:let tests = []
+:so tiny.vim
+:set hidden
+:for i in range(5)
+:new
+:endfor
+:4wincmd w
+c
+:let buffers = []
+:windo call add(buffers, bufnr('%'))
+:call add(tests, buffers)
+1c
+:let buffers = []
+:windo call add(buffers, bufnr('%'))
+:call add(tests, buffers)
+9c
+:let buffers = []
+:windo call add(buffers, bufnr('%'))
+:call add(tests, buffers)
+:1wincmd w
+2c
+:let buffers = []
+:windo call add(buffers, bufnr('%'))
+:call add(tests, buffers)
+:only!
+:e! test.out
+:call append(line('$'), map(copy(tests), 'join(v:val, " ")'))
+:w
+:qa!
+ENDTEST
+
+
diff --git a/src/testdir/test_close_count.ok b/src/testdir/test_close_count.ok
new file mode 100644
index 0000000..1cee870
--- /dev/null
+++ b/src/testdir/test_close_count.ok
@@ -0,0 +1,23 @@
+6 5 4 2 1
+5 4 2 1
+5 4 2
+5 2
+7 5 2
+7 5
+
+13 12 11 10 9 1
+13 12 11 9 1
+12 11 9 1
+12 11 9
+12 9
+15 12 9
+15 12
+
+20 19 18 17 16
+20 19 18 16
+20 18 16
+
+25 24 23 21 1
+24 23 21 1
+24 23 21
+24 21
diff --git a/src/testdir/test_insertcount.in b/src/testdir/test_insertcount.in
new file mode 100644
index 0000000..c7595b1
--- /dev/null
+++ b/src/testdir/test_insertcount.in
@@ -0,0 +1,14 @@
+Tests for repeating insert and replace.
+
+STARTTEST
+:so small.vim
+:/Second
+4gro
+:/^First/,$wq! test.out
+:" get here when failed and in Insert mode
+:.wq! test.out
+ENDTEST
+
+First line
+Second line
+Last line
diff --git a/src/testdir/test_insertcount.ok b/src/testdir/test_insertcount.ok
new file mode 100644
index 0000000..57afab0
--- /dev/null
+++ b/src/testdir/test_insertcount.ok
@@ -0,0 +1,3 @@
+First line
+ooooecond line
+Last line
diff --git a/src/testdir/test_listlbr.in b/src/testdir/test_listlbr.in
index 0cce4c2..f6618c5 100644
--- a/src/testdir/test_listlbr.in
+++ b/src/testdir/test_listlbr.in
@@ -2,7 +2,7 @@ Test for linebreak and list option (non-utf8)
STARTTEST
:so small.vim
-:if !exists("+linebreak") | e! test.ok | w! test.out | qa! | endif
+:if !exists("+linebreak") || !has("conceal") | e! test.ok | w! test.out | qa! | endif
:10new|:vsp|:vert resize 20
:put =\"\tabcdef hijklmn\tpqrstuvwxyz_1060ABCDEFGHIJKLMNOP \"
:norm! zt
@@ -46,6 +46,24 @@ STARTTEST
:redraw!
:let line=ScreenChar(winwidth(0))
:call DoRecordScreen()
+:let line="_S_\t bla"
+:$put =line
+:$
+:norm! zt
+:let g:test ="Test 5: set linebreak with conceal and set list and tab displayed by different char (line may not be truncated)"
+:set cpo&vim list linebreak conceallevel=2 concealcursor=nv listchars=tab:ab
+:syn match ConcealVar contained /_/ conceal
+:syn match All /.*/ contains=ConcealVar
+:let line=ScreenChar(winwidth(0))
+:call DoRecordScreen()
+:set cpo&vim linebreak
+:let g:test ="Test 6: set linebreak with visual block mode"
+:let line="REMOVE: this not"
+:$put =line
+:let line="REMOVE: aaaaaaaaaaaaa"
+:$put =line
+:1/^REMOVE:
+0jf x:$put
:%w! test.out
:qa!
ENDTEST
diff --git a/src/testdir/test_listlbr.ok b/src/testdir/test_listlbr.ok
index be323d4..ee74667 100644
--- a/src/testdir/test_listlbr.ok
+++ b/src/testdir/test_listlbr.ok
@@ -25,3 +25,14 @@ Test 4: set linebreak with tab and 1 line as long as screen: should break!
+aaaaaaaaaaaaaaaaaa
~
~
+_S_ bla
+
+Test 5: set linebreak with conceal and set list and tab displayed by different char (line may not be truncated)
+Sabbbbbb bla
+~
+~
+~
+this not
+aaaaaaaaaaaaa
+REMOVE:
+REMOVE:
diff --git a/src/testdir/test_listlbr_utf8.in b/src/testdir/test_listlbr_utf8.in
index f8888d5..ba12ada 100644
--- a/src/testdir/test_listlbr_utf8.in
+++ b/src/testdir/test_listlbr_utf8.in
@@ -30,11 +30,22 @@ STARTTEST
:redraw!
:let line=ScreenChar(winwidth(0))
:call DoRecordScreen()
+:"
:let g:test ="Test 2: set nolinebreak list"
:set list nolinebreak
:redraw!
:let line=ScreenChar(winwidth(0))
:call DoRecordScreen()
+:"
+:let g:test ="Test 3: set linebreak nolist"
+:$put =\"\t*mask = nil;\"
+:$
+:norm! zt
+:set nolist linebreak
+:redraw!
+:let line=ScreenChar(winwidth(0))
+:call DoRecordScreen()
+:"
:%w! test.out
:qa!
ENDTEST
diff --git a/src/testdir/test_listlbr_utf8.ok b/src/testdir/test_listlbr_utf8.ok
index 576ccfb..634cf39 100644
--- a/src/testdir/test_listlbr_utf8.ok
+++ b/src/testdir/test_listlbr_utf8.ok
@@ -12,3 +12,10 @@ Test 2: set nolinebreak list
+pqrstuvwxyz␣1060ABC
+DEFGHIJKLMNOPˑ¶
¶
+ *mask = nil;
+
+Test 3: set linebreak nolist
+ *mask = nil;
+~
+~
+~
diff --git a/src/testdir/test_mapping.in b/src/testdir/test_mapping.in
new file mode 100644
index 0000000..e257277
--- /dev/null
+++ b/src/testdir/test_mapping.in
@@ -0,0 +1,16 @@
+Test for mappings and abbreviations
+
+STARTTEST
+:so small.vim
+:so mbyte.vim
+:set encoding=utf-8
+: " abbreviations with р (0x80) should work
+:inoreab чкпр vim
+GAчкпр
+
+:/^test/,$w! test.out
+:qa!
+ENDTEST
+
+test starts here:
+
diff --git a/src/testdir/test_mapping.ok b/src/testdir/test_mapping.ok
new file mode 100644
index 0000000..abdaea6
--- /dev/null
+++ b/src/testdir/test_mapping.ok
@@ -0,0 +1,2 @@
+test starts here:
+vim
diff --git a/src/testdir/test_signs.in b/src/testdir/test_signs.in
new file mode 100644
index 0000000..a2f15e9
--- /dev/null
+++ b/src/testdir/test_signs.in
@@ -0,0 +1,22 @@
+Tests for signs
+STARTTEST
+:so small.vim
+:if !has("signs")
+: e! test.ok
+: wq! test.out
+:endif
+:"
+:sign define JumpSign text=x
+:exe 'sign place 42 line=2 name=JumpSign buffer=' . bufnr('')
+:" Split the window to the bottom to verify :sign-jump will stay in the current
+:" window if the buffer is displayed there
+:bot split
+:exe 'sign jump 42 buffer=' . bufnr('')
+:call append(line('$'), winnr())
+:$-1,$w! test.out
+ENDTEST
+
+STARTTEST
+:qa!
+ENDTEST
+
diff --git a/src/testdir/test_signs.ok b/src/testdir/test_signs.ok
new file mode 100644
index 0000000..1f8c977
--- /dev/null
+++ b/src/testdir/test_signs.ok
@@ -0,0 +1,2 @@
+
+2
diff --git a/src/testdir/test_utf8.in b/src/testdir/test_utf8.in
new file mode 100644
index 0000000..713fee2
--- /dev/null
+++ b/src/testdir/test_utf8.in
@@ -0,0 +1,18 @@
+Tests for Unicode manipulations vim: set ft=vim :
+
+STARTTEST
+:so small.vim
+:set encoding=utf-8
+:" Visual block Insert adjusts for multi-byte char
+:new
+:call setline(1, ["aaa", "あああ", "bbb"])
+:exe ":norm! gg0l\<C-V>jjIx\<Esc>"
+:let r = getline(1, '$')
+:
+:bwipeout!
+:$put=r
+:call garbagecollect(1)
+:/^start:/,$wq! test.out
+ENDTEST
+
+start:
diff --git a/src/testdir/test_utf8.ok b/src/testdir/test_utf8.ok
new file mode 100644
index 0000000..c5bed54
--- /dev/null
+++ b/src/testdir/test_utf8.ok
@@ -0,0 +1,4 @@
+start:
+axaa
+xあああ
+bxbb
diff --git a/src/testdir/test_writefile.in b/src/testdir/test_writefile.in
new file mode 100644
index 0000000..f2dc7d5
--- /dev/null
+++ b/src/testdir/test_writefile.in
@@ -0,0 +1,18 @@
+Tests for writefile()
+
+STARTTEST
+:source small.vim
+:%delete _
+:let f = tempname()
+:call writefile(["over","written"], f, "b")
+:call writefile(["hello","world"], f, "b")
+:call writefile(["!", "good"], f, "a")
+:call writefile(["morning"], f, "ab")
+:call writefile(["", "vimmers"], f, "ab")
+:bwipeout!
+:$put =readfile(f)
+:1 delete _
+:w! test.out
+:qa!
+ENDTEST
+
diff --git a/src/testdir/test_writefile.ok b/src/testdir/test_writefile.ok
new file mode 100644
index 0000000..dfb6a2b
--- /dev/null
+++ b/src/testdir/test_writefile.ok
@@ -0,0 +1,5 @@
+hello
+world!
+good
+morning
+vimmers
diff --git a/src/ui.c b/src/ui.c
index 46c820b..afae14e 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -574,6 +574,51 @@ clip_copy_selection(clip)
}
/*
+ * Save and restore clip_unnamed before doing possibly many changes. This
+ * prevents accessing the clipboard very often which might slow down Vim
+ * considerably.
+ */
+
+/*
+ * Save clip_unnamed and reset it.
+ */
+ void
+start_global_changes()
+{
+ clip_unnamed_saved = clip_unnamed;
+
+ if (clip_did_set_selection > 0)
+ {
+ clip_unnamed = FALSE;
+ clip_did_set_selection = FALSE;
+ }
+}
+
+/*
+ * Restore clip_unnamed and set the selection when needed.
+ */
+ void
+end_global_changes()
+{
+ if (clip_did_set_selection == FALSE) /* not when -1 */
+ {
+ clip_did_set_selection = TRUE;
+ clip_unnamed = clip_unnamed_saved;
+ if (clip_unnamed & CLIP_UNNAMED)
+ {
+ clip_own_selection(&clip_star);
+ clip_gen_set_selection(&clip_star);
+ }
+ if (clip_unnamed & CLIP_UNNAMED_PLUS)
+ {
+ clip_own_selection(&clip_plus);
+ clip_gen_set_selection(&clip_plus);
+ }
+ }
+ clip_unnamed_saved = FALSE;
+}
+
+/*
* Called when Visual mode is ended: update the selection.
*/
void
@@ -1448,6 +1493,15 @@ clip_gen_lose_selection(cbd)
clip_gen_set_selection(cbd)
VimClipboard *cbd;
{
+ if (!clip_did_set_selection)
+ {
+ /* Updating postponed, so that accessing the system clipboard won't
+ * hang Vim when accessing it many times (e.g. on a :g comand). */
+ if (cbd == &clip_plus && (clip_unnamed_saved & CLIP_UNNAMED_PLUS))
+ return;
+ else if (cbd == &clip_star && (clip_unnamed_saved & CLIP_UNNAMED))
+ return;
+ }
#ifdef FEAT_XCLIPBOARD
# ifdef FEAT_GUI
if (gui.in_use)
diff --git a/src/undo.c b/src/undo.c
index 25ecfed..f5f6778 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -81,8 +81,25 @@
#define UH_MAGIC 0x18dade /* value for uh_magic when in use */
#define UE_MAGIC 0xabc123 /* value for ue_magic when in use */
+/* Size of buffer used for encryption. */
+#define CRYPT_BUF_SIZE 8192
+
#include "vim.h"
+/* Structure passed around between functions.
+ * Avoids passing cryptstate_T when encryption not available. */
+typedef struct {
+ buf_T *bi_buf;
+ FILE *bi_fp;
+#ifdef FEAT_CRYPT
+ cryptstate_T *bi_state;
+ char_u *bi_buffer; /* CRYPT_BUF_SIZE, NULL when not buffering */
+ size_t bi_used; /* bytes written to/read from bi_buffer */
+ size_t bi_avail; /* bytes available in bi_buffer */
+#endif
+} bufinfo_T;
+
+
static long get_undolevel __ARGS((void));
static void u_unch_branch __ARGS((u_header_T *uhp));
static u_entry_T *u_get_headentry __ARGS((void));
@@ -98,18 +115,26 @@ static void u_freeentry __ARGS((u_entry_T *, long));
#ifdef FEAT_PERSISTENT_UNDO
static void corruption_error __ARGS((char *mesg, char_u *file_name));
static void u_free_uhp __ARGS((u_header_T *uhp));
-static size_t fwrite_crypt __ARGS((buf_T *buf UNUSED, char_u *ptr, size_t len, FILE *fp));
-static char_u *read_string_decrypt __ARGS((buf_T *buf UNUSED, FILE *fd, int len));
-static int serialize_header __ARGS((FILE *fp, buf_T *buf, char_u *hash));
-static int serialize_uhp __ARGS((FILE *fp, buf_T *buf, u_header_T *uhp));
-static u_header_T *unserialize_uhp __ARGS((FILE *fp, char_u *file_name));
-static int serialize_uep __ARGS((FILE *fp, buf_T *buf, u_entry_T *uep));
-static u_entry_T *unserialize_uep __ARGS((FILE *fp, int *error, char_u *file_name));
-static void serialize_pos __ARGS((pos_T pos, FILE *fp));
-static void unserialize_pos __ARGS((pos_T *pos, FILE *fp));
-static void serialize_visualinfo __ARGS((visualinfo_T *info, FILE *fp));
-static void unserialize_visualinfo __ARGS((visualinfo_T *info, FILE *fp));
-static void put_header_ptr __ARGS((FILE *fp, u_header_T *uhp));
+static int undo_write __ARGS((bufinfo_T *bi, char_u *ptr, size_t len));
+static int undo_flush __ARGS((bufinfo_T *bi));
+static int fwrite_crypt __ARGS((bufinfo_T *bi, char_u *ptr, size_t len));
+static int undo_write_bytes __ARGS((bufinfo_T *bi, long_u nr, int len));
+static void put_header_ptr __ARGS((bufinfo_T *bi, u_header_T *uhp));
+static int undo_read_4c __ARGS((bufinfo_T *bi));
+static int undo_read_2c __ARGS((bufinfo_T *bi));
+static int undo_read_byte __ARGS((bufinfo_T *bi));
+static time_t undo_read_time __ARGS((bufinfo_T *bi));
+static int undo_read __ARGS((bufinfo_T *bi, char_u *buffer, size_t size));
+static char_u *read_string_decrypt __ARGS((bufinfo_T *bi, int len));
+static int serialize_header __ARGS((bufinfo_T *bi, char_u *hash));
+static int serialize_uhp __ARGS((bufinfo_T *bi, u_header_T *uhp));
+static u_header_T *unserialize_uhp __ARGS((bufinfo_T *bi, char_u *file_name));
+static int serialize_uep __ARGS((bufinfo_T *bi, u_entry_T *uep));
+static u_entry_T *unserialize_uep __ARGS((bufinfo_T *bi, int *error, char_u *file_name));
+static void serialize_pos __ARGS((bufinfo_T *bi, pos_T pos));
+static void unserialize_pos __ARGS((bufinfo_T *bi, pos_T *pos));
+static void serialize_visualinfo __ARGS((bufinfo_T *bi, visualinfo_T *info));
+static void unserialize_visualinfo __ARGS((bufinfo_T *bi, visualinfo_T *info));
#endif
#define U_ALLOC_LINE(size) lalloc((long_u)(size), FALSE)
@@ -859,68 +884,294 @@ u_free_uhp(uhp)
}
/*
- * Like fwrite() but crypt the bytes when 'key' is set.
- * Returns 1 if successful.
+ * Write a sequence of bytes to the undo file.
+ * Buffers and encrypts as needed.
+ * Returns OK or FAIL.
*/
- static size_t
-fwrite_crypt(buf, ptr, len, fp)
- buf_T *buf UNUSED;
+ static int
+undo_write(bi, ptr, len)
+ bufinfo_T *bi;
+ char_u *ptr;
+ size_t len;
+{
+#ifdef FEAT_CRYPT
+ if (bi->bi_buffer != NULL)
+ {
+ size_t len_todo = len;
+ char_u *p = ptr;
+
+ while (bi->bi_used + len_todo >= CRYPT_BUF_SIZE)
+ {
+ size_t n = CRYPT_BUF_SIZE - bi->bi_used;
+
+ mch_memmove(bi->bi_buffer + bi->bi_used, p, n);
+ len_todo -= n;
+ p += n;
+ bi->bi_used = CRYPT_BUF_SIZE;
+ if (undo_flush(bi) == FAIL)
+ return FAIL;
+ }
+ if (len_todo > 0)
+ {
+ mch_memmove(bi->bi_buffer + bi->bi_used, p, len_todo);
+ bi->bi_used += len_todo;
+ }
+ return OK;
+ }
+#endif
+ if (fwrite(ptr, len, (size_t)1, bi->bi_fp) != 1)
+ return FAIL;
+ return OK;
+}
+
+#ifdef FEAT_CRYPT
+ static int
+undo_flush(bi)
+ bufinfo_T *bi;
+{
+ if (bi->bi_buffer != NULL && bi->bi_used > 0)
+ {
+ crypt_encode_inplace(bi->bi_state, bi->bi_buffer, bi->bi_used);
+ if (fwrite(bi->bi_buffer, bi->bi_used, (size_t)1, bi->bi_fp) != 1)
+ return FAIL;
+ bi->bi_used = 0;
+ }
+ return OK;
+}
+#endif
+
+/*
+ * Write "ptr[len]" and crypt the bytes when needed.
+ * Returns OK or FAIL.
+ */
+ static int
+fwrite_crypt(bi, ptr, len)
+ bufinfo_T *bi;
char_u *ptr;
size_t len;
- FILE *fp;
{
#ifdef FEAT_CRYPT
char_u *copy;
char_u small_buf[100];
size_t i;
- if (*buf->b_p_key == NUL)
- return fwrite(ptr, len, (size_t)1, fp);
- if (len < 100)
- copy = small_buf; /* no malloc()/free() for short strings */
- else
+ if (bi->bi_state != NULL && bi->bi_buffer == NULL)
{
- copy = lalloc(len, FALSE);
- if (copy == NULL)
- return 0;
+ /* crypting every piece of text separately */
+ if (len < 100)
+ copy = small_buf; /* no malloc()/free() for short strings */
+ else
+ {
+ copy = lalloc(len, FALSE);
+ if (copy == NULL)
+ return 0;
+ }
+ crypt_encode(bi->bi_state, ptr, len, copy);
+ i = fwrite(copy, len, (size_t)1, bi->bi_fp);
+ if (copy != small_buf)
+ vim_free(copy);
+ return i == 1 ? OK : FAIL;
}
- crypt_encode(ptr, len, copy);
- i = fwrite(copy, len, (size_t)1, fp);
- if (copy != small_buf)
- vim_free(copy);
- return i;
-#else
- return fwrite(ptr, len, (size_t)1, fp);
#endif
+ return undo_write(bi, ptr, len);
}
/*
- * Read a string of length "len" from "fd".
- * When 'key' is set decrypt the bytes.
+ * Write a number, MSB first, in "len" bytes.
+ * Must match with undo_read_?c() functions.
+ * Returns OK or FAIL.
*/
- static char_u *
-read_string_decrypt(buf, fd, len)
- buf_T *buf UNUSED;
- FILE *fd;
+ static int
+undo_write_bytes(bi, nr, len)
+ bufinfo_T *bi;
+ long_u nr;
int len;
{
- char_u *ptr;
+ char_u buf[8];
+ int i;
+ int bufi = 0;
+
+ for (i = len - 1; i >= 0; --i)
+ buf[bufi++] = (char_u)(nr >> (i * 8));
+ return undo_write(bi, buf, (size_t)len);
+}
+
+/*
+ * Write the pointer to an undo header. Instead of writing the pointer itself
+ * we use the sequence number of the header. This is converted back to
+ * pointers when reading. */
+ static void
+put_header_ptr(bi, uhp)
+ bufinfo_T *bi;
+ u_header_T *uhp;
+{
+ undo_write_bytes(bi, (long_u)(uhp != NULL ? uhp->uh_seq : 0), 4);
+}
+
+ static int
+undo_read_4c(bi)
+ bufinfo_T *bi;
+{
+#ifdef FEAT_CRYPT
+ if (bi->bi_buffer != NULL)
+ {
+ char_u buf[4];
+ int n;
+
+ undo_read(bi, buf, (size_t)4);
+ n = ((unsigned)buf[0] << 24) + (buf[1] << 16) + (buf[2] << 8) + buf[3];
+ return n;
+ }
+#endif
+ return get4c(bi->bi_fp);
+}
+
+ static int
+undo_read_2c(bi)
+ bufinfo_T *bi;
+{
+#ifdef FEAT_CRYPT
+ if (bi->bi_buffer != NULL)
+ {
+ char_u buf[2];
+ int n;
+
+ undo_read(bi, buf, (size_t)2);
+ n = (buf[0] << 8) + buf[1];
+ return n;
+ }
+#endif
+ return get2c(bi->bi_fp);
+}
+
+ static int
+undo_read_byte(bi)
+ bufinfo_T *bi;
+{
+#ifdef FEAT_CRYPT
+ if (bi->bi_buffer != NULL)
+ {
+ char_u buf[1];
+
+ undo_read(bi, buf, (size_t)1);
+ return buf[0];
+ }
+#endif
+ return getc(bi->bi_fp);
+}
+
+ static time_t
+undo_read_time(bi)
+ bufinfo_T *bi;
+{
+#ifdef FEAT_CRYPT
+ if (bi->bi_buffer != NULL)
+ {
+ char_u buf[8];
+ time_t n = 0;
+ int i;
+
+ undo_read(bi, buf, (size_t)8);
+ for (i = 0; i < 8; ++i)
+ n = (n << 8) + buf[i];
+ return n;
+ }
+#endif
+ return get8ctime(bi->bi_fp);
+}
+
+/*
+ * Read "buffer[size]" from the undo file.
+ * Return OK or FAIL.
+ */
+ static int
+undo_read(bi, buffer, size)
+ bufinfo_T *bi;
+ char_u *buffer;
+ size_t size;
+{
+#ifdef FEAT_CRYPT
+ if (bi->bi_buffer != NULL)
+ {
+ int size_todo = (int)size;
+ char_u *p = buffer;
+
+ while (size_todo > 0)
+ {
+ size_t n;
+
+ if (bi->bi_used >= bi->bi_avail)
+ {
+ n = fread(bi->bi_buffer, 1, (size_t)CRYPT_BUF_SIZE, bi->bi_fp);
+ if (n <= 0)
+ {
+ /* Error may be checked for only later. Fill with zeros,
+ * so that the reader won't use garbage. */
+ vim_memset(p, 0, size_todo);
+ return FAIL;
+ }
+ bi->bi_avail = n;
+ bi->bi_used = 0;
+ crypt_decode_inplace(bi->bi_state, bi->bi_buffer, bi->bi_avail);
+ }
+ n = size_todo;
+ if (n > bi->bi_avail - bi->bi_used)
+ n = bi->bi_avail - bi->bi_used;
+ mch_memmove(p, bi->bi_buffer + bi->bi_used, n);
+ bi->bi_used += n;
+ size_todo -= (int)n;
+ p += n;
+ }
+ return OK;
+ }
+#endif
+ if (fread(buffer, (size_t)size, 1, bi->bi_fp) != 1)
+ return FAIL;
+ return OK;
+}
+
+/*
+ * Read a string of length "len" from "bi->bi_fd".
+ * "len" can be zero to allocate an empty line.
+ * Decrypt the bytes if needed.
+ * Append a NUL.
+ * Returns a pointer to allocated memory or NULL for failure.
+ */
+ static char_u *
+read_string_decrypt(bi, len)
+ bufinfo_T *bi;
+ int len;
+{
+ char_u *ptr = alloc((unsigned)len + 1);
- ptr = read_string(fd, len);
+ if (ptr != NULL)
+ {
+ if (len > 0 && undo_read(bi, ptr, len) == FAIL)
+ {
+ vim_free(ptr);
+ return NULL;
+ }
+ ptr[len] = NUL;
#ifdef FEAT_CRYPT
- if (ptr != NULL && *buf->b_p_key != NUL)
- crypt_decode(ptr, len);
+ if (bi->bi_state != NULL && bi->bi_buffer == NULL)
+ crypt_decode_inplace(bi->bi_state, ptr, len);
#endif
+ }
return ptr;
}
+/*
+ * Writes the (not encrypted) header and initializes encryption if needed.
+ */
static int
-serialize_header(fp, buf, hash)
- FILE *fp;
- buf_T *buf;
+serialize_header(bi, hash)
+ bufinfo_T *bi;
char_u *hash;
{
- int len;
+ int len;
+ buf_T *buf = bi->bi_buf;
+ FILE *fp = bi->bi_fp;
+ char_u time_buf[8];
/* Start writing, first the magic marker and undo info version. */
if (fwrite(UF_START_MAGIC, (size_t)UF_START_MAGIC_LEN, (size_t)1, fp) != 1)
@@ -934,108 +1185,124 @@ serialize_header(fp, buf, hash)
char_u *header;
int header_len;
- put_bytes(fp, (long_u)UF_VERSION_CRYPT, 2);
- header = prepare_crypt_write(buf, &header_len);
- if (header == NULL)
+ undo_write_bytes(bi, (long_u)UF_VERSION_CRYPT, 2);
+ bi->bi_state = crypt_create_for_writing(crypt_get_method_nr(buf),
+ buf->b_p_key, &header, &header_len);
+ if (bi->bi_state == NULL)
return FAIL;
len = (int)fwrite(header, (size_t)header_len, (size_t)1, fp);
vim_free(header);
if (len != 1)
{
- crypt_pop_state();
+ crypt_free_state(bi->bi_state);
+ bi->bi_state = NULL;
return FAIL;
}
+
+ if (crypt_whole_undofile(crypt_get_method_nr(buf)))
+ {
+ bi->bi_buffer = alloc(CRYPT_BUF_SIZE);
+ if (bi->bi_buffer == NULL)
+ {
+ crypt_free_state(bi->bi_state);
+ bi->bi_state = NULL;
+ return FAIL;
+ }
+ bi->bi_used = 0;
+ }
}
else
#endif
- put_bytes(fp, (long_u)UF_VERSION, 2);
+ undo_write_bytes(bi, (long_u)UF_VERSION, 2);
/* Write a hash of the buffer text, so that we can verify it is still the
* same when reading the buffer text. */
- if (fwrite(hash, (size_t)UNDO_HASH_SIZE, (size_t)1, fp) != 1)
+ if (undo_write(bi, hash, (size_t)UNDO_HASH_SIZE) == FAIL)
return FAIL;
/* buffer-specific data */
- put_bytes(fp, (long_u)buf->b_ml.ml_line_count, 4);
+ undo_write_bytes(bi, (long_u)buf->b_ml.ml_line_count, 4);
len = buf->b_u_line_ptr != NULL ? (int)STRLEN(buf->b_u_line_ptr) : 0;
- put_bytes(fp, (long_u)len, 4);
- if (len > 0 && fwrite_crypt(buf, buf->b_u_line_ptr, (size_t)len, fp) != 1)
+ undo_write_bytes(bi, (long_u)len, 4);
+ if (len > 0 && fwrite_crypt(bi, buf->b_u_line_ptr, (size_t)len) == FAIL)
return FAIL;
- put_bytes(fp, (long_u)buf->b_u_line_lnum, 4);
- put_bytes(fp, (long_u)buf->b_u_line_colnr, 4);
+ undo_write_bytes(bi, (long_u)buf->b_u_line_lnum, 4);
+ undo_write_bytes(bi, (long_u)buf->b_u_line_colnr, 4);
/* Undo structures header data */
- put_header_ptr(fp, buf->b_u_oldhead);
- put_header_ptr(fp, buf->b_u_newhead);
- put_header_ptr(fp, buf->b_u_curhead);
+ put_header_ptr(bi, buf->b_u_oldhead);
+ put_header_ptr(bi, buf->b_u_newhead);
+ put_header_ptr(bi, buf->b_u_curhead);
- put_bytes(fp, (long_u)buf->b_u_numhead, 4);
- put_bytes(fp, (long_u)buf->b_u_seq_last, 4);
- put_bytes(fp, (long_u)buf->b_u_seq_cur, 4);
- put_time(fp, buf->b_u_time_cur);
+ undo_write_bytes(bi, (long_u)buf->b_u_numhead, 4);
+ undo_write_bytes(bi, (long_u)buf->b_u_seq_last, 4);
+ undo_write_bytes(bi, (long_u)buf->b_u_seq_cur, 4);
+ time_to_bytes(buf->b_u_time_cur, time_buf);
+ undo_write(bi, time_buf, 8);
/* Optional fields. */
- putc(4, fp);
- putc(UF_LAST_SAVE_NR, fp);
- put_bytes(fp, (long_u)buf->b_u_save_nr_last, 4);
+ undo_write_bytes(bi, 4, 1);
+ undo_write_bytes(bi, UF_LAST_SAVE_NR, 1);
+ undo_write_bytes(bi, (long_u)buf->b_u_save_nr_last, 4);
- putc(0, fp); /* end marker */
+ undo_write_bytes(bi, 0, 1); /* end marker */
return OK;
}
static int
-serialize_uhp(fp, buf, uhp)
- FILE *fp;
- buf_T *buf;
+serialize_uhp(bi, uhp)
+ bufinfo_T *bi;
u_header_T *uhp;
{
int i;
u_entry_T *uep;
+ char_u time_buf[8];
- if (put_bytes(fp, (long_u)UF_HEADER_MAGIC, 2) == FAIL)
+ if (undo_write_bytes(bi, (long_u)UF_HEADER_MAGIC, 2) == FAIL)
return FAIL;
- put_header_ptr(fp, uhp->uh_next.ptr);
- put_header_ptr(fp, uhp->uh_prev.ptr);
- put_header_ptr(fp, uhp->uh_alt_next.ptr);
- put_header_ptr(fp, uhp->uh_alt_prev.ptr);
- put_bytes(fp, uhp->uh_seq, 4);
- serialize_pos(uhp->uh_cursor, fp);
+ put_header_ptr(bi, uhp->uh_next.ptr);
+ put_header_ptr(bi, uhp->uh_prev.ptr);
+ put_header_ptr(bi, uhp->uh_alt_next.ptr);
+ put_header_ptr(bi, uhp->uh_alt_prev.ptr);
+ undo_write_bytes(bi, uhp->uh_seq, 4);
+ serialize_pos(bi, uhp->uh_cursor);
#ifdef FEAT_VIRTUALEDIT
- put_bytes(fp, (long_u)uhp->uh_cursor_vcol, 4);
+ undo_write_bytes(bi, (long_u)uhp->uh_cursor_vcol, 4);
#else
- put_bytes(fp, (long_u)0, 4);
+ undo_write_bytes(bi, (long_u)0, 4);
#endif
- put_bytes(fp, (long_u)uhp->uh_flags, 2);
+ undo_write_bytes(bi, (long_u)uhp->uh_flags, 2);
/* Assume NMARKS will stay the same. */
for (i = 0; i < NMARKS; ++i)
- serialize_pos(uhp->uh_namedm[i], fp);
- serialize_visualinfo(&uhp->uh_visual, fp);
- put_time(fp, uhp->uh_time);
+ serialize_pos(bi, uhp->uh_namedm[i]);
+ serialize_visualinfo(bi, &uhp->uh_visual);
+ time_to_bytes(uhp->uh_time, time_buf);
+ undo_write(bi, time_buf, 8);
/* Optional fields. */
- putc(4, fp);
- putc(UHP_SAVE_NR, fp);
- put_bytes(fp, (long_u)uhp->uh_save_nr, 4);
+ undo_write_bytes(bi, 4, 1);
+ undo_write_bytes(bi, UHP_SAVE_NR, 1);
+ undo_write_bytes(bi, (long_u)uhp->uh_save_nr, 4);
- putc(0, fp); /* end marker */
+ undo_write_bytes(bi, 0, 1); /* end marker */
/* Write all the entries. */
for (uep = uhp->uh_entry; uep != NULL; uep = uep->ue_next)
{
- put_bytes(fp, (long_u)UF_ENTRY_MAGIC, 2);
- if (serialize_uep(fp, buf, uep) == FAIL)
+ undo_write_bytes(bi, (long_u)UF_ENTRY_MAGIC, 2);
+ if (serialize_uep(bi, uep) == FAIL)
return FAIL;
}
- put_bytes(fp, (long_u)UF_ENTRY_END_MAGIC, 2);
+ undo_write_bytes(bi, (long_u)UF_ENTRY_END_MAGIC, 2);
return OK;
}
static u_header_T *
-unserialize_uhp(fp, file_name)
- FILE *fp;
+unserialize_uhp(bi, file_name)
+ bufinfo_T *bi;
char_u *file_name;
{
u_header_T *uhp;
@@ -1051,56 +1318,56 @@ unserialize_uhp(fp, file_name)
#ifdef U_DEBUG
uhp->uh_magic = UH_MAGIC;
#endif
- uhp->uh_next.seq = get4c(fp);
- uhp->uh_prev.seq = get4c(fp);
- uhp->uh_alt_next.seq = get4c(fp);
- uhp->uh_alt_prev.seq = get4c(fp);
- uhp->uh_seq = get4c(fp);
+ uhp->uh_next.seq = undo_read_4c(bi);
+ uhp->uh_prev.seq = undo_read_4c(bi);
+ uhp->uh_alt_next.seq = undo_read_4c(bi);
+ uhp->uh_alt_prev.seq = undo_read_4c(bi);
+ uhp->uh_seq = undo_read_4c(bi);
if (uhp->uh_seq <= 0)
{
corruption_error("uh_seq", file_name);
vim_free(uhp);
return NULL;
}
- unserialize_pos(&uhp->uh_cursor, fp);
+ unserialize_pos(bi, &uhp->uh_cursor);
#ifdef FEAT_VIRTUALEDIT
- uhp->uh_cursor_vcol = get4c(fp);
+ uhp->uh_cursor_vcol = undo_read_4c(bi);
#else
- (void)get4c(fp);
+ (void)undo_read_4c(bi);
#endif
- uhp->uh_flags = get2c(fp);
+ uhp->uh_flags = undo_read_2c(bi);
for (i = 0; i < NMARKS; ++i)
- unserialize_pos(&uhp->uh_namedm[i], fp);
- unserialize_visualinfo(&uhp->uh_visual, fp);
- uhp->uh_time = get8ctime(fp);
+ unserialize_pos(bi, &uhp->uh_namedm[i]);
+ unserialize_visualinfo(bi, &uhp->uh_visual);
+ uhp->uh_time = undo_read_time(bi);
/* Optional fields. */
for (;;)
{
- int len = getc(fp);
+ int len = undo_read_byte(bi);
int what;
if (len == 0)
break;
- what = getc(fp);
+ what = undo_read_byte(bi);
switch (what)
{
case UHP_SAVE_NR:
- uhp->uh_save_nr = get4c(fp);
+ uhp->uh_save_nr = undo_read_4c(bi);
break;
default:
/* field not supported, skip */
while (--len >= 0)
- (void)getc(fp);
+ (void)undo_read_byte(bi);
}
}
/* Unserialize the uep list. */
last_uep = NULL;
- while ((c = get2c(fp)) == UF_ENTRY_MAGIC)
+ while ((c = undo_read_2c(bi)) == UF_ENTRY_MAGIC)
{
error = FALSE;
- uep = unserialize_uep(fp, &error, file_name);
+ uep = unserialize_uep(bi, &error, file_name);
if (last_uep == NULL)
uhp->uh_entry = uep;
else
@@ -1123,35 +1390,34 @@ unserialize_uhp(fp, file_name)
}
/*
- * Serialize "uep" to "fp".
+ * Serialize "uep".
*/
static int
-serialize_uep(fp, buf, uep)
- FILE *fp;
- buf_T *buf;
+serialize_uep(bi, uep)
+ bufinfo_T *bi;
u_entry_T *uep;
{
int i;
size_t len;
- put_bytes(fp, (long_u)uep->ue_top, 4);
- put_bytes(fp, (long_u)uep->ue_bot, 4);
- put_bytes(fp, (long_u)uep->ue_lcount, 4);
- put_bytes(fp, (long_u)uep->ue_size, 4);
+ undo_write_bytes(bi, (long_u)uep->ue_top, 4);
+ undo_write_bytes(bi, (long_u)uep->ue_bot, 4);
+ undo_write_bytes(bi, (long_u)uep->ue_lcount, 4);
+ undo_write_bytes(bi, (long_u)uep->ue_size, 4);
for (i = 0; i < uep->ue_size; ++i)
{
len = STRLEN(uep->ue_array[i]);
- if (put_bytes(fp, (long_u)len, 4) == FAIL)
+ if (undo_write_bytes(bi, (long_u)len, 4) == FAIL)
return FAIL;
- if (len > 0 && fwrite_crypt(buf, uep->ue_array[i], len, fp) != 1)
+ if (len > 0 && fwrite_crypt(bi, uep->ue_array[i], len) == FAIL)
return FAIL;
}
return OK;
}
static u_entry_T *
-unserialize_uep(fp, error, file_name)
- FILE *fp;
+unserialize_uep(bi, error, file_name)
+ bufinfo_T *bi;
int *error;
char_u *file_name;
{
@@ -1168,10 +1434,10 @@ unserialize_uep(fp, error, file_name)
#ifdef U_DEBUG
uep->ue_magic = UE_MAGIC;
#endif
- uep->ue_top = get4c(fp);
- uep->ue_bot = get4c(fp);
- uep->ue_lcount = get4c(fp);
- uep->ue_size = get4c(fp);
+ uep->ue_top = undo_read_4c(bi);
+ uep->ue_bot = undo_read_4c(bi);
+ uep->ue_lcount = undo_read_4c(bi);
+ uep->ue_size = undo_read_4c(bi);
if (uep->ue_size > 0)
{
array = (char_u **)U_ALLOC_LINE(sizeof(char_u *) * uep->ue_size);
@@ -1188,9 +1454,9 @@ unserialize_uep(fp, error, file_name)
for (i = 0; i < uep->ue_size; ++i)
{
- line_len = get4c(fp);
+ line_len = undo_read_4c(bi);
if (line_len >= 0)
- line = read_string_decrypt(curbuf, fp, line_len);
+ line = read_string_decrypt(bi, line_len);
else
{
line = NULL;
@@ -1207,83 +1473,71 @@ unserialize_uep(fp, error, file_name)
}
/*
- * Serialize "pos" to "fp".
+ * Serialize "pos".
*/
static void
-serialize_pos(pos, fp)
+serialize_pos(bi, pos)
+ bufinfo_T *bi;
pos_T pos;
- FILE *fp;
{
- put_bytes(fp, (long_u)pos.lnum, 4);
- put_bytes(fp, (long_u)pos.col, 4);
+ undo_write_bytes(bi, (long_u)pos.lnum, 4);
+ undo_write_bytes(bi, (long_u)pos.col, 4);
#ifdef FEAT_VIRTUALEDIT
- put_bytes(fp, (long_u)pos.coladd, 4);
+ undo_write_bytes(bi, (long_u)pos.coladd, 4);
#else
- put_bytes(fp, (long_u)0, 4);
+ undo_write_bytes(bi, (long_u)0, 4);
#endif
}
/*
- * Unserialize the pos_T at the current position in fp.
+ * Unserialize the pos_T at the current position.
*/
static void
-unserialize_pos(pos, fp)
+unserialize_pos(bi, pos)
+ bufinfo_T *bi;
pos_T *pos;
- FILE *fp;
{
- pos->lnum = get4c(fp);
+ pos->lnum = undo_read_4c(bi);
if (pos->lnum < 0)
pos->lnum = 0;
- pos->col = get4c(fp);
+ pos->col = undo_read_4c(bi);
if (pos->col < 0)
pos->col = 0;
#ifdef FEAT_VIRTUALEDIT
- pos->coladd = get4c(fp);
+ pos->coladd = undo_read_4c(bi);
if (pos->coladd < 0)
pos->coladd = 0;
#else
- (void)get4c(fp);
+ (void)undo_read_4c(bi);
#endif
}
/*
- * Serialize "info" to "fp".
+ * Serialize "info".
*/
static void
-serialize_visualinfo(info, fp)
+serialize_visualinfo(bi, info)
+ bufinfo_T *bi;
visualinfo_T *info;
- FILE *fp;
{
- serialize_pos(info->vi_start, fp);
- serialize_pos(info->vi_end, fp);
- put_bytes(fp, (long_u)info->vi_mode, 4);
- put_bytes(fp, (long_u)info->vi_curswant, 4);
+ serialize_pos(bi, info->vi_start);
+ serialize_pos(bi, info->vi_end);
+ undo_write_bytes(bi, (long_u)info->vi_mode, 4);
+ undo_write_bytes(bi, (long_u)info->vi_curswant, 4);
}
/*
- * Unserialize the visualinfo_T at the current position in fp.
+ * Unserialize the visualinfo_T at the current position.
*/
static void
-unserialize_visualinfo(info, fp)
+unserialize_visualinfo(bi, info)
+ bufinfo_T *bi;
visualinfo_T *info;
- FILE *fp;
-{
- unserialize_pos(&info->vi_start, fp);
- unserialize_pos(&info->vi_end, fp);
- info->vi_mode = get4c(fp);
- info->vi_curswant = get4c(fp);
-}
-
-/*
- * Write the pointer to an undo header. Instead of writing the pointer itself
- * we use the sequence number of the header. This is converted back to
- * pointers when reading. */
- static void
-put_header_ptr(fp, uhp)
- FILE *fp;
- u_header_T *uhp;
{
- put_bytes(fp, (long_u)(uhp != NULL ? uhp->uh_seq : 0), 4);
+ unserialize_pos(bi, &info->vi_start);
+ unserialize_pos(bi, &info->vi_end);
+ info->vi_mode = undo_read_4c(bi);
+ info->vi_curswant = undo_read_4c(bi);
}
/*
@@ -1317,9 +1571,9 @@ u_write_undo(name, forceit, buf, hash)
struct stat st_old;
struct stat st_new;
#endif
-#ifdef FEAT_CRYPT
- int do_crypt = FALSE;
-#endif
+ bufinfo_T bi;
+
+ vim_memset(&bi, 0, sizeof(bi));
if (name == NULL)
{
@@ -1474,14 +1728,12 @@ u_write_undo(name, forceit, buf, hash)
u_sync(TRUE);
/*
- * Write the header.
+ * Write the header. Initializes encryption, if enabled.
*/
- if (serialize_header(fp, buf, hash) == FAIL)
+ bi.bi_buf = buf;
+ bi.bi_fp = fp;
+ if (serialize_header(&bi, hash) == FAIL)
goto write_error;
-#ifdef FEAT_CRYPT
- if (*buf->b_p_key != NUL)
- do_crypt = TRUE;
-#endif
/*
* Iteratively serialize UHPs and their UEPs from the top down.
@@ -1497,7 +1749,7 @@ u_write_undo(name, forceit, buf, hash)
#ifdef U_DEBUG
++headers_written;
#endif
- if (serialize_uhp(fp, buf, uhp) == FAIL)
+ if (serialize_uhp(&bi, uhp) == FAIL)
goto write_error;
}
@@ -1516,7 +1768,7 @@ u_write_undo(name, forceit, buf, hash)
uhp = uhp->uh_next.ptr;
}
- if (put_bytes(fp, (long_u)UF_HEADER_END_MAGIC, 2) == OK)
+ if (undo_write_bytes(&bi, (long_u)UF_HEADER_END_MAGIC, 2) == OK)
write_ok = TRUE;
#ifdef U_DEBUG
if (headers_written != buf->b_u_numhead)
@@ -1526,6 +1778,11 @@ u_write_undo(name, forceit, buf, hash)
}
#endif
+#ifdef FEAT_CRYPT
+ if (bi.bi_state != NULL && undo_flush(&bi) == FAIL)
+ write_ok = FALSE;
+#endif
+
write_error:
fclose(fp);
if (!write_ok)
@@ -1551,8 +1808,9 @@ write_error:
theend:
#ifdef FEAT_CRYPT
- if (do_crypt)
- crypt_pop_state();
+ if (bi.bi_state != NULL)
+ crypt_free_state(bi.bi_state);
+ vim_free(bi.bi_buffer);
#endif
if (file_name != name)
vim_free(file_name);
@@ -1598,10 +1856,9 @@ u_read_undo(name, hash, orig_name)
struct stat st_orig;
struct stat st_undo;
#endif
-#ifdef FEAT_CRYPT
- int do_decrypt = FALSE;
-#endif
+ bufinfo_T bi;
+ vim_memset(&bi, 0, sizeof(bi));
if (name == NULL)
{
file_name = u_get_undo_file_name(curbuf->b_ffname, TRUE);
@@ -1644,6 +1901,8 @@ u_read_undo(name, hash, orig_name)
EMSG2(_("E822: Cannot open undo file for reading: %s"), file_name);
goto error;
}
+ bi.bi_buf = curbuf;
+ bi.bi_fp = fp;
/*
* Read the undo file header.
@@ -1664,12 +1923,24 @@ u_read_undo(name, hash, orig_name)
file_name);
goto error;
}
- if (prepare_crypt_read(fp) == FAIL)
+ bi.bi_state = crypt_create_from_file(fp, curbuf->b_p_key);
+ if (bi.bi_state == NULL)
{
EMSG2(_("E826: Undo file decryption failed: %s"), file_name);
goto error;
}
- do_decrypt = TRUE;
+ if (crypt_whole_undofile(bi.bi_state->method_nr))
+ {
+ bi.bi_buffer = alloc(CRYPT_BUF_SIZE);
+ if (bi.bi_buffer == NULL)
+ {
+ crypt_free_state(bi.bi_state);
+ bi.bi_state = NULL;
+ goto error;
+ }
+ bi.bi_avail = 0;
+ bi.bi_used = 0;
+ }
#else
EMSG2(_("E827: Undo file is encrypted: %s"), file_name);
goto error;
@@ -1681,12 +1952,12 @@ u_read_undo(name, hash, orig_name)
goto error;
}
- if (fread(read_hash, UNDO_HASH_SIZE, 1, fp) != 1)
+ if (undo_read(&bi, read_hash, (size_t)UNDO_HASH_SIZE) == FAIL)
{
corruption_error("hash", file_name);
goto error;
}
- line_count = (linenr_T)get4c(fp);
+ line_count = (linenr_T)undo_read_4c(&bi);
if (memcmp(hash, read_hash, UNDO_HASH_SIZE) != 0
|| line_count != curbuf->b_ml.ml_line_count)
{
@@ -1703,13 +1974,13 @@ u_read_undo(name, hash, orig_name)
}
/* Read undo data for "U" command. */
- str_len = get4c(fp);
+ str_len = undo_read_4c(&bi);
if (str_len < 0)
goto error;
if (str_len > 0)
- line_ptr = read_string_decrypt(curbuf, fp, str_len);
- line_lnum = (linenr_T)get4c(fp);
- line_colnr = (colnr_T)get4c(fp);
+ line_ptr = read_string_decrypt(&bi, str_len);
+ line_lnum = (linenr_T)undo_read_4c(&bi);
+ line_colnr = (colnr_T)undo_read_4c(&bi);
if (line_lnum < 0 || line_colnr < 0)
{
corruption_error("line lnum/col", file_name);
@@ -1717,32 +1988,32 @@ u_read_undo(name, hash, orig_name)
}
/* Begin general undo data */
- old_header_seq = get4c(fp);
- new_header_seq = get4c(fp);
- cur_header_seq = get4c(fp);
- num_head = get4c(fp);
- seq_last = get4c(fp);
- seq_cur = get4c(fp);
- seq_time = get8ctime(fp);
+ old_header_seq = undo_read_4c(&bi);
+ new_header_seq = undo_read_4c(&bi);
+ cur_header_seq = undo_read_4c(&bi);
+ num_head = undo_read_4c(&bi);
+ seq_last = undo_read_4c(&bi);
+ seq_cur = undo_read_4c(&bi);
+ seq_time = undo_read_time(&bi);
/* Optional header fields. */
for (;;)
{
- int len = getc(fp);
+ int len = undo_read_byte(&bi);
int what;
if (len == 0 || len == EOF)
break;
- what = getc(fp);
+ what = undo_read_byte(&bi);
switch (what)
{
case UF_LAST_SAVE_NR:
- last_save_nr = get4c(fp);
+ last_save_nr = undo_read_4c(&bi);
break;
default:
/* field not supported, skip */
while (--len >= 0)
- (void)getc(fp);
+ (void)undo_read_byte(&bi);
}
}
@@ -1758,7 +2029,7 @@ u_read_undo(name, hash, orig_name)
goto error;
}
- while ((c = get2c(fp)) == UF_HEADER_MAGIC)
+ while ((c = undo_read_2c(&bi)) == UF_HEADER_MAGIC)
{
if (num_read_uhps >= num_head)
{
@@ -1766,7 +2037,7 @@ u_read_undo(name, hash, orig_name)
goto error;
}
- uhp = unserialize_uhp(fp, file_name);
+ uhp = unserialize_uhp(&bi, file_name);
if (uhp == NULL)
goto error;
uhp_table[num_read_uhps++] = uhp;
@@ -1898,8 +2169,9 @@ error:
theend:
#ifdef FEAT_CRYPT
- if (do_decrypt)
- crypt_pop_state();
+ if (bi.bi_state != NULL)
+ crypt_free_state(bi.bi_state);
+ vim_free(bi.bi_buffer);
#endif
if (fp != NULL)
fclose(fp);
diff --git a/src/version.c b/src/version.c
index 54f39b3..a462c19 100644
--- a/src/version.c
+++ b/src/version.c
@@ -189,6 +189,13 @@ static char *(features[]) =
#else
"-digraphs",
#endif
+#ifdef FEAT_GUI_W32
+# ifdef FEAT_DIRECTX
+ "+directx",
+# else
+ "-directx",
+# endif
+#endif
#ifdef FEAT_DND
"+dnd",
#else
@@ -750,6 +757,320 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 540,
+/**/
+ 539,
+/**/
+ 538,
+/**/
+ 537,
+/**/
+ 536,
+/**/
+ 535,
+/**/
+ 534,
+/**/
+ 533,
+/**/
+ 532,
+/**/
+ 531,
+/**/
+ 530,
+/**/
+ 529,
+/**/
+ 528,
+/**/
+ 527,
+/**/
+ 526,
+/**/
+ 525,
+/**/
+ 524,
+/**/
+ 523,
+/**/
+ 522,
+/**/
+ 521,
+/**/
+ 520,
+/**/
+ 519,
+/**/
+ 518,
+/**/
+ 517,
+/**/
+ 516,
+/**/
+ 515,
+/**/
+ 514,
+/**/
+ 513,
+/**/
+ 512,
+/**/
+ 511,
+/**/
+ 510,
+/**/
+ 509,
+/**/
+ 508,
+/**/
+ 507,
+/**/
+ 506,
+/**/
+ 505,
+/**/
+ 504,
+/**/
+ 503,
+/**/
+ 502,
+/**/
+ 501,
+/**/
+ 500,
+/**/
+ 499,
+/**/
+ 498,
+/**/
+ 497,
+/**/
+ 496,
+/**/
+ 495,
+/**/
+ 494,
+/**/
+ 493,
+/**/
+ 492,
+/**/
+ 491,
+/**/
+ 490,
+/**/
+ 489,
+/**/
+ 488,
+/**/
+ 487,
+/**/
+ 486,
+/**/
+ 485,
+/**/
+ 484,
+/**/
+ 483,
+/**/
+ 482,
+/**/
+ 481,
+/**/
+ 480,
+/**/
+ 479,
+/**/
+ 478,
+/**/
+ 477,
+/**/
+ 476,
+/**/
+ 475,
+/**/
+ 474,
+/**/
+ 473,
+/**/
+ 472,
+/**/
+ 471,
+/**/
+ 470,
+/**/
+ 469,
+/**/
+ 468,
+/**/
+ 467,
+/**/
+ 466,
+/**/
+ 465,
+/**/
+ 464,
+/**/
+ 463,
+/**/
+ 462,
+/**/
+ 461,
+/**/
+ 460,
+/**/
+ 459,
+/**/
+ 458,
+/**/
+ 457,
+/**/
+ 456,
+/**/
+ 455,
+/**/
+ 454,
+/**/
+ 453,
+/**/
+ 452,
+/**/
+ 451,
+/**/
+ 450,
+/**/
+ 449,
+/**/
+ 448,
+/**/
+ 447,
+/**/
+ 446,
+/**/
+ 445,
+/**/
+ 444,
+/**/
+ 443,
+/**/
+ 442,
+/**/
+ 441,
+/**/
+ 440,
+/**/
+ 439,
+/**/
+ 438,
+/**/
+ 437,
+/**/
+ 436,
+/**/
+ 435,
+/**/
+ 434,
+/**/
+ 433,
+/**/
+ 432,
+/**/
+ 431,
+/**/
+ 430,
+/**/
+ 429,
+/**/
+ 428,
+/**/
+ 427,
+/**/
+ 426,
+/**/
+ 425,
+/**/
+ 424,
+/**/
+ 423,
+/**/
+ 422,
+/**/
+ 421,
+/**/
+ 420,
+/**/
+ 419,
+/**/
+ 418,
+/**/
+ 417,
+/**/
+ 416,
+/**/
+ 415,
+/**/
+ 414,
+/**/
+ 413,
+/**/
+ 412,
+/**/
+ 411,
+/**/
+ 410,
+/**/
+ 409,
+/**/
+ 408,
+/**/
+ 407,
+/**/
+ 406,
+/**/
+ 405,
+/**/
+ 404,
+/**/
+ 403,
+/**/
+ 402,
+/**/
+ 401,
+/**/
+ 400,
+/**/
+ 399,
+/**/
+ 398,
+/**/
+ 397,
+/**/
+ 396,
+/**/
+ 395,
+/**/
+ 394,
+/**/
+ 393,
+/**/
+ 392,
+/**/
+ 391,
+/**/
+ 390,
+/**/
+ 389,
+/**/
+ 388,
+/**/
+ 387,
+/**/
+ 386,
+/**/
+ 385,
+/**/
+ 384,
+/**/
383,
/**/
382,
diff --git a/src/vim.h b/src/vim.h
index 730c63a..05f2210 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -135,6 +135,13 @@
# endif
#endif
+/* Check support for rendering options */
+#ifdef FEAT_GUI
+# if defined(FEAT_DIRECTX)
+# define FEAT_RENDER_OPTIONS
+# endif
+#endif
+
/* Visual Studio 2005 has 'deprecated' many of the standard CRT functions */
#if _MSC_VER >= 1400
# define _CRT_SECURE_NO_DEPRECATE
@@ -831,6 +838,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname);
#define EW_ICASE 0x100 /* ignore case */
#define EW_NOERROR 0x200 /* no error for bad regexp */
#define EW_NOTWILD 0x400 /* add match with literal name if exists */
+#define EW_KEEPDOLLAR 0x800 /* do not escape $, $var is expanded */
/* Note: mostly EW_NOTFOUND and EW_SILENT are mutually exclusive: EW_NOTFOUND
* is used when executing commands and EW_SILENT for interactive expanding. */
@@ -1322,6 +1330,7 @@ enum auto_event
EVENT_SHELLFILTERPOST, /* after ":1,2!cmd", ":w !cmd", ":r !cmd". */
EVENT_TEXTCHANGED, /* text was modified */
EVENT_TEXTCHANGEDI, /* text was modified in Insert mode*/
+ EVENT_CMDUNDEFINED, /* command undefined */
NUM_EVENTS /* MUST be the last one */
};
@@ -1992,7 +2001,7 @@ typedef int VimClipboard; /* This is required for the prototypes. */
#ifndef FEAT_VIRTUALEDIT
# define getvvcol(w, p, s, c, e) getvcol(w, p, s, c, e)
-# define virtual_active() 0
+# define virtual_active() FALSE
# define virtual_op FALSE
#endif
@@ -2271,7 +2280,7 @@ typedef int VimClipboard; /* This is required for the prototypes. */
#define AUTOLOAD_CHAR '#'
#ifdef FEAT_EVAL
-# define SET_NO_HLSEARCH(flag) no_hlsearch = (flag); set_vim_var_nr(VV_HLSEARCH, !no_hlsearch)
+# define SET_NO_HLSEARCH(flag) no_hlsearch = (flag); set_vim_var_nr(VV_HLSEARCH, !no_hlsearch && p_hls)
#else
# define SET_NO_HLSEARCH(flag) no_hlsearch = (flag)
#endif
diff --git a/src/window.c b/src/window.c
index d9cd699..2e4bcf5 100644
--- a/src/window.c
+++ b/src/window.c
@@ -199,14 +199,22 @@ newwindow:
case Ctrl_Q:
case 'q':
reset_VIsual_and_resel(); /* stop Visual mode */
- do_cmdline_cmd((char_u *)"quit");
+ STRCPY(cbuf, "quit");
+ if (Prenum)
+ vim_snprintf((char *)cbuf + 4, sizeof(cbuf) - 5,
+ "%ld", Prenum);
+ do_cmdline_cmd(cbuf);
break;
/* close current window */
case Ctrl_C:
case 'c':
reset_VIsual_and_resel(); /* stop Visual mode */
- do_cmdline_cmd((char_u *)"close");
+ STRCPY(cbuf, "close");
+ if (Prenum)
+ vim_snprintf((char *)cbuf + 5, sizeof(cbuf) - 5,
+ "%ld", Prenum);
+ do_cmdline_cmd(cbuf);
break;
#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
@@ -235,7 +243,11 @@ newwindow:
case 'o':
CHECK_CMDWIN
reset_VIsual_and_resel(); /* stop Visual mode */
- do_cmdline_cmd((char_u *)"only");
+ STRCPY(cbuf, "only");
+ if (Prenum > 0)
+ vim_snprintf((char *)cbuf + 4, sizeof(cbuf) - 4,
+ "%ld", Prenum);
+ do_cmdline_cmd(cbuf);
break;
/* cursor to next window with wrap around */
@@ -479,14 +491,18 @@ newwindow:
case ']':
case Ctrl_RSB:
CHECK_CMDWIN
- reset_VIsual_and_resel(); /* stop Visual mode */
+ /* keep Visual mode, can select words to use as a tag */
if (Prenum)
postponed_split = Prenum;
else
postponed_split = -1;
+#ifdef FEAT_QUICKFIX
+ if (nchar != '}')
+ g_do_tagpreview = 0;
+#endif
- /* Execute the command right here, required when
- * "wincmd ]" was used in a function. */
+ /* Execute the command right here, required when "wincmd ]"
+ * was used in a function. */
do_nv_ident(Ctrl_RSB, NUL);
break;
@@ -590,7 +606,7 @@ wingotofile:
#endif
case ']':
case Ctrl_RSB:
- reset_VIsual_and_resel(); /* stop Visual mode */
+ /* keep Visual mode, can select words to use as a tag */
if (Prenum)
postponed_split = Prenum;
else
@@ -792,7 +808,7 @@ win_split_ins(size, flags, new_wp, dir)
if (frp->fr_win != oldwin && frp->fr_win != NULL
&& (frp->fr_win->w_width > new_size
|| frp->fr_win->w_width > oldwin->w_width
- - new_size - STATUS_HEIGHT))
+ - new_size - 1))
{
do_equal = TRUE;
break;
@@ -1183,6 +1199,11 @@ win_split_ins(size, flags, new_wp, dir)
p_wh = size;
}
+#ifdef FEAT_JUMPLIST
+ /* Keep same changelist position in new window. */
+ wp->w_changelistidx = oldwin->w_changelistidx;
+#endif
+
/*
* make the new window the current window
*/
@@ -1271,7 +1292,7 @@ win_init(newp, oldp, flags)
}
/*
- * Initialize window "newp" from window"old".
+ * Initialize window "newp" from window "old".
* Only the essential things are copied.
*/
static void
@@ -4403,20 +4424,19 @@ win_enter_ext(wp, undo_sync, curwin_invalid, trigger_enter_autocmds, trigger_lea
buf_jump_open_win(buf)
buf_T *buf;
{
-# ifdef FEAT_WINDOWS
- win_T *wp;
+ win_T *wp = NULL;
- for (wp = firstwin; wp != NULL; wp = wp->w_next)
- if (wp->w_buffer == buf)
- break;
+ if (curwin->w_buffer == buf)
+ wp = curwin;
+# ifdef FEAT_WINDOWS
+ else
+ for (wp = firstwin; wp != NULL; wp = wp->w_next)
+ if (wp->w_buffer == buf)
+ break;
if (wp != NULL)
win_enter(wp, FALSE);
- return wp;
-# else
- if (curwin->w_buffer == buf)
- return curwin;
- return NULL;
# endif
+ return wp;
}
/*
@@ -4428,12 +4448,10 @@ buf_jump_open_win(buf)
buf_jump_open_tab(buf)
buf_T *buf;
{
+ win_T *wp = buf_jump_open_win(buf);
# ifdef FEAT_WINDOWS
- win_T *wp;
tabpage_T *tp;
- /* First try the current tab page. */
- wp = buf_jump_open_win(buf);
if (wp != NULL)
return wp;
@@ -4451,13 +4469,8 @@ buf_jump_open_tab(buf)
break;
}
}
-
- return wp;
-# else
- if (curwin->w_buffer == buf)
- return curwin;
- return NULL;
# endif
+ return wp;
}
#endif
@@ -6667,8 +6680,8 @@ restore_snapshot_rec(sn, fr)
|| defined(PROTO)
/*
* Set "win" to be the curwin and "tp" to be the current tab page.
- * restore_win() MUST be called to undo.
- * No autocommands will be executed.
+ * restore_win() MUST be called to undo, also when FAIL is returned.
+ * No autocommands will be executed until restore_win() is called.
* When "no_display" is TRUE the display won't be affected, no redraw is
* triggered, another tabpage access is limited.
* Returns FAIL if switching to "win" failed.
@@ -6701,12 +6714,7 @@ switch_win(save_curwin, save_curtab, win, tp, no_display)
goto_tabpage_tp(tp, FALSE, FALSE);
}
if (!win_valid(win))
- {
-# ifdef FEAT_AUTOCMD
- unblock_autocmds();
-# endif
return FAIL;
- }
curwin = win;
curbuf = curwin->w_buffer;
# endif
--
2.2.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment