diff options
64 files changed, 867 insertions, 619 deletions
diff --git a/.ci/clang-asan.sh b/.ci/clang-asan.sh index c6f28848d1..b1909ea689 100644 --- a/.ci/clang-asan.sh +++ b/.ci/clang-asan.sh @@ -1,19 +1,30 @@ . "$CI_SCRIPTS/common.sh" -set_environment /opt/neovim-deps/64 - sudo pip install cpp-coveralls -clang_version=3.4 +if [ "$TRAVIS_OS_NAME" = "linux" ]; then + clang_version=3.4.2 + clang_suffix=x86_64-unknown-ubuntu12.04.xz +elif [ "$TRAVIS_OS_NAME" = "osx" ]; then + clang_version=3.5.0 + clang_suffix=macosx-apple-darwin.tar.xz +else + echo "Unknown OS '$TRAVIS_OS_NAME'." + exit 1 +fi + if [ ! -d /usr/local/clang-$clang_version ]; then echo "Downloading clang $clang_version..." sudo mkdir /usr/local/clang-$clang_version - wget -q -O - http://llvm.org/releases/$clang_version/clang+llvm-$clang_version-x86_64-unknown-ubuntu12.04.xz \ + wget -q -O - http://llvm.org/releases/$clang_version/clang+llvm-$clang_version-$clang_suffix \ | sudo tar xJf - --strip-components=1 -C /usr/local/clang-$clang_version fi + export CC=/usr/local/clang-$clang_version/bin/clang symbolizer=/usr/local/clang-$clang_version/bin/llvm-symbolizer +setup_prebuilt_deps x64 + export SANITIZE=1 export ASAN_SYMBOLIZER_PATH=$symbolizer export ASAN_OPTIONS="detect_leaks=1:log_path=$tmpdir/asan" @@ -22,14 +33,20 @@ export TSAN_OPTIONS="external_symbolizer_path=$symbolizer:log_path=$tmpdir/tsan" export SKIP_UNITTEST=1 export UBSAN_OPTIONS="log_path=$tmpdir/ubsan" # not sure if this works -install_dir="$(pwd)/dist" -$MAKE_CMD cmake CMAKE_EXTRA_FLAGS="-DTRAVIS_CI_BUILD=ON -DCMAKE_INSTALL_PREFIX=$install_dir -DUSE_GCOV=ON" +CMAKE_EXTRA_FLAGS="-DTRAVIS_CI_BUILD=ON -DUSE_GCOV=ON" + +# Build and output version info. +$MAKE_CMD CMAKE_EXTRA_FLAGS="$CMAKE_EXTRA_FLAGS" nvim +build/bin/nvim --version + +# Run functional tests. if ! $MAKE_CMD test; then asan_check "$tmpdir" exit 1 fi asan_check "$tmpdir" +# Run legacy tests. if ! $MAKE_CMD oldtest; then reset asan_check "$tmpdir" @@ -39,4 +56,7 @@ asan_check "$tmpdir" coveralls --encoding iso-8859-1 || echo 'coveralls upload failed.' -$MAKE_CMD install +# Test if correctly installed. +sudo -E $MAKE_CMD install +/usr/local/bin/nvim --version +/usr/local/bin/nvim -e -c "quit" diff --git a/.ci/common.sh b/.ci/common.sh index 8498d16506..b27a756683 100644 --- a/.ci/common.sh +++ b/.ci/common.sh @@ -35,43 +35,11 @@ check_core_dumps() { done } -set_environment() { - local prefix="$1/usr" - eval $($prefix/bin/luarocks path) - export PATH="$prefix/bin:$PATH" - export PKG_CONFIG_PATH="$prefix/lib/pkgconfig" - export USE_BUNDLED_DEPS=OFF -} - - -install_prebuilt_deps() { - # install prebuilt dependencies - if [ ! -d /opt/neovim-deps ]; then - cd /opt - sudo git clone --depth=1 git://github.com/neovim/deps neovim-deps - cd - - fi +setup_prebuilt_deps() { + eval "$(curl -Ss https://raw.githubusercontent.com/neovim/bot-ci/master/scripts/travis-setup.sh) deps-${1}" } tmpdir="$(pwd)/tmp" rm -rf "$tmpdir" mkdir -p "$tmpdir" suppressions="$(pwd)/.valgrind.supp" - -# Travis reports back that it has 32-cores via /proc/cpuinfo, but it's not -# what we really have available. According to their documentation, it only has -# 1.5 virtual cores. -# See: -# http://docs.travis-ci.com/user/speeding-up-the-build/#Paralellizing-your-build-on-one-VM -# for more information. -MAKE_CMD="make -j2" - -install_prebuilt_deps - -# Pins the version of the java package installed on the Travis VMs -# and avoids a lengthy upgrade process for them. -sudo apt-mark hold oracle-java7-installer oracle-java8-installer - -sudo apt-get update - -export CFLAGS='-DMIN_LOG_LEVEL=0' # force verification of DLOG macros diff --git a/.ci/gcc-32.sh b/.ci/gcc-32.sh index aea996f5a0..13b2d46d8f 100644 --- a/.ci/gcc-32.sh +++ b/.ci/gcc-32.sh @@ -1,6 +1,6 @@ . "$CI_SCRIPTS/common.sh" -set_environment /opt/neovim-deps/32 +setup_prebuilt_deps x86 # Need this to keep apt-get from removing gcc when installing libncurses # below. @@ -21,8 +21,17 @@ CMAKE_EXTRA_FLAGS="-DTRAVIS_CI_BUILD=ON \ -DCMAKE_IGNORE_PATH=/lib:/usr/lib:/usr/local/lib \ -DCMAKE_TOOLCHAIN_FILE=cmake/i386-linux-gnu.toolchain.cmake" -$MAKE_CMD CMAKE_EXTRA_FLAGS="${CMAKE_EXTRA_FLAGS}" unittest +# Build and output version info. +$MAKE_CMD CMAKE_EXTRA_FLAGS="$CMAKE_EXTRA_FLAGS" nvim +build/bin/nvim --version + +# Run unittests. +$MAKE_CMD unittest + +# Run functional tests. $MAKE_CMD test check_core_dumps + +# Run legacy tests. $MAKE_CMD oldtest check_core_dumps diff --git a/.ci/gcc.sh b/.ci/gcc.sh index b4a331cfed..8d09c756a7 100644 --- a/.ci/gcc.sh +++ b/.ci/gcc.sh @@ -1,23 +1,37 @@ . "$CI_SCRIPTS/common.sh" -set_environment /opt/neovim-deps/64 - sudo pip install cpp-coveralls -sudo apt-get install valgrind +if [ "$TRAVIS_OS_NAME" = "linux" ]; then + sudo apt-get install valgrind +elif [ "$TRAVIS_OS_NAME" = "osx" ]; then + brew install valgrind +else + echo "Unknown OS '$TRAVIS_OS_NAME'." + exit 1 +fi + +setup_prebuilt_deps x64 export VALGRIND=1 export VALGRIND_LOG="$tmpdir/valgrind-%p.log" CMAKE_EXTRA_FLAGS="-DTRAVIS_CI_BUILD=ON -DUSE_GCOV=ON" -$MAKE_CMD CMAKE_EXTRA_FLAGS="${CMAKE_EXTRA_FLAGS}" unittest +# Build and output version info. +$MAKE_CMD CMAKE_EXTRA_FLAGS="$CMAKE_EXTRA_FLAGS" nvim build/bin/nvim --version + +# Run unittests. +make unittest + +# Run functional tests. if ! $MAKE_CMD test; then valgrind_check "$tmpdir" exit 1 fi valgrind_check "$tmpdir" +# Run legacy tests. if ! $MAKE_CMD oldtest; then valgrind_check "$tmpdir" exit 1 diff --git a/.travis.yml b/.travis.yml index a82246986d..02cd32ee35 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,24 +1,60 @@ language: c +os: + - linux env: global: - - PROJECT_ROOT="$(pwd)" - - CI_SCRIPTS="$PROJECT_ROOT/.ci" + - CI_SCRIPTS=$TRAVIS_BUILD_DIR/.ci + # Travis reports back that it has 32-cores via /proc/cpuinfo, but it's not + # what we really have available. According to their documentation, it only has + # 1.5 virtual cores. + # See + # http://docs.travis-ci.com/user/speeding-up-the-build/#Paralellizing-your-build-on-one-VM + # for more information. + - MAKE_CMD="make -j2" + # Force verification of DLOG macros. + - CFLAGS='-DMIN_LOG_LEVEL=0' matrix: - CI_TARGET=clang-asan - CI_TARGET=gcc - CI_TARGET=gcc-32 - CI_TARGET=clint +matrix: + include: + - os: osx + env: CI_TARGET=clang-asan + - os: osx + env: CI_TARGET=gcc + compiler: gcc-4.9 + allow_failures: + - os: osx before_install: + # Pins the version of the java package installed on the Travis VMs + # and avoids a lengthy upgrade process for them. + - if [ $TRAVIS_OS_NAME = linux ]; then + sudo apt-mark hold oracle-java7-installer oracle-java8-installer; + sudo apt-get update; + elif [ $TRAVIS_OS_NAME = osx ]; then + brew update; + fi +install: + - if [ $TRAVIS_OS_NAME = linux ]; then + sudo apt-get install xclip gdb; + fi +before_script: # Adds user to a dummy group. # That allows to test changing the group of the file by `os_fchown`. - - sudo groupadd chown_test - - sudo usermod -a -G chown_test ${USER} # Need xvfb for running some tests with xclip - - export DISPLAY=:99.0 - - sh -e /etc/init.d/xvfb start - - sudo apt-get install xclip gdb + - if [ $TRAVIS_OS_NAME = linux ]; then + sudo groupadd chown_test; + sudo usermod -a -G chown_test $USER; + export DISPLAY=:99.0; + sh -e /etc/init.d/xvfb start; + elif [ $TRAVIS_OS_NAME = osx ]; then + sudo dscl . -create /Groups/chown_test; + sudo dscl . -append /Groups/chown_test GroupMembership $USER; + fi script: # This will pass the environment variables down to a bash process which runs # as $USER, while retaining the environment variables defined and belonging # to secondary groups given above in usermod. - - sudo -E su ${USER} -c "ulimit -c 102400; sh -e \"${CI_SCRIPTS}/${CI_TARGET}.sh\"" + - sudo -E su $USER -c "ulimit -c 102400; sh -e \"$CI_SCRIPTS/$CI_TARGET.sh\"" diff --git a/cmake/FindLibTermkey.cmake b/cmake/FindLibTermkey.cmake new file mode 100644 index 0000000000..533f168fe9 --- /dev/null +++ b/cmake/FindLibTermkey.cmake @@ -0,0 +1,48 @@ +# - Try to find libtermkey +# Once done this will define +# LIBTERMKEY_FOUND - System has libtermkey +# LIBTERMKEY_INCLUDE_DIRS - The libtermkey include directories +# LIBTERMKEY_LIBRARIES - The libraries needed to use libtermkey + +find_package(PkgConfig) +if(NOT LIBTERMKEY_USE_BUNDLED) + find_package(PkgConfig) + if (PKG_CONFIG_FOUND) + pkg_check_modules(PC_LIBTERMKEY QUIET libtermkey) + endif() +else() + set(PC_LIBTERMKEY_INCLUDEDIR) + set(PC_LIBTERMKEY_INCLUDE_DIRS) + set(PC_LIBTERMKEY_LIBDIR) + set(PC_LIBTERMKEY_LIBRARY_DIRS) + set(LIMIT_SEARCH NO_DEFAULT_PATH) +endif() + +set(LIBTERMKEY_DEFINITIONS ${PC_LIBTERMKEY_CFLAGS_OTHER}) + +find_path(LIBTERMKEY_INCLUDE_DIR termkey.h + PATHS ${PC_LIBTERMKEY_INCLUDEDIR} ${PC_LIBTERMKEY_INCLUDE_DIRS} + ${LIMIT_SEARCH}) + +# If we're asked to use static linkage, add libuv.a as a preferred library name. +if(LIBTERMKEY_USE_STATIC) + list(APPEND LIBTERMKEY_NAMES + "${CMAKE_STATIC_LIBRARY_PREFIX}termkey${CMAKE_STATIC_LIBRARY_SUFFIX}") +endif() + +list(APPEND LIBTERMKEY_NAMES termkey) + +find_library(LIBTERMKEY_LIBRARY NAMES ${LIBTERMKEY_NAMES} + HINTS ${PC_LIBTERMKEY_LIBDIR} ${PC_LIBTERMKEY_LIBRARY_DIRS} + ${LIMIT_SEARCH}) + +set(LIBTERMKEY_LIBRARIES ${LIBTERMKEY_LIBRARY}) +set(LIBTERMKEY_INCLUDE_DIRS ${LIBTERMKEY_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set LIBTERMKEY_FOUND to TRUE +# if all listed variables are TRUE +find_package_handle_standard_args(LibTermkey DEFAULT_MSG + LIBTERMKEY_LIBRARY LIBTERMKEY_INCLUDE_DIR) + +mark_as_advanced(LIBTERMKEY_INCLUDE_DIR LIBTERMKEY_LIBRARY) diff --git a/cmake/FindLibTickit.cmake b/cmake/FindLibTickit.cmake new file mode 100644 index 0000000000..c20bf4f74f --- /dev/null +++ b/cmake/FindLibTickit.cmake @@ -0,0 +1,48 @@ +# - Try to find libtickit +# Once done this will define +# LIBTICKIT_FOUND - System has libtickit +# LIBTICKIT_INCLUDE_DIRS - The libtickit include directories +# LIBTICKIT_LIBRARIES - The libraries needed to use libtickit + +find_package(PkgConfig) +if(NOT LIBTICKIT_USE_BUNDLED) + find_package(PkgConfig) + if (PKG_CONFIG_FOUND) + pkg_check_modules(PC_LIBTICKIT QUIET libtickit) + endif() +else() + set(PC_LIBTICKIT_INCLUDEDIR) + set(PC_LIBTICKIT_INCLUDE_DIRS) + set(PC_LIBTICKIT_LIBDIR) + set(PC_LIBTICKIT_LIBRARY_DIRS) + set(LIMIT_SEARCH NO_DEFAULT_PATH) +endif() + +set(LIBTICKIT_DEFINITIONS ${PC_LIBTICKIT_CFLAGS_OTHER}) + +find_path(LIBTICKIT_INCLUDE_DIR tickit.h + PATHS ${PC_LIBTICKIT_INCLUDEDIR} ${PC_LIBTICKIT_INCLUDE_DIRS} + ${LIMIT_SEARCH}) + +# If we're asked to use static linkage, add libuv.a as a preferred library name. +if(LIBTICKIT_USE_STATIC) + list(APPEND LIBTICKIT_NAMES + "${CMAKE_STATIC_LIBRARY_PREFIX}tickit${CMAKE_STATIC_LIBRARY_SUFFIX}") +endif() + +list(APPEND LIBTICKIT_NAMES tickit) + +find_library(LIBTICKIT_LIBRARY NAMES ${LIBTICKIT_NAMES} + HINTS ${PC_LIBTICKIT_LIBDIR} ${PC_LIBTICKIT_LIBRARY_DIRS} + ${LIMIT_SEARCH}) + +set(LIBTICKIT_LIBRARIES ${LIBTICKIT_LIBRARY}) +set(LIBTICKIT_INCLUDE_DIRS ${LIBTICKIT_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set LIBTICKIT_FOUND to TRUE +# if all listed variables are TRUE +find_package_handle_standard_args(LibTickit DEFAULT_MSG + LIBTICKIT_LIBRARY LIBTICKIT_INCLUDE_DIR) + +mark_as_advanced(LIBTICKIT_INCLUDE_DIR LIBTICKIT_LIBRARY) diff --git a/cmake/FindLibUnibilium.cmake b/cmake/FindLibUnibilium.cmake new file mode 100644 index 0000000000..aace9a40d5 --- /dev/null +++ b/cmake/FindLibUnibilium.cmake @@ -0,0 +1,48 @@ +# - Try to find libunibilium +# Once done this will define +# LIBUNIBILIUM_FOUND - System has libunibilium +# LIBUNIBILIUM_INCLUDE_DIRS - The libunibilium include directories +# LIBUNIBILIUM_LIBRARIES - The libraries needed to use libunibilium + +find_package(PkgConfig) +if(NOT LIBUNIBILIUM_USE_BUNDLED) + find_package(PkgConfig) + if (PKG_CONFIG_FOUND) + pkg_check_modules(PC_LIBUNIBILIUM QUIET libunibilium) + endif() +else() + set(PC_LIBUNIBILIUM_INCLUDEDIR) + set(PC_LIBUNIBILIUM_INCLUDE_DIRS) + set(PC_LIBUNIBILIUM_LIBDIR) + set(PC_LIBUNIBILIUM_LIBRARY_DIRS) + set(LIMIT_SEARCH NO_DEFAULT_PATH) +endif() + +set(LIBUNIBILIUM_DEFINITIONS ${PC_LIBUNIBILIUM_CFLAGS_OTHER}) + +find_path(LIBUNIBILIUM_INCLUDE_DIR unibilium.h + PATHS ${PC_LIBUNIBILIUM_INCLUDEDIR} ${PC_LIBUNIBILIUM_INCLUDE_DIRS} + ${LIMIT_SEARCH}) + +# If we're asked to use static linkage, add libuv.a as a preferred library name. +if(LIBUNIBILIUM_USE_STATIC) + list(APPEND LIBUNIBILIUM_NAMES + "${CMAKE_STATIC_LIBRARY_PREFIX}unibilium${CMAKE_STATIC_LIBRARY_SUFFIX}") +endif() + +list(APPEND LIBUNIBILIUM_NAMES unibilium) + +find_library(LIBUNIBILIUM_LIBRARY NAMES ${LIBUNIBILIUM_NAMES} + HINTS ${PC_LIBUNIBILIUM_LIBDIR} ${PC_LIBUNIBILIUM_LIBRARY_DIRS} + ${LIMIT_SEARCH}) + +set(LIBUNIBILIUM_LIBRARIES ${LIBUNIBILIUM_LIBRARY}) +set(LIBUNIBILIUM_INCLUDE_DIRS ${LIBUNIBILIUM_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set LIBUNIBILIUM_FOUND to TRUE +# if all listed variables are TRUE +find_package_handle_standard_args(LibUnibilium DEFAULT_MSG + LIBUNIBILIUM_LIBRARY LIBUNIBILIUM_INCLUDE_DIR) + +mark_as_advanced(LIBUNIBILIUM_INCLUDE_DIR LIBUNIBILIUM_LIBRARY) diff --git a/cmake/FindLuaJit.cmake b/cmake/FindLuaJit.cmake index a72fb175b4..e5fdc764f1 100644 --- a/cmake/FindLuaJit.cmake +++ b/cmake/FindLuaJit.cmake @@ -25,7 +25,8 @@ find_path(LUAJIT_INCLUDE_DIR luajit.h PATH_SUFFIXES luajit-2.0 ${LIMIT_SEARCH}) -# If we're asked to use static linkage, add libuv.a as a preferred library name. +# If we're asked to use static linkage, add libluajit-5.1.a as a preferred +# library name. if(LUAJIT_USE_STATIC) list(APPEND LUAJIT_NAMES "${CMAKE_STATIC_LIBRARY_PREFIX}luajit-5.1${CMAKE_STATIC_LIBRARY_SUFFIX}") diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index 55bd508109..9f8e0acccd 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -1003,8 +1003,8 @@ The pattern is interpreted like mostly used in file names: [^ch] match any character but 'c' and 'h' Note that for all systems the '/' character is used for path separator (even -MS-DOS and OS/2). This was done because the backslash is difficult to use -in a pattern and to make the autocommands portable across different systems. +MS-DOS). This was done because the backslash is difficult to use in a pattern +and to make the autocommands portable across different systems. *autocmd-changes* Matching with the pattern is done when an event is triggered. Changing the diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt index f58389af8c..2892faa496 100644 --- a/runtime/doc/cmdline.txt +++ b/runtime/doc/cmdline.txt @@ -855,7 +855,7 @@ These modifiers can be given, in this order: separator is removed. Thus ":p:h" on a directory name results on the directory name itself (without trailing slash). When the file name is an absolute path (starts with "/" for - Unix; "x:\" for MS-DOS, WIN32, OS/2; "drive:" for Amiga), that + Unix; "x:\" for MS-DOS, WIN32; "drive:" for Amiga), that part is not removed. When there is no head (path is relative to current directory) the result is empty. :t Tail of the file name (last component of the name). Must @@ -954,10 +954,10 @@ option contains "sh", this is done twice, to avoid the shell trying to expand the "!". *filename-backslash* -For filesystems that use a backslash as directory separator (MS-DOS, Windows, -OS/2), it's a bit difficult to recognize a backslash that is used to escape -the special meaning of the next character. The general rule is: If the -backslash is followed by a normal file name character, it does not have a +For filesystems that use a backslash as directory separator (MS-DOS and +Windows), it's a bit difficult to recognize a backslash that is used +to escape the special meaning of the next character. The general rule is: If +the backslash is followed by a normal file name character, it does not have a special meaning. Therefore "\file\foo" is a valid file name, you don't have to type the backslash twice. diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index f2f2bee79e..e4867e7a90 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -502,8 +502,8 @@ The 'fileformat' option sets the <EOL> style for a file: "mac" <CR> Mac format *Mac-format* When reading a file, the mentioned characters are interpreted as the <EOL>. -In DOS format (default for MS-DOS, OS/2 and Win32), <CR><NL> and <NL> are both -interpreted as the <EOL>. Note that when writing the file in DOS format, +In DOS format (default for MS-DOS and Win32), <CR><NL> and <NL> are both +interpreted as the <EOL>. Note that when writing the file in DOS format, <CR> characters will be added for each single <NL>. Also see |file-read|. When writing a file, the mentioned characters are used for <EOL>. For DOS @@ -1011,11 +1011,11 @@ lost the original file. *DOS-format-write* If the 'fileformat' is "dos", <CR> <NL> is used for <EOL>. This is default -for MS-DOS, Win32 and OS/2. On other systems the message "[dos format]" is -shown to remind you that an unusual <EOL> was used. +for MS-DOS and Win32. On other systems the message "[dos format]" is shown to +remind you that an unusual <EOL> was used. *Unix-format-write* -If the 'fileformat' is "unix", <NL> is used for <EOL>. On MS-DOS, Win32 and -OS/2 the message "[unix format]" is shown. +If the 'fileformat' is "unix", <NL> is used for <EOL>. On MS-DOS and Win32 +the message "[unix format]" is shown. *Mac-format-write* If the 'fileformat' is "mac", <CR> is used for <EOL>. On non-Mac systems the message "[mac format]" is shown. diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index fca8ac1291..0778cf6122 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -6172,7 +6172,7 @@ system({expr} [, {input}]) *system()* *E677* The command executed is constructed using several options: 'shell' 'shellcmdflag' 'shellxquote' {expr} 'shellredir' {tmp} 'shellxquote' ({tmp} is an automatically generated file name). - For Unix and OS/2 braces are put around {expr} to allow for + For Unix braces are put around {expr} to allow for concatenated commands. The command will be executed in "cooked" mode, so that a @@ -6188,11 +6188,12 @@ system({expr} [, {input}]) *system()* *E677* Use |:checktime| to force a check. -systemlist({expr} [, {input}]) *systemlist()* +systemlist({expr} [, {input} [, {keepempty}]]) *systemlist()* Same as |system()|, but returns a |List| with lines (parts of output separated by NL) with NULs transformed into NLs. Output is the same as |readfile()| will output with {binary} argument - set to "b". + set to "b", except that a final newline is not preserved, + unless {keepempty} is present and it's non-zero. Returns an empty string on error, so be careful not to run into |E706|. @@ -6756,7 +6757,6 @@ multi_byte_ime Compiled with support for IME input method. multi_lang Compiled with support for multiple languages. mzscheme Compiled with MzScheme interface |mzscheme|. ole Compiled with OLE automation support for Win32. -os2 OS/2 version of Vim. path_extra Compiled with up/downwards search in 'path' and 'tags' perl Compiled with Perl interface. persistent_undo Compiled with support for persistent undo history. diff --git a/runtime/doc/gui.txt b/runtime/doc/gui.txt index d77976330b..bdddec585d 100644 --- a/runtime/doc/gui.txt +++ b/runtime/doc/gui.txt @@ -94,8 +94,6 @@ terminal version. Recommended place for your personal GUI initializations: Unix $HOME/.gvimrc or $HOME/.vim/gvimrc - OS/2 $HOME/.gvimrc, $HOME/vimfiles/gvimrc - or $VIM/.gvimrc MS-DOS and Win32 $HOME/_gvimrc, $HOME/vimfiles/gvimrc or $VIM/_gvimrc Amiga s:.gvimrc, home:.gvimrc, home:vimfiles:gvimrc diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index ce92f14f81..60454fa8e1 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -1938,9 +1938,9 @@ If the 'fileformats' option is not empty Vim tries to recognize the type of changed, the detected format is only used while reading the file. A similar thing happens with 'fileencodings'. -On non-MS-DOS, Win32, and OS/2 systems the message "[dos format]" is shown if +On non-MS-DOS and Win32 systems the message "[dos format]" is shown if a file is read in DOS format, to remind you that something unusual is done. -On Macintosh, MS-DOS, Win32, and OS/2 the message "[unix format]" is shown if +On Macintosh, MS-DOS, and Win32 the message "[unix format]" is shown if a file is read in Unix format. On non-Macintosh systems, the message "[Mac format]" is shown if a file is read in Mac format. diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index a875179967..813ed83be4 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -861,7 +861,7 @@ A jump table for the options with a short description can be found at |Q_op|. putting a ":gui" command in the .gvimrc file, before where the value of 'background' is used (e.g., before ":syntax on"). - For MS-DOS, Windows and OS/2 the default is "dark". + For MS-DOS and Windows the default is "dark". For other systems "dark" is used when 'term' is "linux", "screen.linux", "cygwin" or "putty", or $COLORFGBG suggests a dark background. Otherwise the default is "light". @@ -1689,7 +1689,7 @@ A jump table for the options with a short description can be found at |Q_op|. 'esckeys' + off no <Esc>-keys in Insert mode 'expandtab' off tabs not expanded to spaces 'fileformats' + "" no automatic file format detection, - "dos,unix" except for DOS, Windows and OS/2 + "dos,unix" except for DOS and Windows 'formatoptions' + "vt" Vi compatible formatting 'gdefault' off no default 'g' flag for ":s" 'history' + 0 no commandline history @@ -2873,7 +2873,7 @@ A jump table for the options with a short description can be found at |Q_op|. is read. *'fileformat'* *'ff'* -'fileformat' 'ff' string (MS-DOS, MS-Windows, OS/2 default: "dos", +'fileformat' 'ff' string (MS-DOS and MS-Windows default: "dos", Unix default: "unix", Macintosh default: "mac") local to buffer @@ -2896,7 +2896,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'fileformats'* *'ffs'* 'fileformats' 'ffs' string (default: - Vim+Vi MS-DOS, MS-Windows OS/2: "dos,unix", + Vim+Vi MS-DOS and MS-Windows: "dos,unix", Vim Unix: "unix,dos", Vim Mac: "mac,unix,dos", Vi Cygwin: "unix,dos", @@ -4292,7 +4292,7 @@ A jump table for the options with a short description can be found at |Q_op|. NOTE: This option is reset when 'compatible' is set. *'isfname'* *'isf'* -'isfname' 'isf' string (default for MS-DOS, Win32 and OS/2: +'isfname' 'isf' string (default for MS-DOS and Win32: "@,48-57,/,\,.,-,_,+,,,#,$,%,{,},[,],:,@-@,!,~,=" for AMIGA: "@,48-57,/,.,-,_,+,,,$,:" for VMS: "@,48-57,/,.,-,_,+,,,#,$,%,<,>,[,],:,;,~" @@ -4347,7 +4347,7 @@ A jump table for the options with a short description can be found at |Q_op|. See |option-backslash| about including spaces and backslashes. *'isident'* *'isi'* -'isident' 'isi' string (default for MS-DOS, Win32 and OS/2: +'isident' 'isi' string (default for MS-DOS and Win32: "@,48-57,_,128-167,224-235" otherwise: "@,48-57,_,192-255") global @@ -4380,7 +4380,7 @@ A jump table for the options with a short description can be found at |Q_op|. set and to the Vim default value when 'compatible' is reset. *'isprint'* *'isp'* -'isprint' 'isp' string (default for MS-DOS, Win32, OS/2 and Macintosh: +'isprint' 'isp' string (default for MS-DOS, Win32, and Macintosh: "@,~-255"; otherwise: "@,161-255") global {not in Vi} @@ -4466,7 +4466,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'keywordprg'* *'kp'* 'keywordprg' 'kp' string (default "man" or "man -s", DOS: ":help", - OS/2: "view /", VMS: "help") + VMS: "help") global or local to buffer |global-local| {not in Vi} Program to use for the |K| command. Environment variables are @@ -5232,7 +5232,7 @@ A jump table for the options with a short description can be found at |Q_op|. 'opendevice' 'odev' boolean (default off) global {not in Vi} - {only for MS-DOS, MS-Windows and OS/2} + {only for MS-DOS and MS-Windows} Enable reading and writing from devices. This may get Vim stuck on a device that can be opened but doesn't actually do the I/O. Therefore it is off by default. @@ -5363,7 +5363,6 @@ A jump table for the options with a short description can be found at |Q_op|. *'path'* *'pa'* *E343* *E345* *E347* *E854* 'path' 'pa' string (default on Unix: ".,/usr/include,," - on OS/2: ".,/emx/include,," other systems: ".,,") global or local to buffer |global-local| {not in Vi} @@ -5740,11 +5739,6 @@ A jump table for the options with a short description can be found at |Q_op|. $VIMRUNTIME, $VIM/vimfiles/after, home:vimfiles/after" - PC, OS/2: "$HOME/vimfiles, - $VIM/vimfiles, - $VIMRUNTIME, - $VIM/vimfiles/after, - $HOME/vimfiles/after" Macintosh: "$VIM:vimfiles, $VIMRUNTIME, $VIM:vimfiles:after" @@ -6001,7 +5995,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'shell'* *'sh'* *E91* 'shell' 'sh' string (default $SHELL or "sh", MS-DOS and Win32: "command.com" or - "cmd.exe", OS/2: "cmd") + "cmd.exe") global Name of the shell to use for ! and :! commands. When changing the value also check these options: 'shellpipe', 'shellslash' @@ -6039,8 +6033,7 @@ A jump table for the options with a short description can be found at |Q_op|. Flag passed to the shell to execute "!" and ":!" commands; e.g., "bash.exe -c ls" or "command.com /c dir". For the MS-DOS-like systems, the default is set according to the value of 'shell', to - reduce the need to set this option by the user. It's not used for - OS/2 (EMX figures this out itself). + reduce the need to set this option by the user. On Unix it can have more than one flag. Each white space separated part is passed as an argument to the shell command. See |option-backslash| about including spaces and backslashes. @@ -6129,7 +6122,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'shellslash'* *'ssl'* *'noshellslash'* *'nossl'* 'shellslash' 'ssl' boolean (default off) global - {not in Vi} {only for MSDOS, MS-Windows and OS/2} + {not in Vi} {only for MSDOS and MS-Windows} When set, a forward slash is used when expanding file names. This is useful when a Unix-like shell is used instead of command.com or cmd.exe. Backward slashes can still be typed, but they are changed to @@ -7135,9 +7128,7 @@ A jump table for the options with a short description can be found at |Q_op|. on Amiga: "amiga" on BeOS: "beos-ansi" on Mac: "mac-ansi" - on MiNT: "vt52" on MS-DOS: "pcterm" - on OS/2: "os2ansi" on Unix: "ansi" on VMS: "ansi" on Win 32: "win32") @@ -7578,7 +7569,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'undolevels'* *'ul'* 'undolevels' 'ul' number (default 100, 1000 for Unix, VMS, - Win32 and OS/2) + and Win32) global or local to buffer |global-local| {not in Vi} Maximum number of changes that can be undone. Since undo information @@ -7680,7 +7671,7 @@ A jump table for the options with a short description can be found at |Q_op|. displayed when 'verbosefile' is set. *'viewdir'* *'vdir'* -'viewdir' 'vdir' string (default for Amiga, MS-DOS, OS/2 and Win32: +'viewdir' 'vdir' string (default for Amiga, MS-DOS, and Win32: "$VIM/vimfiles/view", for Unix: "~/.vim/view", for Macintosh: "$VIM:vimfiles:view" @@ -7719,7 +7710,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'viminfo'* *'vi'* *E526* *E527* *E528* 'viminfo' 'vi' string (Vi default: "", Vim default for MS-DOS, - Windows and OS/2: '100,<50,s10,h,rA:,rB:, + Windows: '100,<50,s10,h,rA:,rB:, for Amiga: '100,<50,s10,h,rdf0:,rdf1:,rdf2: for others: '100,<50,s10,h) global diff --git a/runtime/doc/print.txt b/runtime/doc/print.txt index 2ff6b1063c..5fcaa6f624 100644 --- a/runtime/doc/print.txt +++ b/runtime/doc/print.txt @@ -93,7 +93,7 @@ If the option is empty, then vim will use the system default printer for *penc-option* *E620* 'printencoding' 'penc' String (default empty, except for: - Windows, OS/2: cp1252, + Windows: cp1252, Macintosh: mac-roman, VMS: dec-mcs, HPUX: hp-roman8, @@ -123,8 +123,8 @@ cannot be converted will be replaced with upside down question marks. Four print character encoding files are provided to support default Mac, VMS, HPUX, and EBCDIC character encodings and are used by default on these -platforms. Code page 1252 print character encoding is used by default on -Windows and OS/2 platforms. +platforms. Code page 1252 print character encoding is used by default on +the Windows platform. *pexpr-option* 'printexpr' 'pexpr' String (default: see below) @@ -142,7 +142,7 @@ the file: > system('lpr' . (&printdevice == '' ? '' : ' -P' . &printdevice) . ' ' . v:fname_in) . delete(v:fname_in) + v:shell_error -On MS-Dos, MS-Windows and OS/2 machines the default is to copy the file to the +On MS-Dos and MS-Windows machines the default is to copy the file to the currently specified printdevice: > system('copy' . ' ' . v:fname_in . (&printdevice == '' @@ -621,7 +621,7 @@ OpenVMS http://wwwthep.physik.uni-mainz.de/~plass/gv/ -Windows and OS/2 +Windows - GSview. Obtainable from: @@ -636,7 +636,7 @@ DOS Linux -- GSview. Linux version of the popular Windows and OS/2 previewer. +- GSview. Linux version of the popular Windows previewer. Obtainable from: http://www.cs.wisc.edu/~ghost/gsview/ diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt index 22d99b908b..6b80482f6b 100644 --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -938,8 +938,8 @@ normally happens by matching following characters and items. When nothing is following the rest of the line is matched. If "%f" is followed by a '%' or a backslash, it will look for a sequence of 'isfname' characters. -On MS-DOS, MS-Windows and OS/2 a leading "C:" will be included in "%f", even -when using "%f:". This means that a file name which is a single alphabetical +On MS-DOS and MS-Windows a leading "C:" will be included in "%f", even when +using "%f:". This means that a file name which is a single alphabetical letter will not be detected. The "%p" conversion is normally followed by a "^". It's used for compilers diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index 4b28e8617b..a8e573a52e 100644 --- a/runtime/doc/repeat.txt +++ b/runtime/doc/repeat.txt @@ -299,7 +299,7 @@ with CTRL-V followed by the three digit decimal code. This does NOT work for the <t_xx> termcap codes, these can only be used in mappings. *:source_crnl* *W15* -MS-DOS, Win32 and OS/2: Files that are read with ":source" normally have +MS-DOS and Win32: Files that are read with ":source" normally have <CR><NL> <EOL>s. These always work. If you are using a file with <NL> <EOL>s (for example, a file made on Unix), this will be recognized if 'fileformats' is not empty and the first line does not end in a <CR>. This fails if the diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index dfe46b1047..d002a3a4ab 100644 --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -750,8 +750,6 @@ accordingly. Vim proceeds in this order: Places for your personal initializations: Unix $HOME/.vimrc or $HOME/.vim/vimrc - OS/2 $HOME/.vimrc, $HOME/vimfiles/vimrc - or $VIM/.vimrc (or _vimrc) MS-Windows $HOME/_vimrc, $HOME/vimfiles/vimrc or $VIM/_vimrc Amiga s:.vimrc, home:.vimrc, home:vimfiles:vimrc @@ -777,7 +775,7 @@ accordingly. Vim proceeds in this order: a. If vim was started as |evim| or |eview| or with the |-y| argument, the script $VIMRUNTIME/evim.vim will be loaded. *system-vimrc* - b. For Unix, MS-DOS, MS-Windows, OS/2, VMS, Macintosh, RISC-OS and Amiga + b. For Unix, MS-DOS, MS-Windows, VMS, Macintosh, RISC-OS and Amiga the system vimrc file is read for initializations. The path of this file is shown with the ":version" command. Mostly it's "$VIM/vimrc". Note that this file is ALWAYS read in 'compatible' mode, since the @@ -793,16 +791,16 @@ accordingly. Vim proceeds in this order: - The environment variable VIMINIT (see also |compatible-default|) (*) The value of $VIMINIT is used as an Ex command line. - The user vimrc file(s): - "$HOME/.vimrc" (for Unix and OS/2) (*) - "$HOME/.vim/vimrc" (for Unix and OS/2) (*) + "$HOME/.vimrc" (for Unix) (*) + "$HOME/.vim/vimrc" (for Unix) (*) "s:.vimrc" (for Amiga) (*) "home:.vimrc" (for Amiga) (*) "home:vimfiles:vimrc" (for Amiga) (*) - "$VIM/.vimrc" (for OS/2 and Amiga) (*) + "$VIM/.vimrc" (for Amiga) (*) "$HOME/_vimrc" (for MS-DOS and Win32) (*) "$HOME/vimfiles/vimrc" (for MS-DOS and Win32) (*) "$VIM/_vimrc" (for MS-DOS and Win32) (*) - Note: For Unix, OS/2 and Amiga, when ".vimrc" does not exist, + Note: For Unix and Amiga, when ".vimrc" does not exist, "_vimrc" is also tried, in case an MS-DOS compatible file system is used. For MS-DOS and Win32 ".vimrc" is checked after "_vimrc", in case long file names are used. @@ -818,11 +816,11 @@ accordingly. Vim proceeds in this order: d. If the 'exrc' option is on (which is not the default), the current directory is searched for three files. The first that exists is used, the others are ignored. - - The file ".vimrc" (for Unix, Amiga and OS/2) (*) + - The file ".vimrc" (for Unix and Amiga) (*) "_vimrc" (for MS-DOS and Win32) (*) - - The file "_vimrc" (for Unix, Amiga and OS/2) (*) + - The file "_vimrc" (for Unix and Amiga) (*) ".vimrc" (for MS-DOS and Win32) (*) - - The file ".exrc" (for Unix, Amiga and OS/2) + - The file ".exrc" (for Unix and Amiga) "_exrc" (for MS-DOS and Win32) (*) Using this file or environment variable will cause 'compatible' to be @@ -889,7 +887,7 @@ Some hints on using initializations: Standard setup: Create a vimrc file to set the default settings and mappings for all your edit sessions. Put it in a place so that it will be found by 3b: - ~/.vimrc (Unix and OS/2) + ~/.vimrc (Unix) s:.vimrc (Amiga) $VIM\_vimrc (MS-DOS and Win32) Note that creating a vimrc file will cause the 'compatible' option to be off @@ -923,7 +921,7 @@ manual. The environment variables set with the old Manx Set command (before version 5.0) are not recognized. MS-DOS line separators: -On MS-DOS-like systems (MS-DOS itself, Win32, and OS/2), Vim assumes that all +On MS-DOS-like systems (MS-DOS itself and Win32), Vim assumes that all the vimrc files have <CR> <NL> pairs as line separators. This will give problems if you have a file with only <NL>s and have a line like ":map xx yy^M". The trailing ^M will be ignored. @@ -1042,7 +1040,7 @@ will try to get the value for $VIM in this order: problem). The file name ("help.txt" or any other) is removed. Then trailing directory names are removed, in this order: "doc", "runtime" and "vim{version}" (e.g., "vim54"). -3. For MSDOS, Win32 and OS/2 Vim tries to use the directory name of the +3. For MSDOS and Win32 Vim tries to use the directory name of the executable. If it ends in "/src", this is removed. This is useful if you unpacked the .zip file in some directory, and adjusted the search path to find the vim executable. Trailing directory names are removed, in this @@ -1428,11 +1426,10 @@ remembered. VIMINFO FILE NAME *viminfo-file-name* -- The default name of the viminfo file is "$HOME/.viminfo" for Unix and OS/2, +- The default name of the viminfo file is "$HOME/.viminfo" for Unix, "s:.viminfo" for Amiga, "$HOME\_viminfo" for MS-DOS and Win32. For the last two, when $HOME is not set, "$VIM\_viminfo" is used. When $VIM is also not - set, "c:\_viminfo" is used. For OS/2 "$VIM/.viminfo" is used when $HOME is - not set and $VIM is set. + set, "c:\_viminfo" is used. - The 'n' flag in the 'viminfo' option can be used to specify another viminfo file name |'viminfo'|. - The "-i" Vim argument can be used to set another file name, |-i|. When the diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 7440f6072b..1cab028bc2 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -2301,14 +2301,7 @@ GUI: currently. This is very obvious on a 66Mhz 486. -MSDOS, OS/2 and Win32: -8 OS/2: Add backtick expansion. Undefine NO_EXPANDPATH and use - gen_expand_wildcards(). -8 OS/2: Add clipboard support? See example clipbrd.exe from Alexander - Wagner. -8 OS/2: Add Extended Attributes support and define HAVE_ACL. -8 OS/2: When editing a file name "foo.txt" that is actually called FOO.txt, - writing uses "foo.txt". Should obtain the real file name. +MSDOS and Win32: 8 Should $USERPROFILE be preferred above $HOMEDRIVE/$HOMEPATH? No, but it's a good fallback, thus use: $HOME diff --git a/runtime/doc/usr_01.txt b/runtime/doc/usr_01.txt index 11fa2173d6..0de1fac803 100644 --- a/runtime/doc/usr_01.txt +++ b/runtime/doc/usr_01.txt @@ -71,7 +71,7 @@ you are using: Unix: > :!cp -i $VIMRUNTIME/vimrc_example.vim ~/.vimrc -MS-DOS, MS-Windows, OS/2: > +MS-DOS, MS-Windows: > :!copy $VIMRUNTIME/vimrc_example.vim $VIM/_vimrc Amiga: > :!copy $VIMRUNTIME/vimrc_example.vim $VIM/.vimrc diff --git a/runtime/doc/usr_05.txt b/runtime/doc/usr_05.txt index f71cf42cff..ac377675ee 100644 --- a/runtime/doc/usr_05.txt +++ b/runtime/doc/usr_05.txt @@ -314,7 +314,6 @@ Then copy the file to your plugin directory: system plugin directory ~ Unix ~/.vim/plugin/ - PC and OS/2 $HOME/vimfiles/plugin or $VIM/vimfiles/plugin Amiga s:vimfiles/plugin Macintosh $VIM:vimfiles:plugin Mac OS X ~/.vim/plugin/ diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index f30b79a2ea..71255e46d8 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -1495,7 +1495,7 @@ Here is a summary of items that apply to Vim scripts. They are also mentioned elsewhere, but form a nice checklist. The end-of-line character depends on the system. For Unix a single <NL> -character is used. For MS-DOS, Windows, OS/2 and the like, <CR><LF> is used. +character is used. For MS-DOS, Windows and the like, <CR><LF> is used. This is important when using mappings that end in a <CR>. See |:source_crnl|. diff --git a/runtime/doc/vi_diff.txt b/runtime/doc/vi_diff.txt index 4a7b067fc1..aa90dc94b0 100644 --- a/runtime/doc/vi_diff.txt +++ b/runtime/doc/vi_diff.txt @@ -136,8 +136,6 @@ Support for different systems. - MS-DOS in real-mode (no additional drivers required). - In protected mode on Windows 3.1 and MS-DOS (DPMI driver required). - Windows 95 and Windows NT, with support for long file names. - - OS/2 (needs emx.dll) - - Atari MiNT - VMS - BeOS - Macintosh diff --git a/runtime/gvimrc_example.vim b/runtime/gvimrc_example.vim index 5a5197e99a..26b3001220 100644 --- a/runtime/gvimrc_example.vim +++ b/runtime/gvimrc_example.vim @@ -5,7 +5,7 @@ " Last change: 2001 Sep 02 " " To use it, copy it to -" for Unix and OS/2: ~/.gvimrc +" for Unix: ~/.gvimrc " for Amiga: s:.gvimrc " for MS-DOS and Win32: $VIM\_gvimrc " for OpenVMS: sys$login:.gvimrc diff --git a/runtime/menu.vim b/runtime/menu.vim index 5c5bb97208..e0745585a6 100644 --- a/runtime/menu.vim +++ b/runtime/menu.vim @@ -188,7 +188,7 @@ an 20.435 &Edit.Startup\ &Settings :call <SID>EditVimrc()<CR> fun! s:EditVimrc() if $MYVIMRC != '' let fname = $MYVIMRC - elseif has("win32") || has("dos32") || has("dos16") || has("os2") + elseif has("win32") || has("dos32") || has("dos16") if $HOME != '' let fname = $HOME . "/_vimrc" else diff --git a/runtime/optwin.vim b/runtime/optwin.vim index 6c1c743a00..22581ed98b 100644 --- a/runtime/optwin.vim +++ b/runtime/optwin.vim @@ -1107,14 +1107,14 @@ if has("quickfix") endif -if has("msdos") || has("os2") || has("win16") || has("win32") || has("osfiletype") +if has("msdos") || has("win16") || has("win32") || has("osfiletype") call <SID>Header("system specific") if has("osfiletype") call append("$", "osfiletype\tOS-specific information about the type of file") call append("$", "\t(local to buffer)") call <SID>OptionL("oft") endif - if has("msdos") || has("os2") || has("win16") || has("win32") + if has("msdos") || has("win16") || has("win32") call append("$", "shellslash\tuse forward slashes in file names; for Unix-like shells") call <SID>BinOptionG("ssl", &ssl) endif diff --git a/runtime/tools/README.txt b/runtime/tools/README.txt index fa176c776d..19976b325c 100644 --- a/runtime/tools/README.txt +++ b/runtime/tools/README.txt @@ -34,4 +34,4 @@ xcmdsrv_client.c: Example for a client program that communicates with a Vim unicode.vim Vim script to generate tables for src/mbyte.c. -[xxd (and tee for OS/2) can be found in the src directory] +[xxd can be found in the src directory] diff --git a/runtime/vimrc_example.vim b/runtime/vimrc_example.vim index 27a5cfc222..3175711aa1 100644 --- a/runtime/vimrc_example.vim +++ b/runtime/vimrc_example.vim @@ -4,7 +4,7 @@ " Last change: 2014 Feb 05 " " To use it, copy it to -" for Unix and OS/2: ~/.vimrc +" for Unix: ~/.vimrc " for Amiga: s:.vimrc " for MS-DOS and Win32: $VIM\_vimrc " for OpenVMS: sys$login:.vimrc diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index 3b05c7329c..184bcc0548 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -77,7 +77,6 @@ set(CONV_SOURCES search.c sha256.c spell.c - strings.c syntax.c tag.c term.c diff --git a/src/nvim/charset.c b/src/nvim/charset.c index bbe80a519c..9e5194a5df 100644 --- a/src/nvim/charset.c +++ b/src/nvim/charset.c @@ -1855,7 +1855,7 @@ int hexhex2nr(char_u *p) #endif // if defined(FEAT_TERMRESPONSE) || defined(FEAT_GUI_GTK) // || defined(PROTO) -/// Return TRUE if "str" starts with a backslash that should be removed. +/// Return true if "str" starts with a backslash that should be removed. /// For WIN32 this is only done when the character after the /// backslash is not a normal file name character. /// '$' is a valid file name character, we don't remove the backslash before @@ -1869,8 +1869,8 @@ int hexhex2nr(char_u *p) /// /// @param str /// -/// @return TRUE if `str` starts with a backslash that should be removed. -int rem_backslash(char_u *str) +/// @return true if `str` starts with a backslash that should be removed. +bool rem_backslash(const char_u *str) { #ifdef BACKSLASH_IN_FILENAME return str[0] == '\\' diff --git a/src/nvim/digraph.c b/src/nvim/digraph.c index 6587a43452..2b5fdea2fe 100644 --- a/src/nvim/digraph.c +++ b/src/nvim/digraph.c @@ -1813,10 +1813,10 @@ void ex_loadkeymap(exarg_T *eap) if ((*p != '"') && (*p != NUL)) { kmap_T *kp = GA_APPEND_VIA_PTR(kmap_T, &curbuf->b_kmap_ga); s = skiptowhite(p); - kp->from = vim_strnsave(p, (int)(s - p)); + kp->from = vim_strnsave(p, (size_t)(s - p)); p = skipwhite(s); s = skiptowhite(p); - kp->to = vim_strnsave(p, (int)(s - p)); + kp->to = vim_strnsave(p, (size_t)(s - p)); if ((STRLEN(kp->from) + STRLEN(kp->to) >= KMAP_LLEN) || (*kp->from == NUL) diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 8be25bc34e..be69bdbe61 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -6593,7 +6593,7 @@ static struct fst { {"synconcealed", 2, 2, f_synconcealed}, {"synstack", 2, 2, f_synstack}, {"system", 1, 2, f_system}, - {"systemlist", 1, 2, f_systemlist}, + {"systemlist", 1, 3, f_systemlist}, {"tabpagebuflist", 0, 1, f_tabpagebuflist}, {"tabpagenr", 0, 1, f_tabpagenr}, {"tabpagewinnr", 1, 2, f_tabpagewinnr}, @@ -14523,7 +14523,7 @@ static void f_synstack(typval_T *argvars, typval_T *rettv) } } -static list_T* string_to_list(char_u *str, size_t len) +static list_T* string_to_list(char_u *str, size_t len, bool keepempty) { list_T *list = list_alloc(); @@ -14543,6 +14543,11 @@ static list_T* string_to_list(char_u *str, size_t len) list_append(list, li); } + // Optionally retain final newline, if present + if (keepempty && str[len-1] == NL) { + list_append_string(list, (char_u*)"", 0); + } + return list; } @@ -14585,7 +14590,11 @@ static void get_system_output_as_rettv(typval_T *argvars, typval_T *rettv, } if (retlist) { - rettv->vval.v_list = string_to_list((char_u *) res, nread); + int keepempty = 0; + if (argvars[1].v_type != VAR_UNKNOWN && argvars[2].v_type != VAR_UNKNOWN) { + keepempty = get_tv_number(&argvars[2]); + } + rettv->vval.v_list = string_to_list((char_u *) res, nread, keepempty != 0); rettv->vval.v_list->lv_refcount++; rettv->v_type = VAR_LIST; @@ -19723,7 +19732,7 @@ static void apply_job_autocmds(int id, char *name, char *type, str_slot->li_tv.v_type = VAR_LIST; str_slot->li_tv.v_lock = 0; str_slot->li_tv.vval.v_list = - string_to_list((char_u *) received, received_len); + string_to_list((char_u *) received, received_len, false); str_slot->li_tv.vval.v_list->lv_refcount++; list_append(list, str_slot); diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 556e0c01e3..44caa67847 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -47,6 +47,7 @@ #include "nvim/garray.h" #include "nvim/memory.h" #include "nvim/move.h" +#include "nvim/mouse.h" #include "nvim/normal.h" #include "nvim/ops.h" #include "nvim/option.h" @@ -3602,10 +3603,16 @@ void do_sub(exarg_T *eap) eap->flags = EXFLAG_PRINT; } - do_join(eap->line2 - eap->line1 + 1, FALSE, TRUE, FALSE, true); - sub_nlines = sub_nsubs = eap->line2 - eap->line1 + 1; - do_sub_msg(false); - ex_may_print(eap); + linenr_T joined_lines_count = eap->line2 < curbuf->b_ml.ml_line_count + ? eap->line2 - eap->line1 + 2 + : eap->line2 - eap->line1 + 1; + if (joined_lines_count > 1) { + do_join(joined_lines_count, FALSE, TRUE, FALSE, true); + sub_nsubs = joined_lines_count - 1; + sub_nlines = 1; + do_sub_msg(false); + ex_may_print(eap); + } return; } diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index 24a1ccf85d..794e9930b9 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -157,7 +157,6 @@ void do_debug(char_u *cmd) /* Make sure we are in raw mode and start termcap mode. Might have side * effects... */ - settmode(TMODE_RAW); starttermcap(); ++RedrawingDisabled; /* don't redisplay the window */ diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 3967c916bb..e180be4421 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -5107,7 +5107,6 @@ static void ex_highlight(exarg_T *eap) void not_exiting(void) { exiting = FALSE; - settmode(TMODE_RAW); } /* @@ -5994,7 +5993,6 @@ do_exedit ( { int n; int need_hide; - int exmode_was = exmode_active; /* * ":vi" command ends Ex mode. @@ -6014,8 +6012,6 @@ do_exedit ( eap->nextcmd = NULL; } - if (exmode_was != EXMODE_VIM) - settmode(TMODE_RAW); RedrawingDisabled = 0; no_wait_return = 0; need_wait_return = FALSE; @@ -6446,7 +6442,7 @@ static void ex_winsize(exarg_T *eap) p = arg; h = getdigits(&arg); if (*p != NUL && *arg == NUL) - set_shellsize(w, h, TRUE); + screen_resize(w, h, TRUE); else EMSG(_("E465: :winsize requires two number arguments")); } @@ -7482,7 +7478,7 @@ static void ex_tag_cmd(exarg_T *eap, char_u *name) * If found return one of the SPEC_ values and set "*usedlen" to the length of * the variable. Otherwise return -1 and "*usedlen" is unchanged. */ -int find_cmdline_var(char_u *src, int *usedlen) +int find_cmdline_var(const char_u *src, int *usedlen) FUNC_ATTR_NONNULL_ALL { int len; int i; diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c index ef3facb18b..196f8e6136 100644 --- a/src/nvim/ex_eval.c +++ b/src/nvim/ex_eval.c @@ -386,21 +386,19 @@ int do_intthrow(struct condstack *cstack) char_u *get_exception_string(void *value, int type, char_u *cmdname, int *should_free) { char_u *ret, *mesg; - int cmdlen; char_u *p, *val; if (type == ET_ERROR) { *should_free = FALSE; mesg = ((struct msglist *)value)->throw_msg; if (cmdname != NULL && *cmdname != NUL) { - cmdlen = (int)STRLEN(cmdname); - ret = vim_strnsave((char_u *)"Vim(", - 4 + cmdlen + 2 + (int)STRLEN(mesg)); + size_t cmdlen = STRLEN(cmdname); + ret = vim_strnsave((char_u *)"Vim(", 4 + cmdlen + 2 + STRLEN(mesg)); STRCPY(&ret[4], cmdname); STRCPY(&ret[4 + cmdlen], "):"); val = ret + 4 + cmdlen + 2; } else { - ret = vim_strnsave((char_u *)"Vim:", 4 + (int)STRLEN(mesg)); + ret = vim_strnsave((char_u *)"Vim:", 4 + STRLEN(mesg)); val = ret + 4; } @@ -708,7 +706,7 @@ static void report_pending(int action, int pending, void *value) if (pending & CSTP_THROW) { vim_snprintf((char *)IObuff, IOSIZE, (char *)mesg, _("Exception")); - mesg = vim_strnsave(IObuff, (int)STRLEN(IObuff) + 4); + mesg = vim_strnsave(IObuff, STRLEN(IObuff) + 4); STRCAT(mesg, ": %s"); s = (char *)((except_T *)value)->value; } else if ((pending & CSTP_ERROR) && (pending & CSTP_INTERRUPT)) diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 70db2dc479..e56592923d 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -48,6 +48,7 @@ #include "nvim/keymap.h" #include "nvim/garray.h" #include "nvim/move.h" +#include "nvim/mouse.h" #include "nvim/ops.h" #include "nvim/option.h" #include "nvim/os_unix.h" @@ -270,10 +271,6 @@ getcmdline ( setmouse(); ui_cursor_shape(); /* may show different cursor shape */ - /* When inside an autocommand for writing "exiting" may be set and - * terminal mode set to cooked. Need to set raw mode here then. */ - settmode(TMODE_RAW); - init_history(); hiscnt = hislen; /* set hiscnt to impossible history value */ histype = hist_char2type(firstc); diff --git a/src/nvim/file_search.c b/src/nvim/file_search.c index a51f088586..9267e7991c 100644 --- a/src/nvim/file_search.c +++ b/src/nvim/file_search.c @@ -308,7 +308,7 @@ vim_findfile_init ( && (vim_ispathsep(path[1]) || path[1] == NUL) && (!tagfile || vim_strchr(p_cpo, CPO_DOTTAG) == NULL) && rel_fname != NULL) { - int len = (int)(path_tail(rel_fname) - rel_fname); + size_t len = (size_t)(path_tail(rel_fname) - rel_fname); if (!vim_isAbsName(rel_fname) && len + 1 < MAXPATHL) { /* Make the start dir an absolute path name. */ @@ -375,8 +375,9 @@ vim_findfile_init ( search_ctx->ffsc_stopdirs_v = ptr; walker = vim_strchr(walker, ';'); if (walker) { + assert(walker - helper >= 0); search_ctx->ffsc_stopdirs_v[dircount-1] = - vim_strnsave(helper, (int)(walker - helper)); + vim_strnsave(helper, (size_t)(walker - helper)); walker++; } else /* this might be "", which means ascent till top @@ -404,7 +405,8 @@ vim_findfile_init ( char *errpt; /* save the fix part of the path */ - search_ctx->ffsc_fix_path = vim_strnsave(path, (int)(wc_part - path)); + assert(wc_part - path >= 0); + search_ctx->ffsc_fix_path = vim_strnsave(path, (size_t)(wc_part - path)); /* * copy wc_path and add restricts to the '**' wildcard. diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index 3be9d89d87..021b12208e 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -1812,7 +1812,6 @@ failed: * Switch on raw mode now and clear the screen. */ if (read_stdin) { - settmode(TMODE_RAW); /* set to raw mode */ starttermcap(); screenclear(); } @@ -2387,9 +2386,6 @@ buf_write ( else overwriting = FALSE; - if (exiting) - settmode(TMODE_COOK); /* when exiting allow typeahead now */ - ++no_wait_return; /* don't wait for return yet */ /* diff --git a/src/nvim/macros.h b/src/nvim/macros.h index f8fd6ac6a2..215ad3a1f7 100644 --- a/src/nvim/macros.h +++ b/src/nvim/macros.h @@ -143,8 +143,9 @@ /* get length of multi-byte char, not including composing chars */ # define mb_cptr2len(p) (enc_utf8 ? utf_ptr2len(p) : (*mb_ptr2len)(p)) -# define MB_COPY_CHAR(f, \ - t) if (has_mbyte) mb_copy_char(&f, &t); else *t++ = *f++ +# define MB_COPY_CHAR(f, t) \ + if (has_mbyte) mb_copy_char((const char_u **)(&f), &t); \ + else *t++ = *f++ # define MB_CHARLEN(p) (has_mbyte ? mb_charlen(p) : (int)STRLEN(p)) # define MB_CHAR2LEN(c) (has_mbyte ? mb_char2len(c) : 1) # define PTR2CHAR(p) (has_mbyte ? mb_ptr2char(p) : (int)*(p)) diff --git a/src/nvim/main.c b/src/nvim/main.c index 68ae000c35..8e19cf3686 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -43,6 +43,7 @@ #include "nvim/log.h" #include "nvim/memory.h" #include "nvim/move.h" +#include "nvim/mouse.h" #include "nvim/normal.h" #include "nvim/ops.h" #include "nvim/option.h" @@ -60,10 +61,13 @@ #include "nvim/os/time.h" #include "nvim/os/input.h" #include "nvim/os/os.h" +#include "nvim/os/time.h" +#include "nvim/os/event.h" #include "nvim/os/signal.h" #include "nvim/msgpack_rpc/helpers.h" #include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" +#include "nvim/api/private/handle.h" /* Maximum number of commands from + or -c arguments. */ #define MAX_ARG_CMDS 10 @@ -142,13 +146,60 @@ static char *(main_errors[]) = #define ME_INVALID_ARG 5 }; +/// Performs early initialization. +/// +/// Needed for unit tests. Must be called after `time_init()`. +void early_init(void) +{ + handle_init(); + + (void)mb_init(); // init mb_bytelen_tab[] to ones + eval_init(); // init global variables + +#ifdef __QNXNTO__ + qnx_init(); // PhAttach() for clipboard, (and gui) +#endif + + // Init the table of Normal mode commands. + init_normal_cmds(); + +#if defined(HAVE_LOCALE_H) || defined(X_LOCALE) + // Setup to use the current locale (for ctype() and many other things). + // NOTE: Translated messages with encodings other than latin1 will not + // work until set_init_1() has been called! + init_locale(); +#endif + + // Allocate the first window and buffer. + // Can't do anything without it, exit when it fails. + if (!win_alloc_first()) { + mch_exit(0); + } + + init_yank(); // init yank buffers + + alist_init(&global_alist); // Init the argument list to empty. + global_alist.id = 0; + + // Set the default values for the options. + // NOTE: Non-latin1 translated messages are working only after this, + // because this is where "has_mbyte" will be set, which is used by + // msg_outtrans_len_attr(). + // First find out the home directory, needed to expand "~" in options. + init_homedir(); // find real value of $HOME + set_init_1(); + TIME_MSG("inits 1"); + + set_lang_var(); // set v:lang and v:ctype +} + #ifndef NO_VIM_MAIN /* skip this for unittests */ int main(int argc, char **argv) { char_u *fname = NULL; /* file name from command line */ mparm_T params; /* various parameters passed between * main() and other functions. */ - mch_early_init(); + time_init(); /* Many variables are in "params" so that we can pass them to invoked * functions without a lot of arguments. "argc" and "argv" are also @@ -157,24 +208,7 @@ int main(int argc, char **argv) init_startuptime(¶ms); - (void)mb_init(); /* init mb_bytelen_tab[] to ones */ - eval_init(); /* init global variables */ - -#ifdef __QNXNTO__ - qnx_init(); /* PhAttach() for clipboard, (and gui) */ -#endif - - /* Init the table of Normal mode commands. */ - init_normal_cmds(); - -#if defined(HAVE_LOCALE_H) || defined(X_LOCALE) - /* - * Setup to use the current locale (for ctype() and many other things). - * NOTE: Translated messages with encodings other than latin1 will not - * work until set_init_1() has been called! - */ - init_locale(); -#endif + early_init(); /* * Check if we have an interactive window. @@ -185,32 +219,6 @@ int main(int argc, char **argv) check_and_set_isatty(¶ms); /* - * Allocate the first window and buffer. - * Can't do anything without it, exit when it fails. - */ - if (win_alloc_first() == FAIL) - mch_exit(0); - - init_yank(); /* init yank buffers */ - - alist_init(&global_alist); /* Init the argument list to empty. */ - global_alist.id = 0; - - /* - * Set the default values for the options. - * NOTE: Non-latin1 translated messages are working only after this, - * because this is where "has_mbyte" will be set, which is used by - * msg_outtrans_len_attr(). - * First find out the home directory, needed to expand "~" in options. - */ - init_homedir(); /* find real value of $HOME */ - set_init_1(); - TIME_MSG("inits 1"); - - set_lang_var(); /* set v:lang and v:ctype */ - - - /* * Figure out the way to work from the command name argv[0]. * "vimdiff" starts diff mode, "rvim" sets "restricted", etc. */ @@ -252,14 +260,12 @@ int main(int argc, char **argv) */ - /* - * mch_init() sets up the terminal (window) for use. This must be - * done after resetting full_screen, otherwise it may move the cursor - * Note that we may use mch_exit() before mch_init()! - */ - mch_init(); + // term_init() sets up the terminal (window) for use. This must be + // done after resetting full_screen, otherwise it may move the cursor + term_init(); TIME_MSG("shell init"); + event_init(); if (!embedded_mode) { // Print a warning if stdout is not a terminal. @@ -276,7 +282,7 @@ int main(int argc, char **argv) // In embedded mode don't do terminal-related initializations, assume an // initial screen size of 80x20 full_screen = true; - set_shellsize(80, 20, false); + screen_resize(80, 20, false); } else { // set terminal name and get terminal capabilities (will set full_screen) // Do some initialization of the screen diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c index d79a46ceaa..9b4513e979 100644 --- a/src/nvim/mbyte.c +++ b/src/nvim/mbyte.c @@ -3002,7 +3002,7 @@ int utf_head_off(const char_u *base, const char_u *p) /* * Copy a character from "*fp" to "*tp" and advance the pointers. */ -void mb_copy_char(char_u **fp, char_u **tp) +void mb_copy_char(const char_u **fp, char_u **tp) { int l = (*mb_ptr2len)(*fp); diff --git a/src/nvim/memory.c b/src/nvim/memory.c index 4c5a45b8b6..f959ea55e4 100644 --- a/src/nvim/memory.c +++ b/src/nvim/memory.c @@ -305,6 +305,7 @@ char *xstpncpy(char *restrict dst, const char *restrict src, size_t maxlen) /// @param size Size of destination buffer /// @return Length of the source string (i.e.: strlen(src)) size_t xstrlcpy(char *restrict dst, const char *restrict src, size_t size) + FUNC_ATTR_NONNULL_ALL { size_t ret = strlen(src); @@ -348,7 +349,7 @@ char *xstrdup(const char *str) /// @param c The byte to search for. /// @param len The length of the memory object. /// @returns a pointer to the found byte in src[len], or NULL. -void *xmemrchr(void *src, uint8_t c, size_t len) +void *xmemrchr(const void *src, uint8_t c, size_t len) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PURE { while (len--) { diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index 230e198121..fc848466c6 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -42,6 +42,7 @@ #include "nvim/misc2.h" #include "nvim/garray.h" #include "nvim/move.h" +#include "nvim/mouse.h" #include "nvim/option.h" #include "nvim/os_unix.h" #include "nvim/path.h" @@ -2286,8 +2287,6 @@ int ask_yesno(char_u *str, int direct) int r = ' '; int save_State = State; - if (exiting) /* put terminal in raw mode for this question */ - settmode(TMODE_RAW); ++no_wait_return; #ifdef USE_ON_FLY_SCROLL dont_scroll = TRUE; /* disallow scrolling here */ diff --git a/src/nvim/mouse.c b/src/nvim/mouse.c index 7fc581a7c0..439cdbd5c8 100644 --- a/src/nvim/mouse.c +++ b/src/nvim/mouse.c @@ -2,8 +2,12 @@ #include "nvim/mouse.h" #include "nvim/vim.h" -#include "nvim/screen.h" +#include "nvim/ascii.h" #include "nvim/window.h" +#include "nvim/strings.h" +#include "nvim/screen.h" +#include "nvim/ui.h" +#include "nvim/os_unix.h" #include "nvim/term.h" #include "nvim/fold.h" #include "nvim/diff.h" @@ -165,11 +169,9 @@ retnomove: // (MOUSE_FOCUS was set above if we dragged first). if (dragwin == NULL || (flags & MOUSE_RELEASED)) win_enter(wp, true); // can make wp invalid! -# ifdef CHECK_DOUBLE_CLICK // set topline, to be able to check for double click ourselves if (curwin != old_curwin) set_mouse_topline(curwin); -# endif if (on_status_line) { // In (or below) status line // Don't use start_arrow() if we're in the same window if (curwin == old_curwin) @@ -436,3 +438,62 @@ win_T *mouse_find_win(int *rowp, int *colp) } return fp->fr_win; } + +/* + * setmouse() - switch mouse on/off depending on current mode and 'mouse' + */ +void setmouse(void) +{ + int checkfor; + + + /* be quick when mouse is off */ + if (*p_mouse == NUL) + return; + + /* don't switch mouse on when not in raw mode (Ex mode) */ + if (cur_tmode != TMODE_RAW) { + mch_setmouse(false); + return; + } + + if (VIsual_active) + checkfor = MOUSE_VISUAL; + else if (State == HITRETURN || State == ASKMORE || State == SETWSIZE) + checkfor = MOUSE_RETURN; + else if (State & INSERT) + checkfor = MOUSE_INSERT; + else if (State & CMDLINE) + checkfor = MOUSE_COMMAND; + else if (State == CONFIRM || State == EXTERNCMD) + checkfor = ' '; /* don't use mouse for ":confirm" or ":!cmd" */ + else + checkfor = MOUSE_NORMAL; /* assume normal mode */ + + if (mouse_has(checkfor)) + mch_setmouse(true); + else + mch_setmouse(false); +} + +/* + * Return true if + * - "c" is in 'mouse', or + * - 'a' is in 'mouse' and "c" is in MOUSE_A, or + * - the current buffer is a help file and 'h' is in 'mouse' and we are in a + * normal editing mode (not at hit-return message). + */ +int mouse_has(int c) +{ + for (char_u *p = p_mouse; *p; ++p) + switch (*p) { + case 'a': if (vim_strchr((char_u *)MOUSE_A, c) != NULL) + return true; + break; + case MOUSE_HELP: if (c != MOUSE_RETURN && curbuf->b_help) + return true; + break; + default: if (c == *p) return true; break; + } + return false; +} diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 0a43d59607..1b21100933 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -46,6 +46,7 @@ #include "nvim/misc2.h" #include "nvim/keymap.h" #include "nvim/move.h" +#include "nvim/mouse.h" #include "nvim/ops.h" #include "nvim/option.h" #include "nvim/quickfix.h" @@ -7374,3 +7375,11 @@ static void nv_cursorhold(cmdarg_T *cap) did_cursorhold = true; cap->retval |= CA_COMMAND_BUSY; /* don't call edit() now */ } + +/* + * Return TRUE when 'mousemodel' is set to "popup" or "popup_setpos". + */ +static int mouse_model_popup(void) +{ + return p_mousem[0] == 'p'; +} diff --git a/src/nvim/option.c b/src/nvim/option.c index ee70b5bf8a..2882d7a511 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -66,6 +66,7 @@ #include "nvim/garray.h" #include "nvim/cursor_shape.h" #include "nvim/move.h" +#include "nvim/mouse.h" #include "nvim/normal.h" #include "nvim/os_unix.h" #include "nvim/path.h" @@ -5540,7 +5541,7 @@ set_num_option ( *pp = old_value; else if (full_screen ) - set_shellsize((int)Columns, (int)Rows, TRUE); + screen_resize((int)Columns, (int)Rows, TRUE); else { /* Postpone the resizing; check the size and cmdline position for * messages. */ diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c index 3aefbc39d1..b2e62453c5 100644 --- a/src/nvim/os/env.c +++ b/src/nvim/os/env.c @@ -43,7 +43,7 @@ char *os_getenvname_at_index(size_t index) if (str == NULL) { return NULL; } - int namesize = 0; + size_t namesize = 0; while (str[namesize] != '=' && str[namesize] != NUL) { namesize++; } diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c index 1b279f18f5..cdd85e4e96 100644 --- a/src/nvim/os/shell.c +++ b/src/nvim/os/shell.c @@ -104,14 +104,10 @@ int os_call_shell(char_u *cmd, ShellOpts opts, char_u *extra_arg) { DynamicBuffer input = DYNAMIC_BUFFER_INIT; char *output = NULL, **output_ptr = NULL; - int current_state = State, old_mode = cur_tmode; + int current_state = State; bool forward_output = true; out_flush(); - if (opts & kShellOptCooked) { - settmode(TMODE_COOK); - } - // While the child is running, ignore terminating signals signal_reject_deadly(); @@ -155,10 +151,6 @@ int os_call_shell(char_u *cmd, ShellOpts opts, char_u *extra_arg) msg_putchar('\n'); } - if (old_mode == TMODE_RAW) { - // restore mode - settmode(TMODE_RAW); - } State = current_state; signal_accept_deadly(); diff --git a/src/nvim/os/time.c b/src/nvim/os/time.c index a4871ef499..3794e813d2 100644 --- a/src/nvim/os/time.c +++ b/src/nvim/os/time.c @@ -6,6 +6,7 @@ #include <uv.h> #include "nvim/os/time.h" +#include "nvim/os/event.h" #include "nvim/vim.h" #include "nvim/term.h" @@ -38,31 +39,22 @@ uint64_t os_hrtime(void) /// @param ignoreinput If true, allow a SIGINT to interrupt us void os_delay(uint64_t milliseconds, bool ignoreinput) { - os_microdelay(milliseconds * 1000, ignoreinput); + if (ignoreinput) { + if (milliseconds > INT_MAX) { + milliseconds = INT_MAX; + } + event_poll_until((int)milliseconds, got_int); + } else { + os_microdelay(milliseconds * 1000); + } } /// Sleeps for a certain amount of microseconds /// /// @param microseconds Number of microseconds to sleep -/// @param ignoreinput If true, allow a SIGINT to interrupt us -void os_microdelay(uint64_t microseconds, bool ignoreinput) +void os_microdelay(uint64_t microseconds) { - int old_tmode; - - if (ignoreinput) { - // Go to cooked mode without echo, to allow SIGINT interrupting us - // here - old_tmode = curr_tmode; - - if (curr_tmode == TMODE_RAW) - settmode(TMODE_SLEEP); - - microdelay(microseconds); - - settmode(old_tmode); - } else { - microdelay(microseconds); - } + microdelay(microseconds); } /// Portable version of POSIX localtime_r() diff --git a/src/nvim/os_unix.c b/src/nvim/os_unix.c index 3bf1198b46..677976e3e1 100644 --- a/src/nvim/os_unix.c +++ b/src/nvim/os_unix.c @@ -1,6 +1,5 @@ /* * VIM - Vi IMproved by Bram Moolenaar - * OS/2 port by Paul Slootman * VMS merge by Zoltan Arpadffy * * Do ":help uganda" in Vim to read copying and usage conditions. @@ -10,7 +9,7 @@ /* * os_unix.c -- code for all flavors of Unix (BSD, SYSV, SVR4, POSIX, ...) - * Also for BeOS and Atari MiNT. + * Also for BeOS * * A lot of this file was originally written by Juergen Weigert and later * changed beyond recognition. @@ -38,6 +37,7 @@ #include "nvim/message.h" #include "nvim/misc1.h" #include "nvim/misc2.h" +#include "nvim/mouse.h" #include "nvim/garray.h" #include "nvim/path.h" #include "nvim/screen.h" @@ -82,47 +82,22 @@ static int did_set_title = FALSE; static char_u *oldicon = NULL; static int did_set_icon = FALSE; - - -/* - * Write s[len] to the screen. - */ -void mch_write(char_u *s, int len) -{ - if (embedded_mode) { - // TODO(tarruda): This is a temporary hack to stop Neovim from writing - // messages to stdout in embedded mode. In the future, embedded mode will - // be the only possibility(GUIs will always start neovim with a msgpack-rpc - // over stdio) and this function won't exist. - // - // The reason for this is because before Neovim fully migrates to a - // msgpack-rpc-driven architecture, we must have a fully functional - // UI working - return; - } - - ignored = (int)write(1, (char *)s, len); - if (p_wd) /* Unix is too fast, slow down a bit more */ - os_microdelay(p_wd, false); -} - /* * If the machine has job control, use it to suspend the program, * otherwise fake it by starting a new shell. */ void mch_suspend(void) { - /* BeOS does have SIGTSTP, but it doesn't work. */ -#if defined(SIGTSTP) && !defined(__BEOS__) +#if defined(SIGTSTP) out_flush(); /* needed to make cursor visible on some systems */ settmode(TMODE_COOK); out_flush(); /* needed to disable mouse on some systems */ - + // Note: compiler defines _REENTRANT when given -pthread flag. # if defined(_REENTRANT) && defined(SIGCONT) sigcont_received = FALSE; # endif - kill(0, SIGTSTP); /* send ourselves a STOP signal */ + uv_kill(0, SIGTSTP); // send ourselves a STOP signal # if defined(_REENTRANT) && defined(SIGCONT) /* * Wait for the SIGCONT signal to be handled. It generally happens @@ -154,20 +129,6 @@ void mch_suspend(void) #endif } -void mch_init(void) -{ - Columns = 80; - Rows = 24; - - out_flush(); - -#ifdef MACOS_CONVERT - mac_conv_init(); -#endif - - event_init(); -} - static int get_x11_title(int test_only) { return FALSE; @@ -478,12 +439,6 @@ int mch_nodetype(char_u *name) return NODE_WRITABLE; } -void mch_early_init(void) -{ - handle_init(); - time_init(); -} - #if defined(EXITFREE) || defined(PROTO) void mch_free_mem(void) { @@ -569,9 +524,8 @@ void mch_settmode(int tmode) { static int first = TRUE; - /* Why is NeXT excluded here (and not in os_unixx.h)? */ #if defined(ECHOE) && defined(ICANON) && (defined(HAVE_TERMIO_H) || \ - defined(HAVE_TERMIOS_H)) && !defined(__NeXT__) + defined(HAVE_TERMIOS_H)) /* * for "new" tty systems */ @@ -599,9 +553,8 @@ void mch_settmode(int tmode) */ tnew.c_iflag &= ~ICRNL; tnew.c_lflag &= ~(ICANON | ECHO | ISIG | ECHOE -# if defined(IEXTEN) && !defined(__MINT__) +# if defined(IEXTEN) | IEXTEN /* IEXTEN enables typing ^V on SOLARIS */ - /* but it breaks function keys on MINT */ # endif ); # ifdef ONLCR /* don't map NL -> CR NL, we do it ourselves */ @@ -667,9 +620,8 @@ void get_stty(void) char_u buf[2]; char_u *p; - /* Why is NeXT excluded here (and not in os_unixx.h)? */ #if defined(ECHOE) && defined(ICANON) && (defined(HAVE_TERMIO_H) || \ - defined(HAVE_TERMIOS_H)) && !defined(__NeXT__) + defined(HAVE_TERMIOS_H)) /* for "new" tty systems */ # ifdef HAVE_TERMIOS_H struct termios keys; diff --git a/src/nvim/os_unix_defs.h b/src/nvim/os_unix_defs.h index 2a44ec3412..ebea86ebcf 100644 --- a/src/nvim/os_unix_defs.h +++ b/src/nvim/os_unix_defs.h @@ -8,17 +8,13 @@ * Do ":help credits" in Vim to see a list of people who contributed. */ -/* - * NextStep has a problem with configure, undefine a few things: - */ - #include <stdio.h> #include <ctype.h> -# include <sys/types.h> -# include <sys/stat.h> +#include <sys/types.h> +#include <sys/stat.h> -# include <stdlib.h> +#include <stdlib.h> #ifdef HAVE_UNISTD_H # include <unistd.h> diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 2dbf3f8888..0225eb72c1 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -103,6 +103,7 @@ #include "nvim/ex_cmds.h" #include "nvim/ex_cmds2.h" #include "nvim/ex_getln.h" +#include "nvim/edit.h" #include "nvim/farsi.h" #include "nvim/fileio.h" #include "nvim/fold.h" @@ -120,6 +121,7 @@ #include "nvim/move.h" #include "nvim/normal.h" #include "nvim/option.h" +#include "nvim/os_unix.h" #include "nvim/path.h" #include "nvim/popupmnu.h" #include "nvim/quickfix.h" @@ -129,6 +131,7 @@ #include "nvim/strings.h" #include "nvim/syntax.h" #include "nvim/term.h" +#include "nvim/ui.h" #include "nvim/undo.h" #include "nvim/version.h" #include "nvim/window.h" @@ -8117,3 +8120,98 @@ int screen_screenrow(void) return screen_cur_row; } +/* + * Set size of the Vim shell. + * If 'mustset' is TRUE, we must set Rows and Columns, do not get the real + * window size (this is used for the :win command). + * If 'mustset' is FALSE, we may try to get the real window size and if + * it fails use 'width' and 'height'. + */ +void screen_resize(int width, int height, int mustset) +{ + static int busy = FALSE; + + /* + * Avoid recursiveness, can happen when setting the window size causes + * another window-changed signal. + */ + if (busy) + return; + + if (width < 0 || height < 0) /* just checking... */ + return; + + if (State == HITRETURN || State == SETWSIZE) { + /* postpone the resizing */ + State = SETWSIZE; + return; + } + + /* curwin->w_buffer can be NULL when we are closing a window and the + * buffer has already been closed and removing a scrollbar causes a resize + * event. Don't resize then, it will happen after entering another buffer. + */ + if (curwin->w_buffer == NULL) + return; + + ++busy; + + + if (mustset || (ui_get_shellsize() == FAIL && height != 0)) { + Rows = height; + Columns = width; + check_shellsize(); + mch_set_shellsize(); + } else + check_shellsize(); + + /* The window layout used to be adjusted here, but it now happens in + * screenalloc() (also invoked from screenclear()). That is because the + * "busy" check above may skip this, but not screenalloc(). */ + + if (State != ASKMORE && State != EXTERNCMD && State != CONFIRM) + screenclear(); + else + screen_start(); /* don't know where cursor is now */ + + if (starting != NO_SCREEN) { + maketitle(); + changed_line_abv_curs(); + invalidate_botline(); + + /* + * We only redraw when it's needed: + * - While at the more prompt or executing an external command, don't + * redraw, but position the cursor. + * - While editing the command line, only redraw that. + * - in Ex mode, don't redraw anything. + * - Otherwise, redraw right now, and position the cursor. + * Always need to call update_screen() or screenalloc(), to make + * sure Rows/Columns and the size of ScreenLines[] is correct! + */ + if (State == ASKMORE || State == EXTERNCMD || State == CONFIRM + || exmode_active) { + screenalloc(false); + repeat_message(); + } else { + if (curwin->w_p_scb) + do_check_scrollbind(TRUE); + if (State & CMDLINE) { + update_screen(NOT_VALID); + redrawcmdline(); + } else { + update_topline(); + if (pum_visible()) { + redraw_later(NOT_VALID); + ins_compl_show_pum(); /* This includes the redraw. */ + } else + update_screen(NOT_VALID); + if (redrawing()) + setcursor(); + } + } + cursor_on(); /* redrawing may have switched it off */ + } + out_flush(); + --busy; +} diff --git a/src/nvim/search.c b/src/nvim/search.c index e9184d84cd..3055729bf8 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -39,6 +39,7 @@ #include "nvim/misc1.h" #include "nvim/misc2.h" #include "nvim/move.h" +#include "nvim/mouse.h" #include "nvim/normal.h" #include "nvim/option.h" #include "nvim/path.h" diff --git a/src/nvim/strings.c b/src/nvim/strings.c index 6c69b3b34a..20008bca16 100644 --- a/src/nvim/strings.c +++ b/src/nvim/strings.c @@ -49,7 +49,8 @@ /* * Copy "string" into newly allocated memory. */ -char_u *vim_strsave(char_u *string) FUNC_ATTR_NONNULL_RET +char_u *vim_strsave(const char_u *string) + FUNC_ATTR_NONNULL_RET FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_ALL { return (char_u *)xstrdup((char *)string); } @@ -60,7 +61,8 @@ char_u *vim_strsave(char_u *string) FUNC_ATTR_NONNULL_RET * The allocated memory always has size "len + 1", also when "string" is * shorter. */ -char_u *vim_strnsave(char_u *string, int len) FUNC_ATTR_NONNULL_RET +char_u *vim_strnsave(const char_u *string, size_t len) + FUNC_ATTR_NONNULL_RET FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_ALL { return (char_u *)strncpy(xmallocz(len), (char *)string, len); } @@ -69,31 +71,30 @@ char_u *vim_strnsave(char_u *string, int len) FUNC_ATTR_NONNULL_RET * Same as vim_strsave(), but any characters found in esc_chars are preceded * by a backslash. */ -char_u *vim_strsave_escaped(char_u *string, char_u *esc_chars) - FUNC_ATTR_NONNULL_RET +char_u *vim_strsave_escaped(const char_u *string, const char_u *esc_chars) + FUNC_ATTR_NONNULL_RET FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_ALL { - return vim_strsave_escaped_ext(string, esc_chars, '\\', FALSE); + return vim_strsave_escaped_ext(string, esc_chars, '\\', false); } /* - * Same as vim_strsave_escaped(), but when "bsl" is TRUE also escape + * Same as vim_strsave_escaped(), but when "bsl" is true also escape * characters where rem_backslash() would remove the backslash. * Escape the characters with "cc". */ -char_u *vim_strsave_escaped_ext(char_u *string, char_u *esc_chars, int cc, int bsl) - FUNC_ATTR_NONNULL_RET +char_u *vim_strsave_escaped_ext(const char_u *string, const char_u *esc_chars, + char_u cc, bool bsl) + FUNC_ATTR_NONNULL_RET FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_ALL { - unsigned length; - int l; - /* * First count the number of backslashes required. * Then allocate the memory and insert them. */ - length = 1; /* count the trailing NUL */ - for (char_u *p = string; *p; p++) { - if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1) { - length += l; /* count a multibyte char */ + size_t length = 1; // count the trailing NUL + for (const char_u *p = string; *p; p++) { + size_t l; + if (has_mbyte && (l = (size_t)(*mb_ptr2len)(p)) > 1) { + length += l; // count a multibyte char p += l - 1; continue; } @@ -104,9 +105,10 @@ char_u *vim_strsave_escaped_ext(char_u *string, char_u *esc_chars, int cc, int b char_u *escaped_string = xmalloc(length); char_u *p2 = escaped_string; - for (char_u *p = string; *p; p++) { - if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1) { - memmove(p2, p, (size_t)l); + for (const char_u *p = string; *p; p++) { + size_t l; + if (has_mbyte && (l = (size_t)(*mb_ptr2len)(p)) > 1) { + memcpy(p2, p, l); p2 += l; p += l - 1; /* skip multibyte char */ continue; @@ -130,10 +132,10 @@ char_u *vim_strsave_escaped_ext(char_u *string, char_u *esc_chars, int cc, int b * When "do_newline" is false do not escape newline unless it is csh shell. * Returns the result in allocated memory. */ -char_u *vim_strsave_shellescape(char_u *string, bool do_special, bool do_newline) +char_u *vim_strsave_shellescape(const char_u *string, + bool do_special, bool do_newline) + FUNC_ATTR_NONNULL_RET FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_ALL { - unsigned length; - char_u *p; char_u *d; char_u *escaped_string; int l; @@ -146,8 +148,8 @@ char_u *vim_strsave_shellescape(char_u *string, bool do_special, bool do_newline csh_like = csh_like_shell(); /* First count the number of extra bytes required. */ - length = (unsigned)STRLEN(string) + 3; /* two quotes and a trailing NUL */ - for (p = string; *p != NUL; mb_ptr_adv(p)) { + size_t length = STRLEN(string) + 3; // two quotes and a trailing NUL + for (const char_u *p = string; *p != NUL; mb_ptr_adv(p)) { if (*p == '\'') length += 3; /* ' => '\'' */ if ((*p == '\n' && (csh_like || do_newline)) @@ -169,7 +171,7 @@ char_u *vim_strsave_shellescape(char_u *string, bool do_special, bool do_newline /* add opening quote */ *d++ = '\''; - for (p = string; *p != NUL; ) { + for (const char_u *p = string; *p != NUL; ) { if (*p == '\'') { *d++ = '\''; *d++ = '\\'; @@ -207,7 +209,8 @@ char_u *vim_strsave_shellescape(char_u *string, bool do_special, bool do_newline * Like vim_strsave(), but make all characters uppercase. * This uses ASCII lower-to-upper case translation, language independent. */ -char_u *vim_strsave_up(char_u *string) +char_u *vim_strsave_up(const char_u *string) + FUNC_ATTR_NONNULL_RET FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_ALL { char_u *p1; @@ -220,7 +223,8 @@ char_u *vim_strsave_up(char_u *string) * Like vim_strnsave(), but make all characters uppercase. * This uses ASCII lower-to-upper case translation, language independent. */ -char_u *vim_strnsave_up(char_u *string, int len) FUNC_ATTR_NONNULL_RET +char_u *vim_strnsave_up(const char_u *string, size_t len) + FUNC_ATTR_NONNULL_RET FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_ALL { char_u *p1 = vim_strnsave(string, len); vim_strup(p1); @@ -231,14 +235,15 @@ char_u *vim_strnsave_up(char_u *string, int len) FUNC_ATTR_NONNULL_RET * ASCII lower-to-upper case translation, language independent. */ void vim_strup(char_u *p) + FUNC_ATTR_NONNULL_ALL { char_u *p2; - int c; + char_u c; if (p != NULL) { p2 = p; while ((c = *p2) != NUL) - *p2++ = (c < 'a' || c > 'z') ? c : (c - 0x20); + *p2++ = (char_u)((c < 'a' || c > 'z') ? c : c - 0x20); } } @@ -246,7 +251,8 @@ void vim_strup(char_u *p) * Make string "s" all upper-case and return it in allocated memory. * Handles multi-byte characters as well as possible. */ -char_u *strup_save(char_u *orig) +char_u *strup_save(const char_u *orig) + FUNC_ATTR_NONNULL_RET FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_ALL { char_u *res = vim_strsave(orig); @@ -264,8 +270,8 @@ char_u *strup_save(char_u *orig) int newl = utf_char2len(uc); if (newl != l) { // TODO(philix): use xrealloc() in strup_save() - char_u *s = xmalloc(STRLEN(res) + 1 + newl - l); - memmove(s, res, p - res); + char_u *s = xmalloc(STRLEN(res) + (size_t)(1 + newl - l)); + memcpy(s, res, (size_t)(p - res)); STRCPY(s + (p - res) + newl, p + l); p = s + (p - res); free(res); @@ -277,7 +283,7 @@ char_u *strup_save(char_u *orig) } else if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1) p += l; /* skip multi-byte character */ else { - *p = TOUPPER_LOC(*p); /* note that toupper() can be a macro */ + *p = (char_u) TOUPPER_LOC(*p); // note that toupper() can be a macro p++; } } @@ -289,6 +295,7 @@ char_u *strup_save(char_u *orig) * copy a space a number of times */ void copy_spaces(char_u *ptr, size_t count) + FUNC_ATTR_NONNULL_ALL { size_t i = count; char_u *p = ptr; @@ -301,7 +308,8 @@ void copy_spaces(char_u *ptr, size_t count) * Copy a character a number of times. * Does not work for multi-byte characters! */ -void copy_chars(char_u *ptr, size_t count, int c) +void copy_chars(char_u *ptr, size_t count, char_u c) + FUNC_ATTR_NONNULL_ALL { size_t i = count; char_u *p = ptr; @@ -314,6 +322,7 @@ void copy_chars(char_u *ptr, size_t count, int c) * delete spaces at the end of a string */ void del_trailing_spaces(char_u *ptr) + FUNC_ATTR_NONNULL_ALL { char_u *q; @@ -326,7 +335,8 @@ void del_trailing_spaces(char_u *ptr) * Like strncpy(), but always terminate the result with one NUL. * "to" must be "len + 1" long! */ -void vim_strncpy(char_u *to, char_u *from, size_t len) +void vim_strncpy(char_u *restrict to, const char_u *restrict from, size_t len) + FUNC_ATTR_NONNULL_ALL { STRNCPY(to, from, len); to[len] = NUL; @@ -336,13 +346,15 @@ void vim_strncpy(char_u *to, char_u *from, size_t len) * Like strcat(), but make sure the result fits in "tosize" bytes and is * always NUL terminated. */ -void vim_strcat(char_u *to, char_u *from, size_t tosize) +void vim_strcat(char_u *restrict to, const char_u *restrict from, + size_t tosize) + FUNC_ATTR_NONNULL_ALL { size_t tolen = STRLEN(to); size_t fromlen = STRLEN(from); if (tolen + fromlen + 1 > tosize) { - memmove(to + tolen, from, tosize - tolen - 1); + memcpy(to + tolen, from, tosize - tolen - 1); to[tosize - 1] = NUL; } else STRCPY(to + tolen, from); @@ -354,7 +366,8 @@ void vim_strcat(char_u *to, char_u *from, size_t tosize) * Doesn't work for multi-byte characters. * return 0 for match, < 0 for smaller, > 0 for bigger */ -int vim_stricmp(char *s1, char *s2) +int vim_stricmp(const char *s1, const char *s2) + FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PURE { int i; @@ -377,7 +390,8 @@ int vim_stricmp(char *s1, char *s2) * Doesn't work for multi-byte characters. * return 0 for match, < 0 for smaller, > 0 for bigger */ -int vim_strnicmp(char *s1, char *s2, size_t len) +int vim_strnicmp(const char *s1, const char *s2, size_t len) + FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PURE { int i; @@ -400,16 +414,16 @@ int vim_strnicmp(char *s1, char *s2, size_t len) * with characters from 128 to 255 correctly. It also doesn't return a * pointer to the NUL at the end of the string. */ -char_u *vim_strchr(char_u *string, int c) +char_u *vim_strchr(const char_u *string, int c) + FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PURE { - char_u *p; int b; - p = string; + const char_u *p = string; if (enc_utf8 && c >= 0x80) { while (*p != NUL) { if (utf_ptr2char(p) == c) - return p; + return (char_u *) p; p += (*mb_ptr2len)(p); } return NULL; @@ -420,7 +434,7 @@ char_u *vim_strchr(char_u *string, int c) c = ((unsigned)c >> 8) & 0xff; while ((b = *p) != NUL) { if (b == c && p[1] == n2) - return p; + return (char_u *) p; p += (*mb_ptr2len)(p); } return NULL; @@ -428,14 +442,14 @@ char_u *vim_strchr(char_u *string, int c) if (has_mbyte) { while ((b = *p) != NUL) { if (b == c) - return p; + return (char_u *) p; p += (*mb_ptr2len)(p); } return NULL; } while ((b = *p) != NUL) { if (b == c) - return p; + return (char_u *) p; ++p; } return NULL; @@ -446,13 +460,14 @@ char_u *vim_strchr(char_u *string, int c) * strings with characters above 128 correctly. It also doesn't return a * pointer to the NUL at the end of the string. */ -char_u *vim_strbyte(char_u *string, int c) +char_u *vim_strbyte(const char_u *string, int c) + FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PURE { - char_u *p = string; + const char_u *p = string; while (*p != NUL) { if (*p == c) - return p; + return (char_u *) p; ++p; } return NULL; @@ -463,24 +478,26 @@ char_u *vim_strbyte(char_u *string, int c) * Return NULL if not found. * Does not handle multi-byte char for "c"! */ -char_u *vim_strrchr(char_u *string, int c) +char_u *vim_strrchr(const char_u *string, int c) + FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PURE { - char_u *retval = NULL; - char_u *p = string; + const char_u *retval = NULL; + const char_u *p = string; while (*p) { if (*p == c) retval = p; mb_ptr_adv(p); } - return retval; + return (char_u *) retval; } /* * Vim has its own isspace() function, because on some machines isspace() * can't handle characters above 128. */ -int vim_isspace(int x) +bool vim_isspace(int x) + FUNC_ATTR_CONST { return (x >= 9 && x <= 13) || x == ' '; } @@ -493,6 +510,7 @@ int vim_isspace(int x) # include "strings.c.generated.h" #endif static int sort_compare(const void *s1, const void *s2) + FUNC_ATTR_NONNULL_ALL { return STRCMP(*(char **)s1, *(char **)s2); } @@ -503,24 +521,26 @@ void sort_strings(char_u **files, int count) } /* - * Return TRUE if string "s" contains a non-ASCII character (128 or higher). - * When "s" is NULL FALSE is returned. + * Return true if string "s" contains a non-ASCII character (128 or higher). + * When "s" is NULL false is returned. */ -int has_non_ascii(char_u *s) +bool has_non_ascii(const char_u *s) + FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PURE { - char_u *p; + const char_u *p; if (s != NULL) for (p = s; *p != NUL; ++p) if (*p >= 128) - return TRUE; - return FALSE; + return true; + return false; } /* * Concatenate two strings and return the result in allocated memory. */ -char_u *concat_str(char_u *str1, char_u *str2) FUNC_ATTR_NONNULL_RET +char_u *concat_str(const char_u *restrict str1, const char_u *restrict str2) + FUNC_ATTR_NONNULL_RET FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_ALL { size_t l = STRLEN(str1); char_u *dest = xmalloc(l + STRLEN(str2) + 1); diff --git a/src/nvim/term.c b/src/nvim/term.c index 3d1053bd2f..54508b1daa 100644 --- a/src/nvim/term.c +++ b/src/nvim/term.c @@ -43,6 +43,7 @@ #include "nvim/keymap.h" #include "nvim/memory.h" #include "nvim/move.h" +#include "nvim/mouse.h" #include "nvim/normal.h" #include "nvim/option.h" #include "nvim/os_unix.h" @@ -639,7 +640,7 @@ static struct builtin_term builtin_termcaps[] = {K_BS, "\x7f"}, /* for some reason 0177 doesn't work */ # endif -# if defined(ALL_BUILTIN_TCAPS) || defined(__MINT__) +# if defined(ALL_BUILTIN_TCAPS) /* * Ordinary vt52 */ @@ -998,7 +999,7 @@ static struct builtin_term builtin_termcaps[] = -#if defined(UNIX) && !defined(__MINT__) +#if defined(UNIX) # define DEFAULT_TERM (char_u *)"ansi" #endif @@ -1010,6 +1011,30 @@ static struct builtin_term builtin_termcaps[] = # define DEFAULT_TERM (char_u *)"dumb" #endif +/// Sets up the terminal window for use. +/// +/// This must be done after resetting full_screen, otherwise it may move the +/// cursor. +/// +/// @remark We may call mch_exit() before calling this. +void term_init(void) +{ + Columns = 80; + Rows = 24; + + // Prevent buffering output. + // Output gets explicitly buffered and flushed by out_flush() at times like, + // for example, when the user presses a key. Without this line, vim will not + // render the screen correctly. + setbuf(stdout, NULL); + + out_flush(); + +#ifdef MACOS_CONVERT + mac_conv_init(); +#endif +} + /* * Term_strings contains currently used terminal output strings. * It is initialized with the default values by parse_builtin_tcap(). @@ -1448,7 +1473,7 @@ int set_termname(char_u *term) width = 80; height = 24; /* most terminals are 24 lines */ } - set_shellsize(width, height, FALSE); /* may change Rows */ + screen_resize(width, height, FALSE); /* may change Rows */ if (starting != NO_SCREEN) { if (scroll_region) scroll_region_reset(); /* In case Rows changed */ @@ -1482,7 +1507,6 @@ int set_termname(char_u *term) # define HMT_PTERM 8 # define HMT_URXVT 16 # define HMT_SGR 32 -static int has_mouse_termcode = 0; void set_mouse_termcode ( @@ -1493,16 +1517,6 @@ set_mouse_termcode ( char_u name[2] = { n, KE_FILLER }; add_termcode(name, s, FALSE); - if (n == KS_NETTERM_MOUSE) - has_mouse_termcode |= HMT_NETTERM; - else if (n == KS_DEC_MOUSE) - has_mouse_termcode |= HMT_DEC; - else if (n == KS_URXVT_MOUSE) - has_mouse_termcode |= HMT_URXVT; - else if (n == KS_SGR_MOUSE) - has_mouse_termcode |= HMT_SGR; - else - has_mouse_termcode |= HMT_NORMAL; } # if (defined(UNIX) && defined(FEAT_MOUSE_TTY)) || defined(PROTO) @@ -1514,16 +1528,6 @@ del_mouse_termcode ( char_u name[2] = { n, KE_FILLER }; del_termcode(name); - if (n == KS_NETTERM_MOUSE) - has_mouse_termcode &= ~HMT_NETTERM; - else if (n == KS_DEC_MOUSE) - has_mouse_termcode &= ~HMT_DEC; - else if (n == KS_URXVT_MOUSE) - has_mouse_termcode &= ~HMT_URXVT; - else if (n == KS_SGR_MOUSE) - has_mouse_termcode &= ~HMT_SGR; - else - has_mouse_termcode &= ~HMT_NORMAL; } # endif @@ -1822,11 +1826,35 @@ void termcapinit(char_u *name) set_termname(T_NAME != NULL ? T_NAME : term); } +/// Write s[len] to the screen. +void term_write(char_u *s, size_t len) +{ + if (embedded_mode) { + // TODO(tarruda): This is a temporary hack to stop Neovim from writing + // messages to stdout in embedded mode. In the future, embedded mode will + // be the only possibility(GUIs will always start neovim with a msgpack-rpc + // over stdio) and this function won't exist. + // + // The reason for this is because before Neovim fully migrates to a + // msgpack-rpc-driven architecture, we must have a fully functional + // UI working + return; + } + + (void) fwrite(s, len, 1, stdout); + +#ifdef UNIX + if (p_wd) { // Unix is too fast, slow down a bit more + os_microdelay(p_wd); + } +#endif +} + /* * the number of calls to ui_write is reduced by using the buffer "out_buf" */ # define OUT_SIZE 2047 -/* Add one to allow mch_write() in os_win32.c to append a NUL */ +// Add one to allow term_write() in os_win32.c to append a NUL static char_u out_buf[OUT_SIZE + 1]; static int out_pos = 0; /* number of chars in out_buf */ @@ -2241,7 +2269,7 @@ void win_new_shellsize(void) */ void shell_resized(void) { - set_shellsize(0, 0, FALSE); + screen_resize(0, 0, FALSE); } /* @@ -2263,102 +2291,6 @@ void shell_resized_check(void) } /* - * Set size of the Vim shell. - * If 'mustset' is TRUE, we must set Rows and Columns, do not get the real - * window size (this is used for the :win command). - * If 'mustset' is FALSE, we may try to get the real window size and if - * it fails use 'width' and 'height'. - */ -void set_shellsize(int width, int height, int mustset) -{ - static int busy = FALSE; - - /* - * Avoid recursiveness, can happen when setting the window size causes - * another window-changed signal. - */ - if (busy) - return; - - if (width < 0 || height < 0) /* just checking... */ - return; - - if (State == HITRETURN || State == SETWSIZE) { - /* postpone the resizing */ - State = SETWSIZE; - return; - } - - /* curwin->w_buffer can be NULL when we are closing a window and the - * buffer has already been closed and removing a scrollbar causes a resize - * event. Don't resize then, it will happen after entering another buffer. - */ - if (curwin->w_buffer == NULL) - return; - - ++busy; - - - if (mustset || (ui_get_shellsize() == FAIL && height != 0)) { - Rows = height; - Columns = width; - check_shellsize(); - mch_set_shellsize(); - } else - check_shellsize(); - - /* The window layout used to be adjusted here, but it now happens in - * screenalloc() (also invoked from screenclear()). That is because the - * "busy" check above may skip this, but not screenalloc(). */ - - if (State != ASKMORE && State != EXTERNCMD && State != CONFIRM) - screenclear(); - else - screen_start(); /* don't know where cursor is now */ - - if (starting != NO_SCREEN) { - maketitle(); - changed_line_abv_curs(); - invalidate_botline(); - - /* - * We only redraw when it's needed: - * - While at the more prompt or executing an external command, don't - * redraw, but position the cursor. - * - While editing the command line, only redraw that. - * - in Ex mode, don't redraw anything. - * - Otherwise, redraw right now, and position the cursor. - * Always need to call update_screen() or screenalloc(), to make - * sure Rows/Columns and the size of ScreenLines[] is correct! - */ - if (State == ASKMORE || State == EXTERNCMD || State == CONFIRM - || exmode_active) { - screenalloc(false); - repeat_message(); - } else { - if (curwin->w_p_scb) - do_check_scrollbind(TRUE); - if (State & CMDLINE) { - update_screen(NOT_VALID); - redrawcmdline(); - } else { - update_topline(); - if (pum_visible()) { - redraw_later(NOT_VALID); - ins_compl_show_pum(); /* This includes the redraw. */ - } else - update_screen(NOT_VALID); - if (redrawing()) - setcursor(); - } - } - cursor_on(); /* redrawing may have switched it off */ - } - out_flush(); - --busy; -} - -/* * Set the terminal to TMODE_RAW (for Normal mode) or TMODE_COOK (for external * commands and Ex mode). */ @@ -2593,73 +2525,6 @@ int swapping_screen(void) } /* - * setmouse() - switch mouse on/off depending on current mode and 'mouse' - */ -void setmouse(void) -{ - int checkfor; - - - /* be quick when mouse is off */ - if (*p_mouse == NUL || has_mouse_termcode == 0) - return; - - /* don't switch mouse on when not in raw mode (Ex mode) */ - if (cur_tmode != TMODE_RAW) { - mch_setmouse(FALSE); - return; - } - - if (VIsual_active) - checkfor = MOUSE_VISUAL; - else if (State == HITRETURN || State == ASKMORE || State == SETWSIZE) - checkfor = MOUSE_RETURN; - else if (State & INSERT) - checkfor = MOUSE_INSERT; - else if (State & CMDLINE) - checkfor = MOUSE_COMMAND; - else if (State == CONFIRM || State == EXTERNCMD) - checkfor = ' '; /* don't use mouse for ":confirm" or ":!cmd" */ - else - checkfor = MOUSE_NORMAL; /* assume normal mode */ - - if (mouse_has(checkfor)) - mch_setmouse(TRUE); - else - mch_setmouse(FALSE); -} - -/* - * Return TRUE if - * - "c" is in 'mouse', or - * - 'a' is in 'mouse' and "c" is in MOUSE_A, or - * - the current buffer is a help file and 'h' is in 'mouse' and we are in a - * normal editing mode (not at hit-return message). - */ -int mouse_has(int c) -{ - for (char_u *p = p_mouse; *p; ++p) - switch (*p) { - case 'a': if (vim_strchr((char_u *)MOUSE_A, c) != NULL) - return TRUE; - break; - case MOUSE_HELP: if (c != MOUSE_RETURN && curbuf->b_help) - return TRUE; - break; - default: if (c == *p) return TRUE; break; - } - return FALSE; -} - -/* - * Return TRUE when 'mousemodel' is set to "popup" or "popup_setpos". - */ -int mouse_model_popup(void) -{ - return p_mousem[0] == 'p'; -} - -/* * By outputting the 'cursor very visible' termcap code, for some windowed * terminals this makes the screen scrolled to the correct position. * Used when starting Vim or returning from a shell. @@ -2954,11 +2819,9 @@ static void switch_to_8bit(void) LOG_TR("Switching to 8 bit"); } -#ifdef CHECK_DOUBLE_CLICK static linenr_T orig_topline = 0; static int orig_topfill = 0; -#endif -#if defined(CHECK_DOUBLE_CLICK) || defined(PROTO) + /* * Checking for double clicks ourselves. * "orig_topline" is used to avoid detecting a double-click when the window @@ -2973,7 +2836,6 @@ void set_mouse_topline(win_T *wp) orig_topline = wp->w_topline; orig_topfill = wp->w_topfill; } -#endif /* * Check if typebuf.tb_buf[] contains a terminal key code. @@ -3664,7 +3526,6 @@ int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen) is_drag = TRUE; current_button = held_button; } else if (wheel_code == 0) { -# ifdef CHECK_DOUBLE_CLICK { static int orig_mouse_col = 0; static int orig_mouse_row = 0; @@ -3698,9 +3559,6 @@ int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen) orig_topline = curwin->w_topline; orig_topfill = curwin->w_topfill; } -# else - orig_num_clicks = NUM_MOUSE_CLICKS(mouse_code); -# endif is_click = TRUE; orig_mouse_code = mouse_code; } diff --git a/src/nvim/term.h b/src/nvim/term.h index 17154b8c26..3f70f484a7 100644 --- a/src/nvim/term.h +++ b/src/nvim/term.h @@ -52,10 +52,6 @@ * 128 = 16384 columns, now it's reduced to 10000. */ #define MOUSE_COLOFF 10000 -#if defined(UNIX) -# define CHECK_DOUBLE_CLICK 1 /* Checking for double clicks ourselves. */ -#endif - #ifdef INCLUDE_GENERATED_DECLARATIONS # include "term.h.generated.h" #endif diff --git a/src/nvim/ui.c b/src/nvim/ui.c index 526cc3e47e..eab6251288 100644 --- a/src/nvim/ui.c +++ b/src/nvim/ui.c @@ -55,7 +55,7 @@ void ui_write(char_u *s, int len) s = tofree; } - mch_write(s, len); + term_write(s, len); if (output_conv.vc_type != CONV_NONE) free(tofree); diff --git a/src/nvim/window.c b/src/nvim/window.c index 315d5f07de..bd461a873f 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -41,6 +41,7 @@ #include "nvim/file_search.h" #include "nvim/garray.h" #include "nvim/move.h" +#include "nvim/mouse.h" #include "nvim/normal.h" #include "nvim/option.h" #include "nvim/os_unix.h" diff --git a/test/functional/shell/viml_system_spec.lua b/test/functional/shell/viml_system_spec.lua index 8d212c1375..48dc518d7b 100644 --- a/test/functional/shell/viml_system_spec.lua +++ b/test/functional/shell/viml_system_spec.lua @@ -188,6 +188,28 @@ describe('systemlist()', function() end) end) + describe('handles empty lines', function() + it('in the middle', function() + eq({'line one','','line two'}, eval("systemlist('cat',['line one','','line two'])")) + end) + + it('in the beginning', function() + eq({'','line one','line two'}, eval("systemlist('cat',['','line one','line two'])")) + end) + end) + + describe('when keepempty option is', function() + it('0, ignores trailing newline', function() + eq({'aa','bb'}, eval("systemlist('cat',['aa','bb'],0)")) + eq({'aa','bb'}, eval("systemlist('cat',['aa','bb',''],0)")) + end) + + it('1, preserves trailing newline', function() + eq({'aa','bb'}, eval("systemlist('cat',['aa','bb'],1)")) + eq({'aa','bb',''}, eval("systemlist('cat',['aa','bb',''],2)")) + end) + end) + if xclip then describe("with a program that doesn't close stdout", function() it('will exit properly after passing input', function() diff --git a/test/unit/helpers.lua b/test/unit/helpers.lua index 544a53fa10..1b97a2f15a 100644 --- a/test/unit/helpers.lua +++ b/test/unit/helpers.lua @@ -139,26 +139,10 @@ local function vim_init() if vim_init_called ~= nil then return end - -- import os_unix.h for mch_early_init(), which initializes some globals - local all = cimport('./src/nvim/os_unix.h', - './src/nvim/misc1.h', - './src/nvim/eval.h', - './src/nvim/os_unix.h', - './src/nvim/option.h', - './src/nvim/ex_cmds2.h', - './src/nvim/window.h', - './src/nvim/ops.h', - './src/nvim/normal.h', - './src/nvim/mbyte.h') - all.mch_early_init() - all.mb_init() - all.eval_init() - all.init_normal_cmds() - all.win_alloc_first() - all.init_yank() - all.init_homedir() - all.set_init_1() - all.set_lang_var() + local main = cimport('./src/nvim/main.h') + local time = cimport('./src/nvim/os/time.h') + time.time_init() + main.early_init() vim_init_called = true end diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt index 177c32ced9..7d86382d34 100644 --- a/third-party/CMakeLists.txt +++ b/third-party/CMakeLists.txt @@ -15,6 +15,9 @@ set(DEPS_DOWNLOAD_DIR "${DEPS_BUILD_DIR}/downloads") option(USE_BUNDLED "Use bundled dependencies." ON) +option(USE_BUNDLED_LIBUNIBILIUM "Use the bundled libunibilium." ${USE_BUNDLED}) +option(USE_BUNDLED_LIBTERMKEY "Use the bundled libtermkey." ${USE_BUNDLED}) +option(USE_BUNDLED_LIBTICKIT "Use the bundled libtickit." ${USE_BUNDLED}) option(USE_BUNDLED_LIBUV "Use the bundled libuv." ${USE_BUNDLED}) option(USE_BUNDLED_MSGPACK "Use the bundled msgpack." ${USE_BUNDLED}) option(USE_BUNDLED_LUAJIT "Use the bundled version of luajit." ${USE_BUNDLED}) @@ -67,6 +70,90 @@ set(LUAROCKS_URL https://github.com/keplerproject/luarocks/archive/0587afbb5fe8c set(LUAROCKS_SHA1 61a894fd5d61987bf7e7f9c3e0c5de16ba4b68c4) set(LUAROCKS_MD5 0f53f42909fbcd2c88be303e8f970516) +set(LIBUNIBILIUM_URL https://github.com/neovim/unibilium/archive/neovim.tar.gz) +set(LIBUNIBILIUM_SHA1 5d3d4913dd267b14f81fc665e0fa20661d3cb817) +set(LIBUNIBILIUM_MD5 0657a906164529f1e0f60aba3b876f23) + +set(LIBTERMKEY_URL https://github.com/neovim/libtermkey/archive/neovim.tar.gz) +set(LIBTERMKEY_SHA1 a309038a2297fe4905f03a8807723a9aa07c272a) +set(LIBTERMKEY_MD5 c99e5546da0063fa26dfa7d7f1d5a26f) + +set(LIBTICKIT_URL https://github.com/neovim/libtickit/archive/neovim.tar.gz) +set(LIBTICKIT_SHA1 49e609de29c3bdc3b40d2ade76e69fde6e0d74bc) +set(LIBTICKIT_MD5 71a5d36d0ef6688d79828aabaf27eb36) + +if(USE_BUNDLED_LIBUNIBILIUM) + ExternalProject_Add(libunibilium + PREFIX ${DEPS_BUILD_DIR} + URL ${LIBUNIBILIUM_URL} + DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/libunibilium + DOWNLOAD_COMMAND ${CMAKE_COMMAND} + -DPREFIX=${DEPS_BUILD_DIR} + -DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/libunibilium + -DURL=${LIBUNIBILIUM_URL} + -DEXPECTED_SHA1=${LIBUNIBILIUM_SHA1} + -DEXPECTED_MD5=${LIBUNIBILIUM_MD5} + -DTARGET=libunibilium + -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake + CONFIGURE_COMMAND "" + BUILD_IN_SOURCE 1 + BUILD_COMMAND ${MAKE_PRG} CC=${DEPS_C_COMPILER} + PREFIX=${DEPS_INSTALL_DIR} + CFLAGS=-fPIC + INSTALL_COMMAND ${MAKE_PRG} PREFIX=${DEPS_INSTALL_DIR} install) + list(APPEND THIRD_PARTY_DEPS libunibilium) +endif() + +if(USE_BUNDLED_LIBTERMKEY) + ExternalProject_Add(libtermkey + PREFIX ${DEPS_BUILD_DIR} + URL ${LIBTERMKEY_URL} + DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/libtermkey + DOWNLOAD_COMMAND ${CMAKE_COMMAND} + -DPREFIX=${DEPS_BUILD_DIR} + -DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/libtermkey + -DURL=${LIBTERMKEY_URL} + -DEXPECTED_SHA1=${LIBTERMKEY_SHA1} + -DEXPECTED_MD5=${LIBTERMKEY_MD5} + -DTARGET=libtermkey + -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake + CONFIGURE_COMMAND "" + BUILD_IN_SOURCE 1 + BUILD_COMMAND "" + INSTALL_COMMAND ${MAKE_PRG} CC=${DEPS_C_COMPILER} + PREFIX=${DEPS_INSTALL_DIR} + PKG_CONFIG_PATH=${DEPS_LIB_DIR}/pkgconfig + CFLAGS=-fPIC + install) + list(APPEND THIRD_PARTY_DEPS libtermkey) + add_dependencies(libtermkey libunibilium) +endif() + +if(USE_BUNDLED_LIBTICKIT) + ExternalProject_Add(libtickit + PREFIX ${DEPS_BUILD_DIR} + URL ${LIBTICKIT_URL} + DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/libtickit + DOWNLOAD_COMMAND ${CMAKE_COMMAND} + -DPREFIX=${DEPS_BUILD_DIR} + -DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/libtickit + -DURL=${LIBTICKIT_URL} + -DEXPECTED_SHA1=${LIBTICKIT_SHA1} + -DEXPECTED_MD5=${LIBTICKIT_MD5} + -DTARGET=libtickit + -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake + CONFIGURE_COMMAND "" + BUILD_IN_SOURCE 1 + BUILD_COMMAND "" + INSTALL_COMMAND ${MAKE_PRG} CC=${DEPS_C_COMPILER} + PREFIX=${DEPS_INSTALL_DIR} + PKG_CONFIG_PATH=${DEPS_LIB_DIR}/pkgconfig + CFLAGS=-fPIC + install) + list(APPEND THIRD_PARTY_DEPS libtickit) + add_dependencies(libtickit libtermkey) +endif() + if(USE_BUNDLED_LIBUV) ExternalProject_Add(libuv PREFIX ${DEPS_BUILD_DIR} |