Compare commits

...

16 Commits

Author SHA1 Message Date
9e58787de7 patch 8.1.1330: using bold attribute in terminal changes the color
Problem:    Using bold attribute in terminal changes the color. (Jason
            Franklin)
Solution:   Don't set the "bold-highbright" flag in vterm unless the terminal
            supports less than 16 colors.
2019-05-13 20:27:23 +02:00
957f85d54e patch 8.1.1329: plans for popup window support are spread out
Problem:    Plans for popup window support are spread out.
Solution:   Add a first version of the popup window help.
2019-05-12 21:43:48 +02:00
bc4fd43160 patch 8.1.1328: no test for listener with undo operation
Problem:    No test for listener with undo operation.
Solution:   Add a test.
2019-05-12 14:36:27 +02:00
a9b2535f44 patch 8.1.1327: unnecessary scroll after horizontal split
Problem:    Unnecessary scroll after horizontal split.
Solution:   Don't adjust to fraction if all the text fits in the window.
            (Martin Kunev, closes #4367)
2019-05-12 14:25:30 +02:00
8aad88d8de patch 8.1.1326: no test for listener with partial
Problem:    No test for listener with partial.
Solution:   Add a test.  Add example to help.
2019-05-12 13:53:50 +02:00
97b0075b0d patch 8.1.1325: cannot build with +eval but without +channel and +timers
Problem:    Cannot build with +eval but without +channel and +timers. (John
            Marriott)
Solution:   Adjust #ifdef for get_callback().
2019-05-12 13:07:14 +02:00
b73fbc76c6 patch 8.1.1324: stray comma in VMS makefile
Problem:    Stray comma in VMS makefile.
Solution:   Remove the comma. (Naruhiko Nishino, closes #4368)
2019-05-11 21:50:07 +02:00
5d0183b706 patch 8.1.1323: 'mouse' option is reset when using GPM mouse
Problem:    'mouse' option is reset when using GPM mouse.
Solution:   Add flag for GPM mouse.
2019-05-11 21:38:58 +02:00
6e75e0a400 patch 8.1.1322: Cygwin makefile is not nicely indented
Problem:    Cygwin makefile is not nicely indented.
Solution:   Addjust spaces in preprocessor directives. (Ken Takata)
2019-05-11 21:24:26 +02:00
a334772967 patch 8.1.1321: no docs or tests for listener functions
Problem:    No docs or tests for listener functions.
Solution:   Add help and tests for listener_add() and listener_remove().
            Invoke the callbacks before redrawing.
2019-05-11 21:14:24 +02:00
6d2399bd10 patch 8.1.1320: it is not possible to track changes to a buffer
Problem:    It is not possible to track changes to a buffer.
Solution:   Add listener_add() and listener_remove(). No docs or tests yet.
2019-05-11 19:14:16 +02:00
6ed8819822 patch 8.1.1319: computing function length name in many places
Problem:    Computing function length name in many places.
Solution:   compute name length in call_func().
2019-05-11 18:37:44 +02:00
ec28d1516e patch 8.1.1318: code for text changes is in a "misc" file
Problem:    Code for text changes is in a "misc" file.
Solution:   Move the code to change.c.
2019-05-11 18:36:34 +02:00
3f86ca0faa Add missing files from patch 8.1.1318 2019-05-11 18:30:00 +02:00
dc9f9e93f5 patch 8.1.1317: output from Travis can be improved
Problem:    Output from Travis can be improved.
Solution:   Add section headers.  Handle errors better. (closes #4098)
2019-05-11 14:34:13 +02:00
d6896731ec patch 8.1.1316: duplicated localtime() call
Problem:    Duplicated localtime() call.
Solution:   Delete one.
2019-05-11 13:09:42 +02:00
43 changed files with 3234 additions and 2590 deletions

View File

@ -130,6 +130,8 @@ before_script:
script:
- NPROC=$(getconf _NPROCESSORS_ONLN)
- set -o errexit
- echo -e "\\033[33;1mConfiguring Vim\\033[0m" && echo -en "travis_fold:start:configure\\r\\033[0K"
- |
if [[ "${CHECK_AUTOCONF}" = "yes" ]] && [[ "${CC}" = "gcc" ]]; then
make -C src autoconf
@ -138,13 +140,17 @@ script:
if [[ -n "${SHADOWOPT}" ]]; then
make -C src shadow
fi
# "./configure" changes its working directory into "$SRCDIR".
- ./configure --with-features=${FEATURES} ${CONFOPT} --enable-fail-if-missing
- echo -en "travis_fold:end:configure\\r\\033[0K"
- echo -e "\\033[33;1mBuilding Vim\\033[0m" && echo -en "travis_fold:start:build\\r\\033[0K"
- |
(
cd "${SRCDIR}" \
&& ./configure --with-features=${FEATURES} ${CONFOPT} --enable-fail-if-missing
) && if [[ "${BUILD}" = "yes" ]]; then
if [[ "${BUILD}" = "yes" ]]; then
make ${SHADOWOPT} -j${NPROC}
fi
- echo -en "travis_fold:end:build\\r\\033[0K"
- set +o errexit
- echo -e "\\033[33;1mTesting Vim\\033[0m" && echo -en "travis_fold:start:test\\r\\033[0K"
# Show Vim version and also if_xx versions.
- |
if [[ "${BUILD}" = "yes" ]]; then
@ -154,12 +160,13 @@ script:
cat if_ver.txt
fi
- make ${SHADOWOPT} ${TEST}
- echo -en "travis_fold:end:test\\r\\033[0K"
- |
if [[ -n "${ASAN_OPTIONS}" ]]; then
while read log; do
asan_symbolize < "${log}"
false # exit 1 if there are ASAN logs
done < <(find . -type f -name 'asan.*' -size +0)
[[ -z "${log}" ]] # exit 1 if there are ASAN logs
fi
after_success:

View File

@ -20,6 +20,7 @@ SRC_ALL = \
src/blob.c \
src/blowfish.c \
src/buffer.c \
src/change.c \
src/channel.c \
src/charset.c \
src/crypt.c \
@ -155,6 +156,7 @@ SRC_ALL = \
src/proto/blob.pro \
src/proto/blowfish.pro \
src/proto/buffer.pro \
src/proto/change.pro \
src/proto/channel.pro \
src/proto/charset.pro \
src/proto/crypt.pro \

2
configure vendored
View File

@ -3,4 +3,4 @@
# This is just a stub for the Unix configure script, to provide support for
# doing "./configure" in the top Vim directory.
cd src && exec ./configure "$@"
cd "${SRCDIR:-src}" && exec ./configure "$@"

View File

@ -83,6 +83,7 @@ DOCS = \
pi_tar.txt \
pi_vimball.txt \
pi_zip.txt \
popup.txt \
print.txt \
quickfix.txt \
quickref.txt \
@ -220,6 +221,7 @@ HTMLS = \
pi_tar.html \
pi_vimball.html \
pi_zip.html \
popup.html \
print.html \
quickfix.html \
quickref.html \

View File

@ -2457,6 +2457,9 @@ line({expr}) Number line nr of cursor, last line or mark
line2byte({lnum}) Number byte count of line {lnum}
lispindent({lnum}) Number Lisp indent for line {lnum}
list2str({list} [, {utf8}]) String turn numbers in {list} into a String
listener_add({callback} [, {buf}])
Number add a callback to listen to changes
listener_remove({id}) none remove a listener callback
localtime() Number current time
log({expr}) Float natural logarithm (base e) of {expr}
log10({expr}) Float logarithm of Float {expr} to base 10
@ -6311,6 +6314,68 @@ list2str({list} [, {utf8}]) *list2str()*
With utf-8 composing characters work as expected: >
list2str([97, 769]) returns "á"
<
listener_add({callback} [, {buf}]) *listener_add()*
Add a callback function that will be invoked when changes have
been made to buffer {buf}.
{buf} refers to a buffer name or number. For the accepted
values, see |bufname()|. When {buf} is omitted the current
buffer is used.
Returns a unique ID that can be passed to |listener_remove()|.
The {callback} is invoked with a list of items that indicate a
change. The list cannot be changed. Each list item is a
dictionary with these entries:
lnum the first line number of the change
end the first line below the change
added number of lines added; negative if lines were
deleted
col first column in "lnum" that was affected by
the change; one if unknown or the whole line
was affected; this is a byte index, first
character has a value of one.
When lines are inserted the values are:
lnum line below which the new line is added
end equal to "lnum"
added number of lines inserted
col one
When lines are deleted the values are:
lnum the first deleted line
end the line below the first deleted line, before
the deletion was done
added negative, number of lines deleted
col one
When lines are changed:
lnum the first changed line
end the line below the last changed line
added zero
col first column with a change or one
The entries are in the order the changes was made, thus the
most recent change is at the end. One has to go through the
list from end to start to compute the line numbers in the
current state of the text.
When using the same function for multiple buffers, you can
pass the buffer to that function using a |Partial|.
Example: >
func Listener(bufnr, changes)
" ...
endfunc
let bufnr = ...
call listener_add(function('Listener', [bufnr]), bufnr)
< The {callback} is invoked just before the screen is updated.
To trigger this in a script use the `:redraw` command.
The {callback} is not invoked when the buffer is first loaded.
Use the |BufReadPost| autocmd event to handle the initial text
of a buffer.
The {callback} is also not invoked when the buffer is
unloaded, use the |BufUnload| autocmd event for that.
listener_remove({id}) *listener_remove()*
Remove a listener previously added with listener_add().
localtime() *localtime()*
Return the current time, measured as seconds since 1st Jan
1970. See also |strftime()| and |getftime()|.
@ -10934,10 +10999,10 @@ expressions |expr-lambda|.
Example: >
function Something(key, value = 10)
echo a:key .. ": " .. value
echo a:key .. ": " .. a:value
endfunction
call Something('empty') "empty: 10"
call Something('key, 20) "key: 20"
call Something('key', 20) "key: 20"
The argument default expressions are evaluated at the time of the function
call, not definition. Thus it is possible to use an expression which is

View File

@ -143,6 +143,7 @@ Special issues ~
|remote.txt| using Vim as a server or client
|term.txt| using different terminals and mice
|terminal.txt| Terminal window support
|popup.txt| popop window support
Programming language support ~
|indent.txt| automatic indenting for C and other languages

274
runtime/doc/popup.txt Normal file
View File

@ -0,0 +1,274 @@
*popup.txt* For Vim version 8.1. Last change: 2019 May 12
VIM REFERENCE MANUAL by Bram Moolenaar
Displaying text with properties attached. *popup* *popup-window*
THIS IS UNDER DESIGN - ANYTHING MAY STILL CHANGE
1. Introduction |popup-intro|
2. Functions |popup-functions|
3. Examples |popup-examples|
{not able to use text properties when the |+textprop| feature was
disabled at compile time}
==============================================================================
1. Introduction *popup-intro*
We are talking about popup windows here, text that goes on top of the buffer
text and is under control of a plugin. Other popup functionality:
- popup menu, see |popup-menu|
- balloon, see |balloon-eval|
TODO
==============================================================================
2. Functions *popup-functions*
THIS IS UNDER DESIGN - ANYTHING MAY STILL CHANGE
Proposal and discussion on issue #4063: https://github.com/vim/vim/issues/4063
[to be moved to eval.txt later]
popup_show({lines}, {options}) *popup_show()*
Open a popup window showing {lines}, which is a list of lines,
where each line has text and text properties.
{options} is a dictionary with many possible entries.
Returns a unique ID to be used with |popup_close()|.
See |popup_show-usage| for details.
popup_dialog({lines}, {options}) *popup_dialog()*
Just like |popup_show()| but with different default options:
pos "center"
zindex 200
border []
popup_notification({text}, {options}) *popup_notification()*
Show the string {text} for 3 seconds at the top of the Vim
window. This works like: >
call popup_show([{'text': {text}}], {
\ 'line': 1,
\ 'col': 10,
\ 'time': 3000,
\ 'zindex': 200,
\ 'highlight': 'WarningMsg',
\ 'border: [],
\ })
< Use {options} to change the properties.
popup_atcursor({text}, {options}) *popup_atcursor()*
Show the string {text} above the cursor, and close it when the
cursor moves. This works like: >
call popup_show([{'text': {text}}], {
\ 'line': 'cursor-1',
\ 'col': 'cursor',
\ 'zindex': 50,
\ 'moved': 'WORD',
\ })
< Use {options} to change the properties.
popup_menu({lines}, {options}) *popup_atcursor()*
Show the {lines} near the cursor, handle selecting one of the
items with cursorkeys, and close it an item is selected with
Space or Enter. This works like: >
call popup_show({lines}, {
\ 'pos': 'center',
\ 'zindex': 200,
\ 'wrap': 0,
\ 'border': [],
\ 'filter': 'popup_filter_menu',
\ })
< Use {options} to change the properties. Should at least set
"callback" to a function that handles the selected item.
popup_move({id}, {options}) *popup_move()*
Move popup {id} to the position speficied with {options}.
{options} may contain the items from |popup_show()| that
specify the popup position: "line", "col", "pos", "maxheight",
"minheight", "maxwidth" and "minwidth".
popup_filter_menu({id}, {key}) *popup_filter_menu()*
Filter that can be used for a popup. It handles the cursor
keys to move the selected index in the popup. Space and Enter
can be used to select an item. Invokes the "callback" of the
popup menu with the index of the selected line as the second
argument.
popup_filter_yesno({id}, {key}) *popup_filter_yesno()*
Filter that can be used for a popup. It handles only the keys
'y', 'Y' and 'n' or 'N'. Invokes the "callback" of the
popup menu with the 1 for 'y' or 'Y' and zero for 'n' or 'N'
as the second argument. Pressing Esc and CTRL-C works like
pressing 'n'.
popup_setlines({id}, {lnum}, {lines}) *popup_setlines()*
In popup {id} set line {lnum} and following to {lines}.
{lnum} is one-based and must be either an existing line or
just one below the last line, in which case the line gets
appended.
{lines} has the same format as one item in {lines} of
|popup_show()|. Existing lines are replaced. When {lines}
extends below the last line of the popup lines are appended.
popup_getlines({id}) *popup_getlines()*
Return the {lines} for popup {id}.
popup_setoptions({id}, {options}) *popup_setoptions()*
Override options in popup {id} with entries in {options}.
popup_getoptions({id}) *popup_getoptions()*
Return the {options} for popup {id}.
popup_close({id}) *popup_close()*
Close popup {id}.
POPUP_SHOW() ARGUMENTS *popup_show-usage*
The first argument of |popup_show()| is a list of text lines. Each item in
the list is a dictionary with these entries:
text The text to display.
props A list of text properties. Optional.
Each entry is a dictionary, like the third argument of
|prop_add()|, but specifying the column in the
dictionary with a "col" entry, see below:
|popup-props|.
The second argument of |popup_show()| is a dictionary with options:
line screen line where to position the popup; can use
"cursor", "cursor+1" or "cursor-1" to use the line of
the cursor and add or subtract a number of lines;
default is "cursor-1".
col screen column where to position the popup; can use
"cursor" to use the column of the cursor, "cursor+99"
and "cursor-99" to add or subtract a number of
columns; default is "cursor"
pos "topleft", "topright", "botleft" or "botright":
defines what corner of the popup "line" and "col" are
used for. Default is "botleft". Alternatively
"center" can be used to position the popup somewhere
near the cursor.
maxheight maximum height
minheight minimum height
maxwidth maximum width
minwidth minimum width
title text to be displayed above the first item in the
popup, on top of any border
wrap TRUE to make the lines wrap (default TRUE)
highlight highlight group name to use for the text, defines the
background and foreground color
border list with numbers, defining the border thickness
above/right/below/left of the popup; an empty list
uses a border of 1 all around
borderhighlight highlight group name to use for the border
borderchars list with characters, defining the character to use
for the top/right/bottom/left border; optionally
followed by the character to use for the
topright/botright/botleft/topleft corner; an empty
list can be used to show a double line all around
zindex priority for the popup, default 50
time time in milliseconds after which the popup will close;
when omitted |popup_close()| must be used.
moved "cell": close the popup if the cursor moved at least
one screen cell; "word" allows for moving within
|<cword>|, "WORD" allows for moving within |<cWORD>|,
a list with two numbers specifies the start and end
column
filter a callback that can filter typed characters, see
|popup-filter|
callback a callback to be used when the popup closes, e.g. when
using |popup_filter_menu()|, see |popup-callback|.
Depending on the "zindex" the popup goes under or above other popups. The
completion menu (|popup-menu|) has zindex 100. For messages that occur for a
short time the suggestion is to use zindex 1000.
By default text wraps, which causes a line in {lines} to occupy more than one
screen line. When "wrap" is FALSE then the text outside of the popup or
outside of the Vim window will not be displayed, thus truncated.
POPUP TEXT PROPERTIES *popup-props*
These are similar to the third argument of |prop_add()|, but not exactly the
same, since they only apply to one line.
col starting column, counted in bytes, use one for the
first column.
length length of text in bytes; can be zero
end_col column just after the text; not used when "length" is
present; when {col} and "end_col" are equal, this is a
zero-width text property
id user defined ID for the property; when omitted zero is
used
type name of the text property type, as added with
|prop_type_add()|
transparent do not show these characters, show the text under it;
if there is an border character to the right or below
it will be made transparent as well
POPUP FILTER *popup-filter*
A callback that gets any typed keys while a popup is displayed. It can return
TRUE to indicate the key has been handled and is to be discarded, or FALSE to
let Vim handle the key as usual in the current state.
The filter function is called with two arguments: the ID of the popup and the
key.
Some common key actions:
Esc close the popup
cursor keys select another entry
Tab accept current suggestion
Vim provides standard filters |popup_filter_menu()| and
|popup_filter_yesno()|.
POPUP CALLBACK *popup-callback*
A callback that is invoked when the popup closes. Used by
|popup_filter_menu()|. Invoked with two arguments: the ID of the popup and
the result, which would usually be an index in the popup lines, or whatever
the filter wants to pass.
==============================================================================
3. Examples *popup-examples*
TODO
Prompt the user to press y/Y or n/N: >
func MyDialogHandler(id, result)
if a:result
" ... 'y' or 'Y' was pressed
endif
endfunc
call popup_show([{'text': 'Continue? y/n'}], {
\ 'filter': 'popup_filter_yesno',
\ 'callback': 'MyDialogHandler',
\ })
<
vim:tw=78:ts=8:noet:ft=help:norl:

View File

@ -812,6 +812,8 @@ Buffers, windows and the argument list:
setbufline() replace a line in the specified buffer
appendbufline() append a list of lines in the specified buffer
deletebufline() delete lines from a specified buffer
listener_add() add a callback to listen to changes
listener_remove() remove a listener callback
win_findbuf() find windows containing a buffer
win_getid() get window ID of a window
win_gotoid() go to window with ID

View File

@ -163,17 +163,17 @@ INTLLIB=gnu_gettext
# Command definitions (depends on cross-compiling and shell)
ifeq ($(CROSS),yes)
# cross-compiler prefix:
ifndef CROSS_COMPILE
ifndef CROSS_COMPILE
CROSS_COMPILE = i586-pc-mingw32msvc-
endif
endif
DEL = rm
MKDIR = mkdir -p
DIRSLASH = /
else
# normal (Windows) compilation:
ifndef CROSS_COMPILE
ifndef CROSS_COMPILE
CROSS_COMPILE =
endif
endif
# About the "sh.exe" condition, as explained by Ken Takata:
#
@ -193,15 +193,15 @@ endif
# $SHELL is set with the unix-style path (e.g. "/bin/bash").
# In this case, unix-like commands can be used.
#
ifneq (sh.exe, $(SHELL))
ifneq (sh.exe, $(SHELL))
DEL = rm
MKDIR = mkdir -p
DIRSLASH = /
else
else
DEL = del
MKDIR = mkdir
DIRSLASH = \\
endif
endif
endif
CC := $(CROSS_COMPILE)gcc
CXX := $(CROSS_COMPILE)g++
@ -223,31 +223,31 @@ endif
# DYNAMIC_PERL=yes (to load the Perl DLL dynamically)
# PERL_VER=[Perl version, eg 56, 58, 510] (default is 524)
ifdef PERL
ifndef PERL_VER
ifndef PERL_VER
PERL_VER=524
endif
ifndef DYNAMIC_PERL
endif
ifndef DYNAMIC_PERL
DYNAMIC_PERL=yes
endif
endif
# on Linux, for cross-compile, it's here:
#PERLLIB=/home/ron/ActivePerl/lib
# on NT, it's here:
PERLEXE=$(PERL)/bin/perl
PERLLIB=$(PERL)/lib
PERLLIBS=$(PERLLIB)/Core
ifeq ($(UNDER_CYGWIN),yes)
ifeq ($(UNDER_CYGWIN),yes)
PERLTYPEMAP:=$(shell cygpath -m $(PERLLIB)/ExtUtils/typemap)
XSUBPPTRY:=$(shell cygpath -m $(PERLLIB)/ExtUtils/xsubpp)
else
else
PERLTYPEMAP=$(PERLLIB)/ExtUtils/typemap
XSUBPPTRY=$(PERLLIB)/ExtUtils/xsubpp
endif
endif
XSUBPP_EXISTS=$(shell $(PERLEXE) -e "print 1 unless -e '$(XSUBPPTRY)'")
ifeq "$(XSUBPP_EXISTS)" ""
ifeq "$(XSUBPP_EXISTS)" ""
XSUBPP=$(PERLEXE) $(XSUBPPTRY)
else
else
XSUBPP=xsubpp
endif
endif
endif
# Lua interface:
@ -257,18 +257,18 @@ endif
# DYNAMIC_LUA=yes (to load the Lua DLL dynamically)
# LUA_VER=[Lua version, eg 51, 52] (default is 53)
ifdef LUA
ifndef DYNAMIC_LUA
ifndef DYNAMIC_LUA
DYNAMIC_LUA=yes
endif
endif
ifndef LUA_VER
ifndef LUA_VER
LUA_VER=53
endif
endif
ifeq (no,$(DYNAMIC_LUA))
ifeq (no,$(DYNAMIC_LUA))
LUA_LIBDIR = $(LUA)/lib
LUA_LIB = -L$(LUA_LIBDIR) -llua
endif
endif
endif
@ -280,53 +280,53 @@ endif
# C:\Program Files (x86)\Racket\lib\libracket3m_XXXXXX.dll
# MZSCHEME_DEBUG=no
ifdef MZSCHEME
ifndef DYNAMIC_MZSCHEME
ifndef DYNAMIC_MZSCHEME
DYNAMIC_MZSCHEME=yes
endif
endif
ifndef MZSCHEME_VER
ifndef MZSCHEME_VER
MZSCHEME_VER=3m_a0solc
endif
endif
# for version 4.x we need to generate byte-code for Scheme base
ifndef MZSCHEME_GENERATE_BASE
ifndef MZSCHEME_GENERATE_BASE
MZSCHEME_GENERATE_BASE=no
endif
endif
ifneq ($(wildcard $(MZSCHEME)/lib/msvc/libmzsch$(MZSCHEME_VER).lib),)
ifneq ($(wildcard $(MZSCHEME)/lib/msvc/libmzsch$(MZSCHEME_VER).lib),)
MZSCHEME_MAIN_LIB=mzsch
else
else
MZSCHEME_MAIN_LIB=racket
endif
endif
ifndef MZSCHEME_PRECISE_GC
ifndef MZSCHEME_PRECISE_GC
MZSCHEME_PRECISE_GC=no
ifneq ($(wildcard $(MZSCHEME)\lib\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll),)
ifeq ($(wildcard $(MZSCHEME)\lib\libmzgc$(MZSCHEME_VER).dll),)
ifneq ($(wildcard $(MZSCHEME)\lib\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll),)
ifeq ($(wildcard $(MZSCHEME)\lib\libmzgc$(MZSCHEME_VER).dll),)
MZSCHEME_PRECISE_GC=yes
endif
else
ifneq ($(wildcard $(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib),)
ifeq ($(wildcard $(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib),)
endif
else
ifneq ($(wildcard $(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib),)
ifeq ($(wildcard $(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib),)
MZSCHEME_PRECISE_GC=yes
endif
endif
endif
endif
endif
endif
endif
endif
ifeq (no,$(DYNAMIC_MZSCHEME))
ifeq (yes,$(MZSCHEME_PRECISE_GC))
ifeq (no,$(DYNAMIC_MZSCHEME))
ifeq (yes,$(MZSCHEME_PRECISE_GC))
MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER)
else
else
MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
endif
endif
# the modern MinGW can dynamically link to dlls directly.
# point MZSCHEME_DLLS to where you put libmzschXXXXXXX.dll and libgcXXXXXXX.dll
ifndef MZSCHEME_DLLS
ifndef MZSCHEME_DLLS
MZSCHEME_DLLS=$(MZSCHEME)
endif
endif
MZSCHEME_LIBDIR=-L$(MZSCHEME_DLLS) -L$(MZSCHEME_DLLS)\lib
endif
endif
endif
@ -335,32 +335,32 @@ endif
# DYNAMIC_PYTHON=yes (to load the Python DLL dynamically)
# PYTHON_VER=[Python version, eg 22, 23, ..., 27] (default is 27)
ifdef PYTHON
ifndef DYNAMIC_PYTHON
ifndef DYNAMIC_PYTHON
DYNAMIC_PYTHON=yes
endif
endif
ifndef PYTHON_VER
ifndef PYTHON_VER
PYTHON_VER=27
endif
ifndef DYNAMIC_PYTHON_DLL
endif
ifndef DYNAMIC_PYTHON_DLL
DYNAMIC_PYTHON_DLL=python$(PYTHON_VER).dll
endif
ifdef PYTHON_HOME
endif
ifdef PYTHON_HOME
PYTHON_HOME_DEF=-DPYTHON_HOME=\"$(PYTHON_HOME)\"
endif
endif
ifeq (no,$(DYNAMIC_PYTHON))
ifeq (no,$(DYNAMIC_PYTHON))
PYTHONLIB=-L$(PYTHON)/libs -lpython$(PYTHON_VER)
endif
endif
# my include files are in 'win32inc' on Linux, and 'include' in the standard
# NT distro (ActiveState)
ifndef PYTHONINC
ifeq ($(CROSS),no)
ifndef PYTHONINC
ifeq ($(CROSS),no)
PYTHONINC=-I $(PYTHON)/include
else
else
PYTHONINC=-I $(PYTHON)/win32inc
endif
endif
endif
endif
endif
# Python3 interface:
@ -368,31 +368,31 @@ endif
# DYNAMIC_PYTHON3=yes (to load the Python3 DLL dynamically)
# PYTHON3_VER=[Python3 version, eg 31, 32] (default is 36)
ifdef PYTHON3
ifndef DYNAMIC_PYTHON3
ifndef DYNAMIC_PYTHON3
DYNAMIC_PYTHON3=yes
endif
endif
ifndef PYTHON3_VER
ifndef PYTHON3_VER
PYTHON3_VER=36
endif
ifndef DYNAMIC_PYTHON3_DLL
endif
ifndef DYNAMIC_PYTHON3_DLL
DYNAMIC_PYTHON3_DLL=python$(PYTHON3_VER).dll
endif
ifdef PYTHON3_HOME
endif
ifdef PYTHON3_HOME
PYTHON3_HOME_DEF=-DPYTHON3_HOME=L\"$(PYTHON3_HOME)\"
endif
endif
ifeq (no,$(DYNAMIC_PYTHON3))
ifeq (no,$(DYNAMIC_PYTHON3))
PYTHON3LIB=-L$(PYTHON3)/libs -lpython$(PYTHON3_VER)
endif
endif
ifndef PYTHON3INC
ifeq ($(CROSS),no)
ifndef PYTHON3INC
ifeq ($(CROSS),no)
PYTHON3INC=-I $(PYTHON3)/include
else
else
PYTHON3INC=-I $(PYTHON3)/win32inc
endif
endif
endif
endif
endif
# TCL interface:
@ -403,18 +403,18 @@ endif
# You must set TCL_VER_LONG when you set TCL_VER.
# TCL_DLL=[TCL dll name, eg tcl86.dll] (default is tcl86.dll)
ifdef TCL
ifndef DYNAMIC_TCL
ifndef DYNAMIC_TCL
DYNAMIC_TCL=yes
endif
ifndef TCL_VER
endif
ifndef TCL_VER
TCL_VER = 86
endif
ifndef TCL_VER_LONG
endif
ifndef TCL_VER_LONG
TCL_VER_LONG = 8.6
endif
ifndef TCL_DLL
endif
ifndef TCL_DLL
TCL_DLL = tcl$(TCL_VER).dll
endif
endif
TCLINC += -I$(TCL)/include
endif
@ -430,67 +430,63 @@ endif
# RUBY_VER=19
# RUBY_API_VER_LONG=1.9.1 (not 1.9.3, because the API version is 1.9.1.)
ifdef RUBY
ifndef DYNAMIC_RUBY
ifndef DYNAMIC_RUBY
DYNAMIC_RUBY=yes
endif
endif
# Set default value
ifndef RUBY_VER
ifndef RUBY_VER
RUBY_VER = 22
endif
ifndef RUBY_VER_LONG
endif
ifndef RUBY_VER_LONG
RUBY_VER_LONG = 2.2.0
endif
ifndef RUBY_API_VER_LONG
endif
ifndef RUBY_API_VER_LONG
RUBY_API_VER_LONG = $(RUBY_VER_LONG)
endif
ifndef RUBY_API_VER
endif
ifndef RUBY_API_VER
RUBY_API_VER = $(subst .,,$(RUBY_API_VER_LONG))
endif
endif
ifndef RUBY_PLATFORM
ifeq ($(RUBY_VER), 16)
ifndef RUBY_PLATFORM
ifeq ($(RUBY_VER), 16)
RUBY_PLATFORM = i586-mswin32
else
ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/i386-mingw32),)
else ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/i386-mingw32),)
RUBY_PLATFORM = i386-mingw32
else
ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/x64-mingw32),)
else ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/x64-mingw32),)
RUBY_PLATFORM = x64-mingw32
else
else
RUBY_PLATFORM = i386-mswin32
endif
endif
endif
endif
endif
endif
ifndef RUBY_INSTALL_NAME
ifeq ($(RUBY_VER), 16)
ifndef RUBY_INSTALL_NAME
ifeq ($(RUBY_VER), 16)
RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_API_VER)
else
ifndef RUBY_MSVCRT_NAME
else
ifndef RUBY_MSVCRT_NAME
# Base name of msvcrXX.dll which is used by ruby's dll.
RUBY_MSVCRT_NAME = msvcrt
endif
ifeq ($(ARCH),x86-64)
endif
ifeq ($(ARCH),x86-64)
RUBY_INSTALL_NAME = x64-$(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
else
else
RUBY_INSTALL_NAME = $(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
endif
endif
endif
endif
endif
endif
ifeq (19, $(word 1,$(sort 19 $(RUBY_VER))))
ifeq (19, $(word 1,$(sort 19 $(RUBY_VER))))
RUBY_19_OR_LATER = 1
endif
endif
ifdef RUBY_19_OR_LATER
ifdef RUBY_19_OR_LATER
RUBYINC = -I $(RUBY)/include/ruby-$(RUBY_API_VER_LONG) -I $(RUBY)/include/ruby-$(RUBY_API_VER_LONG)/$(RUBY_PLATFORM)
else
else
RUBYINC = -I $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/$(RUBY_PLATFORM)
endif
ifeq (no, $(DYNAMIC_RUBY))
endif
ifeq (no, $(DYNAMIC_RUBY))
RUBYLIB = -L$(RUBY)/lib -l$(RUBY_INSTALL_NAME)
endif
endif
endif # RUBY
@ -515,89 +511,87 @@ ifdef GETTEXT
DEFINES += -DHAVE_GETTEXT -DHAVE_LOCALE_H
GETTEXTINCLUDE = $(GETTEXT)/include
GETTEXTLIB = $(INTLPATH)
ifeq (yes, $(GETTEXT))
ifeq (yes, $(GETTEXT))
DEFINES += -DDYNAMIC_GETTEXT
else
ifdef DYNAMIC_GETTEXT
else ifdef DYNAMIC_GETTEXT
DEFINES += -D$(DYNAMIC_GETTEXT)
ifdef GETTEXT_DYNAMIC
ifdef GETTEXT_DYNAMIC
DEFINES += -DGETTEXT_DYNAMIC -DGETTEXT_DLL=\"$(GETTEXT_DYNAMIC)\"
endif
endif
endif
endif
endif
endif
ifdef PERL
CFLAGS += -I$(PERLLIBS) -DFEAT_PERL -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS
ifeq (yes, $(DYNAMIC_PERL))
ifeq (yes, $(DYNAMIC_PERL))
CFLAGS += -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl$(PERL_VER).dll\"
EXTRA_LIBS += -L$(PERLLIBS) -lperl$(PERL_VER)
endif
endif
endif
ifdef LUA
LUA_INCDIR = $(LUA)/include
CFLAGS += -I$(LUA_INCDIR) -I$(LUA) -DFEAT_LUA
ifeq (yes, $(DYNAMIC_LUA))
ifeq (yes, $(DYNAMIC_LUA))
CFLAGS += -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua$(LUA_VER).dll\"
endif
endif
endif
ifdef MZSCHEME
ifndef MZSCHEME_COLLECTS
ifndef MZSCHEME_COLLECTS
MZSCHEME_COLLECTS=$(MZSCHEME)/collects
ifeq (yes, $(UNDER_CYGWIN))
ifeq (yes, $(UNDER_CYGWIN))
MZSCHEME_COLLECTS:=$(shell cygpath -m $(MZSCHEME_COLLECTS) | sed -e 's/ /\\ /g')
endif
endif
endif
endif
CFLAGS += -I$(MZSCHEME)/include -DFEAT_MZSCHEME -DMZSCHEME_COLLECTS=\"$(MZSCHEME_COLLECTS)\"
ifeq (yes, $(DYNAMIC_MZSCHEME))
ifeq (yes, $(MZSCHEME_PRECISE_GC))
ifeq (yes, $(DYNAMIC_MZSCHEME))
ifeq (yes, $(MZSCHEME_PRECISE_GC))
# Precise GC does not use separate dll
CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\"
else
else
CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
endif
endif
ifeq (yes, "$(MZSCHEME_DEBUG)")
endif
endif
ifeq (yes, "$(MZSCHEME_DEBUG)")
CFLAGS += -DMZSCHEME_FORCE_GC
endif
endif
endif
ifdef RUBY
CFLAGS += -DFEAT_RUBY $(RUBYINC)
ifeq (yes, $(DYNAMIC_RUBY))
ifeq (yes, $(DYNAMIC_RUBY))
CFLAGS += -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\"
CFLAGS += -DDYNAMIC_RUBY_VER=$(RUBY_VER)
endif
ifeq (no, $(DYNAMIC_RUBY))
endif
ifeq (no, $(DYNAMIC_RUBY))
CFLAGS += -DRUBY_VERSION=$(RUBY_VER)
endif
ifneq ($(findstring w64-mingw32,$(CC)),)
endif
ifneq ($(findstring w64-mingw32,$(CC)),)
# A workaround for MinGW-w64
CFLAGS += -DHAVE_STRUCT_TIMESPEC -DHAVE_STRUCT_TIMEZONE
endif
endif
endif
ifdef PYTHON
CFLAGS += -DFEAT_PYTHON
ifeq (yes, $(DYNAMIC_PYTHON))
ifeq (yes, $(DYNAMIC_PYTHON))
CFLAGS += -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"$(DYNAMIC_PYTHON_DLL)\"
endif
endif
endif
ifdef PYTHON3
CFLAGS += -DFEAT_PYTHON3
ifeq (yes, $(DYNAMIC_PYTHON3))
ifeq (yes, $(DYNAMIC_PYTHON3))
CFLAGS += -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"$(DYNAMIC_PYTHON3_DLL)\"
endif
endif
endif
ifdef TCL
CFLAGS += -DFEAT_TCL $(TCLINC)
ifeq (yes, $(DYNAMIC_TCL))
ifeq (yes, $(DYNAMIC_TCL))
CFLAGS += -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"$(TCL_DLL)\" -DDYNAMIC_TCL_VER=\"$(TCL_VER_LONG)\"
endif
endif
endif
ifeq ($(POSTSCRIPT),yes)
@ -614,15 +608,15 @@ endif
ifeq ($(NETBEANS),yes)
# Only allow NETBEANS for a GUI build.
ifeq (yes, $(GUI))
ifeq (yes, $(GUI))
DEFINES += -DFEAT_NETBEANS_INTG
ifeq ($(NBDEBUG), yes)
ifeq ($(NBDEBUG), yes)
DEFINES += -DNBDEBUG
NBDEBUG_INCL = nbdebug.h
NBDEBUG_SRC = nbdebug.c
endif
endif
endif
endif
endif
ifeq ($(CHANNEL),yes)
@ -642,39 +636,39 @@ endif
# DirectWrite (DirectX)
ifeq ($(DIRECTX),yes)
# Only allow DirectWrite for a GUI build.
ifeq (yes, $(GUI))
ifeq (yes, $(GUI))
DEFINES += -DFEAT_DIRECTX -DDYNAMIC_DIRECTX
ifneq ($(COLOR_EMOJI),no)
ifneq ($(COLOR_EMOJI),no)
DEFINES += -DFEAT_DIRECTX_COLOR_EMOJI
endif
endif
endif
endif
endif
# Only allow XPM for a GUI build.
ifeq (yes, $(GUI))
ifndef XPM
ifeq ($(ARCH),i386)
ifndef XPM
ifeq ($(ARCH),i386)
XPM = xpm/x86
endif
ifeq ($(ARCH),i486)
endif
ifeq ($(ARCH),i486)
XPM = xpm/x86
endif
ifeq ($(ARCH),i586)
endif
ifeq ($(ARCH),i586)
XPM = xpm/x86
endif
ifeq ($(ARCH),i686)
endif
ifeq ($(ARCH),i686)
XPM = xpm/x86
endif
ifeq ($(ARCH),x86-64)
endif
ifeq ($(ARCH),x86-64)
XPM = xpm/x64
endif
endif
ifdef XPM
ifneq ($(XPM),no)
endif
endif
ifdef XPM
ifneq ($(XPM),no)
CFLAGS += -DFEAT_XPM_W32 -I $(XPM)/include -I $(XPM)/../include
endif
endif
endif
endif
endif
@ -682,16 +676,14 @@ ifeq ($(DEBUG),yes)
CFLAGS += -g -fstack-check
DEBUG_SUFFIX=d
else
ifeq ($(OPTIMIZE), SIZE)
ifeq ($(OPTIMIZE), SIZE)
CFLAGS += -Os
else
ifeq ($(OPTIMIZE), MAXSPEED)
else ifeq ($(OPTIMIZE), MAXSPEED)
CFLAGS += -O3
CFLAGS += -fomit-frame-pointer -freg-struct-return
else # SPEED
else # SPEED
CFLAGS += -O2
endif
endif
endif
LFLAGS += -s
endif
@ -705,6 +697,7 @@ OBJ = \
$(OUTDIR)/blob.o \
$(OUTDIR)/blowfish.o \
$(OUTDIR)/buffer.o \
$(OUTDIR)/change.o \
$(OUTDIR)/charset.o \
$(OUTDIR)/crypt.o \
$(OUTDIR)/crypt_zip.o \
@ -784,13 +777,13 @@ endif
ifdef MZSCHEME
OBJ += $(OUTDIR)/if_mzsch.o
MZSCHEME_INCL = if_mzsch.h
ifeq (yes,$(MZSCHEME_GENERATE_BASE))
ifeq (yes,$(MZSCHEME_GENERATE_BASE))
CFLAGS += -DINCLUDE_MZSCHEME_BASE
MZ_EXTRA_DEP += mzscheme_base.c
endif
ifeq (yes,$(MZSCHEME_PRECISE_GC))
endif
ifeq (yes,$(MZSCHEME_PRECISE_GC))
CFLAGS += -DMZ_PRECISE_GC
endif
endif
endif
ifdef PYTHON
OBJ += $(OUTDIR)/if_python.o
@ -809,17 +802,15 @@ OBJ += $(OUTDIR)/if_cscope.o
endif
ifeq ($(NETBEANS),yes)
ifneq ($(CHANNEL),yes)
ifneq ($(CHANNEL),yes)
# Cannot use Netbeans without CHANNEL
NETBEANS=no
else
ifneq (yes, $(GUI))
else ifneq (yes, $(GUI))
# Cannot use Netbeans without GUI.
NETBEANS=no
else
else
OBJ += $(OUTDIR)/netbeans.o
endif
endif
endif
endif
ifeq ($(CHANNEL),yes)
@ -829,19 +820,19 @@ endif
ifeq ($(DIRECTX),yes)
# Only allow DIRECTX for a GUI build.
ifeq (yes, $(GUI))
ifeq (yes, $(GUI))
OBJ += $(OUTDIR)/gui_dwrite.o
LIB += -ld2d1 -ldwrite
USE_STDCPLUS = yes
endif
endif
endif
ifneq ($(XPM),no)
# Only allow XPM for a GUI build.
ifeq (yes, $(GUI))
ifeq (yes, $(GUI))
OBJ += $(OUTDIR)/xpm_w32.o
# You'll need libXpm.a from http://gnuwin32.sf.net
LIB += -L$(XPM)/lib -lXpm
endif
endif
endif
ifeq ($(TERMINAL),yes)
@ -914,32 +905,32 @@ MAIN_TARGET = $(TARGET)
endif
ifdef GETTEXT
ifneq (yes, $(GETTEXT))
ifneq (yes, $(GETTEXT))
CFLAGS += -I$(GETTEXTINCLUDE)
ifndef STATIC_GETTEXT
ifndef STATIC_GETTEXT
LIB += -L$(GETTEXTLIB) -l$(INTLLIB)
ifeq (USE_SAFE_GETTEXT_DLL, $(DYNAMIC_GETTEXT))
ifeq (USE_SAFE_GETTEXT_DLL, $(DYNAMIC_GETTEXT))
OBJ+=$(SAFE_GETTEXT_DLL_OBJ)
endif
else
endif
else
LIB += -L$(GETTEXTLIB) -lintl
endif
endif
endif
endif
endif
ifdef PERL
ifeq (no, $(DYNAMIC_PERL))
ifeq (no, $(DYNAMIC_PERL))
LIB += -L$(PERLLIBS) -lperl$(PERL_VER)
endif
endif
endif
ifdef TCL
LIB += -L$(TCL)/lib
ifeq (yes, $(DYNAMIC_TCL))
ifeq (yes, $(DYNAMIC_TCL))
LIB += -ltclstub$(TCL_VER)
else
else
LIB += -ltcl$(TCL_VER)
endif
endif
endif
ifeq (yes, $(OLE))
@ -950,35 +941,35 @@ endif
ifeq (yes, $(IME))
DEFINES += -DFEAT_MBYTE_IME
ifeq (yes, $(DYNAMIC_IME))
ifeq (yes, $(DYNAMIC_IME))
DEFINES += -DDYNAMIC_IME
else
else
LIB += -limm32
endif
endif
endif
ifdef ICONV
ifneq (yes, $(ICONV))
ifneq (yes, $(ICONV))
LIB += -L$(ICONV)
CFLAGS += -I$(ICONV)
endif
endif
DEFINES+=-DDYNAMIC_ICONV
endif
ifeq (yes, $(USE_STDCPLUS))
LINK = $(CXX)
ifeq (yes, $(STATIC_STDCPLUS))
ifeq (yes, $(STATIC_STDCPLUS))
#LIB += -static-libstdc++ -static-libgcc
LIB += -Wl,-Bstatic -lstdc++ -lgcc -Wl,-Bdynamic
endif
endif
else
LINK = $(CC)
endif
ifeq (yes, $(STATIC_WINPTHREAD))
ifeq (yes, $(HAS_GCC_EH))
ifeq (yes, $(HAS_GCC_EH))
LIB += -lgcc_eh
endif
endif
LIB += -Wl,-Bstatic -lwinpthread -Wl,-Bdynamic
endif

View File

@ -30,6 +30,7 @@ SRC = \
autocmd.c \
blowfish.c \
buffer.c \
change.c \
charset.c \
crypt.c \
crypt_zip.c \
@ -92,6 +93,7 @@ OBJ = o/arabic.o \
o/autocmd.o \
o/blowfish.o \
o/buffer.o \
o/change.o \
o/charset.o \
o/crypt.o \
o/crypt_zip.o \
@ -177,6 +179,8 @@ o/blowfish.o: blowfish.c $(SYMS)
o/buffer.o: buffer.c $(SYMS)
o/change.o: change.c $(SYMS)
o/charset.o: charset.c $(SYMS)
o/crypt.o: crypt.c $(SYMS)

View File

@ -40,6 +40,7 @@ SRC = arabic.c \
autocmd.c \
blowfish.c \
buffer.c \
change.c \
charset.c \
crypt.c \
crypt_zip.c \
@ -104,6 +105,7 @@ OBJ = obj/arabic.o \
obj/autocmd.o \
obj/blowfish.o \
obj/buffer.o \
obj/change.o \
obj/charset.o \
obj/crypt.o \
obj/crypt_zip.o \
@ -166,6 +168,7 @@ PRO = proto/arabic.pro \
proto/autocmd.pro \
proto/blowfish.pro \
proto/buffer.pro \
proto/change.pro \
proto/charset.pro \
proto/crypt.pro \
proto/crypt_zip.pro \
@ -280,6 +283,9 @@ obj/blowfish.o: blowfish.c
obj/buffer.o: buffer.c
$(CCSYM) $@ buffer.c
obj/change.o: change.c
$(CCSYM) $@ change.c
obj/charset.o: charset.c
$(CCSYM) $@ charset.c

View File

@ -28,6 +28,7 @@ SRC = arabic.c \
autocmd.c \
blowfish.c \
buffer.c \
change.c \
charset.c \
crypt.c \
crypt_zip.c \

View File

@ -700,6 +700,7 @@ OBJ = \
$(OUTDIR)\blob.obj \
$(OUTDIR)\blowfish.obj \
$(OUTDIR)\buffer.obj \
$(OUTDIR)\change.obj \
$(OUTDIR)\charset.obj \
$(OUTDIR)\crypt.obj \
$(OUTDIR)\crypt_zip.obj \
@ -1410,6 +1411,8 @@ $(OUTDIR)/blowfish.obj: $(OUTDIR) blowfish.c $(INCL)
$(OUTDIR)/buffer.obj: $(OUTDIR) buffer.c $(INCL)
$(OUTDIR)/change.obj: $(OUTDIR) change.c $(INCL)
$(OUTDIR)/charset.obj: $(OUTDIR) charset.c $(INCL)
$(OUTDIR)/crypt.obj: $(OUTDIR) crypt.c $(INCL)
@ -1700,6 +1703,7 @@ proto.h: \
proto/blob.pro \
proto/blowfish.pro \
proto/buffer.pro \
proto/change.pro \
proto/charset.pro \
proto/crypt.pro \
proto/crypt_zip.pro \

View File

@ -93,6 +93,7 @@ SRC = \
autocmd.c \
blowfish.c \
buffer.c \
change.c \
charset.c \
crypt.c \
crypt_zip.c \
@ -156,6 +157,7 @@ OBJ = \
autocmd.o \
blowfish.o \
buffer.o \
change.o \
charset.o \
crypt.o \
crypt_zip.o \
@ -219,6 +221,7 @@ PRO = \
proto/autocmd.pro \
proto/blowfish.pro \
proto/buffer.pro \
proto/change.pro \
proto/charset.pro \
proto/crypt.pro \
proto/crypt_zip.pro \
@ -340,6 +343,8 @@ blowfish.o: blowfish.c
proto/blowfish.pro: blowfish.c
buffer.o: buffer.c
proto/buffer.pro: buffer.c
change.o: change.c
proto/change.pro: change.c
charset.o: charset.c
proto/charset.pro: charset.c
crypt.o: crypt.c

View File

@ -2,7 +2,7 @@
# Makefile for Vim on OpenVMS
#
# Maintainer: Zoltan Arpadffy <arpadffy@polarhome.com>
# Last change: 2019 Apr 26
# Last change: 2019 May 11
#
# This has script been tested on VMS 6.2 to 8.2 on DEC Alpha, VAX and IA64
# with MMS and MMK
@ -307,7 +307,7 @@ ALL_CFLAGS_VER = /def=($(MODEL_DEF)$(DEFS)$(DEBUG_DEF)$(PERL_DEF)$(PYTHON_DEF) -
ALL_LIBS = $(LIBS) $(GUI_LIB_DIR) $(GUI_LIB) \
$(PERL_LIB) $(PYTHON_LIB) $(TCL_LIB) $(RUBY_LIB)
SRC = arabic.c autocmd.c beval.c blob.c blowfish.c buffer.c charset.c \
SRC = arabic.c autocmd.c beval.c blob.c blowfish.c buffer.c change.c charset.c \
crypt.c crypt_zip.c debugger.c dict.c diff.c digraph.c edit.c eval.c \
evalfunc.c ex_cmds.c ex_cmds2.c ex_docmd.c ex_eval.c ex_getln.c \
if_cscope.c if_xcmdsrv.c fileio.c findfile.c fold.c getchar.c \
@ -320,7 +320,7 @@ SRC = arabic.c autocmd.c beval.c blob.c blowfish.c buffer.c charset.c \
$(GUI_SRC) $(PERL_SRC) $(PYTHON_SRC) $(TCL_SRC) \
$(RUBY_SRC) $(HANGULIN_SRC) $(MZSCH_SRC) $(XDIFF_SRC)
OBJ = arabic.obj autocmd.obj beval.obj blob.obj blowfish.obj buffer.obj \
OBJ = arabic.obj autocmd.obj beval.obj blob.obj blowfish.obj buffer.obj change.obj \
charset.obj crypt.obj crypt_zip.obj debugger.obj dict.obj diff.obj \
digraph.obj edit.obj eval.obj evalfunc.obj ex_cmds.obj ex_cmds2.obj \
ex_docmd.obj ex_eval.obj ex_getln.obj if_cscope.obj if_xcmdsrv.obj \
@ -510,6 +510,10 @@ buffer.obj : buffer.c vim.h [.auto]config.h feature.h os_unix.h \
ascii.h keymap.h term.h macros.h structs.h regexp.h \
gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \
globals.h version.h
change.obj : change.c vim.h [.auto]config.h feature.h os_unix.h \
ascii.h keymap.h term.h macros.h structs.h regexp.h \
gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \
globals.h version.h
charset.obj : charset.c vim.h [.auto]config.h feature.h os_unix.h \
ascii.h keymap.h term.h macros.h structs.h regexp.h \
gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \

View File

@ -1576,6 +1576,7 @@ BASIC_SRC = \
blob.c \
blowfish.c \
buffer.c \
change.c \
charset.c \
crypt.c \
crypt_zip.c \
@ -1691,6 +1692,7 @@ OBJ_COMMON = \
objects/autocmd.o \
objects/beval.o \
objects/buffer.o \
objects/change.o \
objects/blob.o \
objects/blowfish.o \
objects/crypt.o \
@ -1821,6 +1823,7 @@ PRO_AUTO = \
autocmd.pro \
blowfish.pro \
buffer.pro \
change.pro \
charset.pro \
crypt.pro \
crypt_zip.pro \
@ -2965,6 +2968,9 @@ objects/blowfish.o: blowfish.c
objects/buffer.o: buffer.c
$(CCC) -o $@ buffer.c
objects/change.o: change.c
$(CCC) -o $@ change.c
objects/charset.o: charset.c
$(CCC) -o $@ charset.c
@ -3430,6 +3436,10 @@ objects/buffer.o: buffer.c vim.h protodef.h auto/config.h feature.h os_unix.h \
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
proto.h globals.h version.h
objects/change.o: change.c vim.h protodef.h auto/config.h feature.h os_unix.h \
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
proto.h globals.h version.h
objects/charset.o: charset.c vim.h protodef.h auto/config.h feature.h os_unix.h \
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \

View File

@ -25,6 +25,7 @@ File name | Description
--------- | -----------
autocmd.c | autocommands
buffer.c | manipulating buffers (loaded files)
change.c | handling changes to text
debugger.c | vim script debugger
diff.c | diff mode (vimdiff)
eval.c | expression evaluation

2305
src/change.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1650,7 +1650,7 @@ invoke_callback(channel_T *channel, char_u *callback, partial_T *partial,
argv[0].v_type = VAR_CHANNEL;
argv[0].vval.v_channel = channel;
call_func(callback, (int)STRLEN(callback), &rettv, 2, argv, NULL,
call_func(callback, -1, &rettv, 2, argv, NULL,
0L, 0L, &dummy, TRUE, partial, NULL);
clear_tv(&rettv);
channel_need_redraw = TRUE;
@ -2989,7 +2989,7 @@ channel_close(channel_T *channel, int invoke_close_cb)
(char *)channel->ch_close_cb);
argv[0].v_type = VAR_CHANNEL;
argv[0].vval.v_channel = channel;
call_func(channel->ch_close_cb, (int)STRLEN(channel->ch_close_cb),
call_func(channel->ch_close_cb, -1,
&rettv, 1, argv, NULL, 0L, 0L, &dummy, TRUE,
channel->ch_close_partial, NULL);
clear_tv(&rettv);
@ -5478,7 +5478,7 @@ job_cleanup(job_T *job)
argv[0].vval.v_job = job;
argv[1].v_type = VAR_NUMBER;
argv[1].vval.v_number = job->jv_exitval;
call_func(job->jv_exit_cb, (int)STRLEN(job->jv_exit_cb),
call_func(job->jv_exit_cb, -1,
&rettv, 2, argv, NULL, 0L, 0L, &dummy, TRUE,
job->jv_exit_partial, NULL);
clear_tv(&rettv);
@ -6069,8 +6069,7 @@ invoke_prompt_callback(void)
argv[0].vval.v_string = vim_strsave(text);
argv[1].v_type = VAR_UNKNOWN;
call_func(curbuf->b_prompt_callback,
(int)STRLEN(curbuf->b_prompt_callback),
call_func(curbuf->b_prompt_callback, -1,
&rettv, 1, argv, NULL, 0L, 0L, &dummy, TRUE,
curbuf->b_prompt_partial, NULL);
clear_tv(&argv[0]);
@ -6093,8 +6092,7 @@ invoke_prompt_interrupt(void)
argv[0].v_type = VAR_UNKNOWN;
got_int = FALSE; // don't skip executing commands
call_func(curbuf->b_prompt_interrupt,
(int)STRLEN(curbuf->b_prompt_interrupt),
call_func(curbuf->b_prompt_interrupt, -1,
&rettv, 0, argv, NULL, 0L, 0L, &dummy, TRUE,
curbuf->b_prompt_int_partial, NULL);
clear_tv(&rettv);

View File

@ -765,7 +765,7 @@ eval_expr_typval(typval_T *expr, typval_T *argv, int argc, typval_T *rettv)
s = expr->vval.v_string;
if (s == NULL || *s == NUL)
return FAIL;
if (call_func(s, (int)STRLEN(s), rettv, argc, argv, NULL,
if (call_func(s, -1, rettv, argc, argv, NULL,
0L, 0L, &dummy, TRUE, NULL, NULL) == FAIL)
return FAIL;
}
@ -776,7 +776,7 @@ eval_expr_typval(typval_T *expr, typval_T *argv, int argc, typval_T *rettv)
s = partial_name(partial);
if (s == NULL || *s == NUL)
return FAIL;
if (call_func(s, (int)STRLEN(s), rettv, argc, argv, NULL,
if (call_func(s, -1, rettv, argc, argv, NULL,
0L, 0L, &dummy, TRUE, partial, NULL) == FAIL)
return FAIL;
}
@ -1088,7 +1088,7 @@ call_vim_function(
int ret;
rettv->v_type = VAR_UNKNOWN; /* clear_tv() uses this */
ret = call_func(func, (int)STRLEN(func), rettv, argc, argv, NULL,
ret = call_func(func, -1, rettv, argc, argv, NULL,
curwin->w_cursor.lnum, curwin->w_cursor.lnum,
&doesrange, TRUE, NULL, NULL);
if (ret == FAIL)
@ -7109,7 +7109,7 @@ handle_subscript(
}
else
s = (char_u *)"";
ret = get_func_tv(s, (int)STRLEN(s), rettv, arg,
ret = get_func_tv(s, -1, rettv, arg,
curwin->w_cursor.lnum, curwin->w_cursor.lnum,
&len, evaluate, pt, selfdict);

View File

@ -767,6 +767,8 @@ static struct fst
{"line2byte", 1, 1, f_line2byte},
{"lispindent", 1, 1, f_lispindent},
{"list2str", 1, 2, f_list2str},
{"listener_add", 1, 2, f_listener_add},
{"listener_remove", 1, 1, f_listener_remove},
{"localtime", 0, 0, f_localtime},
#ifdef FEAT_FLOAT
{"log", 1, 1, f_log},
@ -2007,12 +2009,11 @@ tv_get_buf(typval_T *tv, int curtab_only)
return buf;
}
#ifdef FEAT_SIGNS
/*
* Get the buffer from "arg" and give an error and return NULL if it is not
* valid.
*/
static buf_T *
buf_T *
get_buf_arg(typval_T *arg)
{
buf_T *buf;
@ -2024,7 +2025,6 @@ get_buf_arg(typval_T *arg)
semsg(_("E158: Invalid buffer name: %s"), tv_get_string(arg));
return buf;
}
#endif
/*
* "bufname(expr)" function
@ -9746,9 +9746,9 @@ f_readfile(typval_T *argvars, typval_T *rettv)
if (failed)
{
// an empty list is returned on error
list_free(rettv->vval.v_list);
/* readfile doc says an empty list is returned on error */
rettv->vval.v_list = list_alloc();
rettv_list_alloc(rettv);
}
vim_free(prev);
@ -12644,8 +12644,7 @@ item_compare2(const void *s1, const void *s2)
copy_tv(&si2->item->li_tv, &argv[1]);
rettv.v_type = VAR_UNKNOWN; /* clear_tv() uses this */
res = call_func(func_name, (int)STRLEN(func_name),
&rettv, 2, argv, NULL, 0L, 0L, &dummy, TRUE,
res = call_func(func_name, -1, &rettv, 2, argv, NULL, 0L, 0L, &dummy, TRUE,
partial, sortinfo->item_compare_selfdict);
clear_tv(&argv[0]);
clear_tv(&argv[1]);
@ -14676,7 +14675,6 @@ f_test_settime(typval_T *argvars, typval_T *rettv UNUSED)
time_for_testing = (time_t)tv_get_number(&argvars[0]);
}
#if defined(FEAT_JOB_CHANNEL) || defined(FEAT_TIMERS) || defined(PROTO)
/*
* Get a callback from "arg". It can be a Funcref or a function name.
* When "arg" is zero return an empty string.
@ -14717,7 +14715,6 @@ free_callback(char_u *callback, partial_T *partial)
vim_free(callback);
}
}
#endif
#ifdef FEAT_TIMERS
/*

View File

@ -325,7 +325,7 @@ timer_callback(timer_T *timer)
argv[0].vval.v_number = (varnumber_T)timer->tr_id;
argv[1].v_type = VAR_UNKNOWN;
call_func(timer->tr_callback, (int)STRLEN(timer->tr_callback),
call_func(timer->tr_callback, -1,
&rettv, 1, argv, NULL, 0L, 0L, &dummy, TRUE,
timer->tr_partial, NULL);
clear_tv(&rettv);

View File

@ -1637,7 +1637,7 @@ ml_recover(void)
* empty. Don't set the modified flag then. */
if (!(curbuf->b_ml.ml_line_count == 2 && *ml_get(1) == NUL))
{
changed_int();
changed_internal();
++CHANGEDTICK(curbuf);
}
}
@ -1651,7 +1651,7 @@ ml_recover(void)
vim_free(p);
if (i != 0)
{
changed_int();
changed_internal();
++CHANGEDTICK(curbuf);
break;
}

File diff suppressed because it is too large Load Diff

View File

@ -63,6 +63,7 @@ extern int _stricoll(char *a, char *b);
# endif
# include "autocmd.pro"
# include "buffer.pro"
# include "change.pro"
# include "charset.pro"
# ifdef FEAT_CSCOPE
# include "if_cscope.pro"

27
src/proto/change.pro Normal file
View File

@ -0,0 +1,27 @@
/* change.c */
void change_warning(int col);
void changed(void);
void changed_internal(void);
void f_listener_add(typval_T *argvars, typval_T *rettv);
void f_listener_remove(typval_T *argvars, typval_T *rettv);
void invoke_listeners(void);
void changed_bytes(linenr_T lnum, colnr_T col);
void inserted_bytes(linenr_T lnum, colnr_T col, int added);
void appended_lines(linenr_T lnum, long count);
void appended_lines_mark(linenr_T lnum, long count);
void deleted_lines(linenr_T lnum, long count);
void deleted_lines_mark(linenr_T lnum, long count);
void changed_lines(linenr_T lnum, colnr_T col, linenr_T lnume, long xtra);
void unchanged(buf_T *buf, int ff);
void ins_bytes(char_u *p);
void ins_bytes_len(char_u *p, int len);
void ins_char(int c);
void ins_char_bytes(char_u *buf, int charlen);
void ins_str(char_u *s);
int del_char(int fixpos);
int del_chars(long count, int fixpos);
int del_bytes(long count, int fixpos_arg, int use_delcombine);
int open_line(int dir, int flags, int second_line_indent);
int truncate_line(int fixpos);
void del_lines(long nlines, int undo);
/* vim: set ft=c : */

View File

@ -5,6 +5,7 @@ int find_internal_func(char_u *name);
int call_internal_func(char_u *name, int argcount, typval_T *argvars, typval_T *rettv);
buf_T *buflist_find_by_name(char_u *name, int curtab_only);
buf_T *tv_get_buf(typval_T *tv, int curtab_only);
buf_T *get_buf_arg(typval_T *arg);
void execute_redir_str(char_u *value, int value_len);
void mzscheme_call_vim(char_u *name, typval_T *args, typval_T *rettv);
float_T vim_round(float_T f);

View File

@ -7,7 +7,6 @@ int get_indent_str_vtab(char_u *ptr, int ts, int *vts, int list);
int set_indent(int size, int flags);
int get_number_indent(linenr_T lnum);
int get_breakindent_win(win_T *wp, char_u *line);
int open_line(int dir, int flags, int second_line_indent);
int get_leader_len(char_u *line, char_u **flags, int backward, int include_space);
int get_last_leader_offset(char_u *line, char_u **flags);
int plines(linenr_T lnum);
@ -17,33 +16,12 @@ int plines_win_nofill(win_T *wp, linenr_T lnum, int winheight);
int plines_win_nofold(win_T *wp, linenr_T lnum);
int plines_win_col(win_T *wp, linenr_T lnum, long column);
int plines_m_win(win_T *wp, linenr_T first, linenr_T last);
void ins_bytes(char_u *p);
void ins_bytes_len(char_u *p, int len);
void ins_char(int c);
void ins_char_bytes(char_u *buf, int charlen);
void ins_str(char_u *s);
int del_char(int fixpos);
int del_chars(long count, int fixpos);
int del_bytes(long count, int fixpos_arg, int use_delcombine);
int truncate_line(int fixpos);
void del_lines(long nlines, int undo);
int gchar_pos(pos_T *pos);
int gchar_cursor(void);
void pchar_cursor(int c);
int inindent(int extra);
char_u *skip_to_option_part(char_u *p);
void changed(void);
void changed_int(void);
void changed_bytes(linenr_T lnum, colnr_T col);
void inserted_bytes(linenr_T lnum, colnr_T col, int added);
void appended_lines(linenr_T lnum, long count);
void appended_lines_mark(linenr_T lnum, long count);
void deleted_lines(linenr_T lnum, long count);
void deleted_lines_mark(linenr_T lnum, long count);
void changed_lines(linenr_T lnum, colnr_T col, linenr_T lnume, long xtra);
void unchanged(buf_T *buf, int ff);
void check_status(buf_T *buf);
void change_warning(int col);
int ask_yesno(char_u *str, int direct);
int is_mouse_key(int c);
int get_keystroke(void);

View File

@ -7423,7 +7423,7 @@ vim_regsub_both(
if (expr->v_type == VAR_FUNC)
{
s = expr->vval.v_string;
call_func(s, (int)STRLEN(s), &rettv,
call_func(s, -1, &rettv,
1, argv, fill_submatch_list,
0L, 0L, &dummy, TRUE, NULL, NULL);
}
@ -7432,7 +7432,7 @@ vim_regsub_both(
partial_T *partial = expr->vval.v_partial;
s = partial_name(partial);
call_func(s, (int)STRLEN(s), &rettv,
call_func(s, -1, &rettv,
1, argv, fill_submatch_list,
0L, 0L, &dummy, TRUE, partial, NULL);
}

View File

@ -564,6 +564,11 @@ update_screen(int type_arg)
type = 0;
}
#ifdef FEAT_EVAL
// Before updating the screen, notify any listeners of changed text.
invoke_listeners();
#endif
if (must_redraw)
{
if (type < must_redraw) /* use maximal type */

View File

@ -1873,6 +1873,19 @@ typedef struct
#endif
} jobopt_T;
#ifdef FEAT_EVAL
/*
* Structure used for listeners added with listener_add().
*/
typedef struct listener_S listener_T;
struct listener_S
{
listener_T *lr_next;
int lr_id;
char_u *lr_callback;
partial_T *lr_partial;
};
#endif
/* structure used for explicit stack while garbage collecting hash tables */
typedef struct ht_stack_S
@ -2424,6 +2437,8 @@ struct file_buffer
#ifdef FEAT_EVAL
dictitem_T b_bufvar; /* variable for "b:" Dictionary */
dict_T *b_vars; /* internal variables, local to buffer */
listener_T *b_listener;
#endif
#ifdef FEAT_TEXT_PROP
int b_has_textprop; // TRUE when text props were added

View File

@ -2108,8 +2108,9 @@ set_termname(char_u *term)
# define HMT_JSBTERM 8
# define HMT_PTERM 16
# define HMT_URXVT 32
# define HMT_SGR 64
# define HMT_SGR_REL 128
# define HMT_GPM 64
# define HMT_SGR 128
# define HMT_SGR_REL 256
static int has_mouse_termcode = 0;
# endif
@ -2149,6 +2150,11 @@ set_mouse_termcode(
if (n == KS_URXVT_MOUSE)
has_mouse_termcode |= HMT_URXVT;
else
# endif
# ifdef FEAT_MOUSE_GPM
if (n == KS_GPM_MOUSE)
has_mouse_termcode |= HMT_GPM;
else
# endif
if (n == KS_SGR_MOUSE)
has_mouse_termcode |= HMT_SGR;
@ -2196,6 +2202,11 @@ del_mouse_termcode(
if (n == KS_URXVT_MOUSE)
has_mouse_termcode &= ~HMT_URXVT;
else
# endif
# ifdef FEAT_MOUSE_GPM
if (n == KS_GPM_MOUSE)
has_mouse_termcode &= ~HMT_GPM;
else
# endif
if (n == KS_SGR_MOUSE)
has_mouse_termcode &= ~HMT_SGR;

View File

@ -3779,7 +3779,7 @@ handle_call_command(term_T *term, channel_T *channel, listitem_T *item)
argvars[0].v_type = VAR_NUMBER;
argvars[0].vval.v_number = term->tl_buffer->b_fnum;
argvars[1] = item->li_next->li_tv;
if (call_func(func, (int)STRLEN(func), &rettv,
if (call_func(func, -1, &rettv,
2, argvars, /* argv_func */ NULL,
/* firstline */ 1, /* lastline */ 1,
&doesrange, /* evaluate */ TRUE,
@ -3976,7 +3976,9 @@ create_vterm(term_T *term, int rows, int cols)
&term->tl_default_color.fg,
&term->tl_default_color.bg);
if (t_colors >= 16)
if (t_colors < 16)
// Less than 16 colors: assume that bold means using a bright color for
// the foreground color.
vterm_state_set_bold_highbright(vterm_obtain_state(vterm), 1);
/* Required to initialize most things. */

View File

@ -168,6 +168,7 @@ NEW_TESTS = \
test_lispwords \
test_listchars \
test_listdict \
test_listener \
test_listlbr \
test_listlbr_utf8 \
test_lua \
@ -359,6 +360,7 @@ NEW_TESTS_RES = \
test_lineending.res \
test_listchars.res \
test_listdict.res \
test_listener.res \
test_listlbr.res \
test_lua.res \
test_makeencoding.res \

View File

@ -1,4 +1,4 @@
>A+0#0000001#8080809@1|B+0#e000002#ff404010@1|C+0#00e0003#40ff4011@1|D+0#e0e0004#ffff4012@1|E+0#0000e05#4040ff13@1|F+0#e000e06#ff40ff14@1|G+0#00e0e07#40ffff15@1|H+0#e0e0e08#ffffff16@1|I+0#8080809#0000001@1|J+0#ff404010#e000002@1|K+0#40ff4011#00e0003@1|L+0#ffff4012#e0e0004@1|M+0#4040ff13#0000e05@1|N+0#ff40ff14#e000e06@1|O+0#40ffff15#00e0e07@1|P+0#ffffff16#e0e0e08@1| +0#0000000#ffffff0@42
>A+0#0000001#8080809@1|B+0#e000002#ff404010@1|C+0#00e0003#40ff4011@1|D+0#e0e0004#ffff4012@1|E+0#0000e05#4040ff13@1|F+0#e000e06#ff40ff14@1|G+0#00e0e07#40ffff15@1|H+0#e0e0e08#ffffff16@1|I+0#8080809#0000001@1|J+0#ff404010#e000002@1|K+0#40ff4011#00e0003@1|L+0#ffff4012#e0e0004@1|M+0#4040ff13#0000e05@1|N+0#ff40ff14#e000e06@1|O+0#40ffff15#00e0e07@1|P+0#ffffff16#e0e0e08@1| +0#0000000#ffffff0|X+2#e000002&@1|Y+2#40ff4011&@1|Z+2#ff40ff14#e000e06@1| +0#0000000#ffffff0@35
@2| +0#4040ff13&@72
|~| @73
|~| @73

View File

@ -18,6 +18,7 @@ func Test_vim_did_enter()
endfunc
if has('timers')
func ExitInsertMode(id)
call feedkeys("\<Esc>")
endfunc
@ -70,7 +71,30 @@ if has('timers')
au! CursorHoldI
set updatetime&
endfunc
endif
func Test_OptionSet_modeline()
call test_override('starting', 1)
au! OptionSet
augroup set_tabstop
au OptionSet tabstop call timer_start(1, {-> execute("echo 'Handler called'", "")})
augroup END
call writefile(['vim: set ts=7 sw=5 :', 'something'], 'XoptionsetModeline')
set modeline
let v:errmsg = ''
call assert_fails('split XoptionsetModeline', 'E12:')
call assert_equal(7, &ts)
call assert_equal('', v:errmsg)
augroup set_tabstop
au!
augroup END
bwipe!
set ts&
call delete('XoptionsetModeline')
call test_override('starting', 0)
endfunc
endif "has('timers')
func Test_bufunload()
augroup test_bufunload_group
@ -673,28 +697,6 @@ func Test_OptionSet_diffmode_close()
"delfunc! AutoCommandOptionSet
endfunc
func Test_OptionSet_modeline()
call test_override('starting', 1)
au! OptionSet
augroup set_tabstop
au OptionSet tabstop call timer_start(1, {-> execute("echo 'Handler called'", "")})
augroup END
call writefile(['vim: set ts=7 sw=5 :', 'something'], 'XoptionsetModeline')
set modeline
let v:errmsg = ''
call assert_fails('split XoptionsetModeline', 'E12:')
call assert_equal(7, &ts)
call assert_equal('', v:errmsg)
augroup set_tabstop
au!
augroup END
bwipe!
set ts&
call delete('XoptionsetModeline')
call test_override('starting', 0)
endfunc
" Test for Bufleave autocommand that deletes the buffer we are about to edit.
func Test_BufleaveWithDelete()
new | edit Xfile1

View File

@ -0,0 +1,95 @@
" tests for listener_add() and listener_remove()
func s:StoreList(l)
let s:list = a:l
endfunc
func s:AnotherStoreList(l)
let s:list2 = a:l
endfunc
func s:EvilStoreList(l)
let s:list3 = a:l
call assert_fails("call add(a:l, 'myitem')", "E742:")
endfunc
func Test_listening()
new
call setline(1, ['one', 'two'])
let id = listener_add({l -> s:StoreList(l)})
call setline(1, 'one one')
redraw
call assert_equal([{'lnum': 1, 'end': 2, 'col': 1, 'added': 0}], s:list)
" Undo is also a change
set undolevels& " start new undo block
call append(2, 'two two')
undo
redraw
call assert_equal([{'lnum': 3, 'end': 3, 'col': 1, 'added': 1},
\ {'lnum': 3, 'end': 4, 'col': 1, 'added': -1}, ], s:list)
1
" Two listeners, both get called.
let id2 = listener_add({l -> s:AnotherStoreList(l)})
let s:list = []
let s:list2 = []
exe "normal $asome\<Esc>"
redraw
call assert_equal([{'lnum': 1, 'end': 2, 'col': 8, 'added': 0}], s:list)
call assert_equal([{'lnum': 1, 'end': 2, 'col': 8, 'added': 0}], s:list2)
call listener_remove(id2)
let s:list = []
let s:list2 = []
call setline(3, 'three')
redraw
call assert_equal([{'lnum': 3, 'end': 3, 'col': 1, 'added': 1}], s:list)
call assert_equal([], s:list2)
" the "o" command first adds an empty line and then changes it
let s:list = []
exe "normal Gofour\<Esc>"
redraw
call assert_equal([{'lnum': 4, 'end': 4, 'col': 1, 'added': 1},
\ {'lnum': 4, 'end': 5, 'col': 1, 'added': 0}], s:list)
" Remove last listener
let s:list = []
call listener_remove(id)
call setline(1, 'asdfasdf')
redraw
call assert_equal([], s:list)
" Trying to change the list fails
let id = listener_add({l -> s:EvilStoreList(l)})
let s:list3 = []
call setline(1, 'asdfasdf')
redraw
call assert_equal([{'lnum': 1, 'end': 2, 'col': 1, 'added': 0}], s:list3)
call listener_remove(id)
bwipe!
endfunc
func s:StoreBufList(buf, l)
let s:bufnr = a:buf
let s:list = a:l
endfunc
func Test_listening_other_buf()
new
call setline(1, ['one', 'two'])
let bufnr = bufnr('')
normal ww
let id = listener_add(function('s:StoreBufList', [bufnr]), bufnr)
let s:list = []
call setbufline(bufnr, 1, 'hello')
redraw
call assert_equal(bufnr, s:bufnr)
call assert_equal([{'lnum': 1, 'end': 2, 'col': 1, 'added': 0}], s:list)
call listener_remove(id)
exe "buf " .. bufnr
bwipe!
endfunc

View File

@ -1491,7 +1491,7 @@ func Test_terminal_all_ansi_colors()
" Use all the ANSI colors.
call writefile([
\ 'call setline(1, "AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPP")',
\ 'call setline(1, "AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPP XXYYZZ")',
\ 'hi Tblack ctermfg=0 ctermbg=8',
\ 'hi Tdarkred ctermfg=1 ctermbg=9',
\ 'hi Tdarkgreen ctermfg=2 ctermbg=10',
@ -1508,6 +1508,9 @@ func Test_terminal_all_ansi_colors()
\ 'hi Tmagenta ctermfg=13 ctermbg=5',
\ 'hi Tcyan ctermfg=14 ctermbg=6',
\ 'hi Twhite ctermfg=15 ctermbg=7',
\ 'hi TdarkredBold ctermfg=1 cterm=bold',
\ 'hi TgreenBold ctermfg=10 cterm=bold',
\ 'hi TmagentaBold ctermfg=13 cterm=bold ctermbg=5',
\ '',
\ 'call matchadd("Tblack", "A")',
\ 'call matchadd("Tdarkred", "B")',
@ -1525,6 +1528,9 @@ func Test_terminal_all_ansi_colors()
\ 'call matchadd("Tmagenta", "N")',
\ 'call matchadd("Tcyan", "O")',
\ 'call matchadd("Twhite", "P")',
\ 'call matchadd("TdarkredBold", "X")',
\ 'call matchadd("TgreenBold", "Y")',
\ 'call matchadd("TmagentaBold", "Z")',
\ 'redraw',
\ ], 'Xcolorscript')
let buf = RunVimInTerminal('-S Xcolorscript', {'rows': 10})

View File

@ -743,6 +743,42 @@ func Test_relative_cursor_second_line_after_resize()
let &so = so_save
endfunc
func Test_split_noscroll()
let so_save = &so
new
only
" Make sure windows can hold all content after split.
for i in range(1, 20)
wincmd +
redraw!
endfor
call setline (1, range(1, 8))
normal 100%
split
1wincmd w
let winid1 = win_getid()
let info1 = getwininfo(winid1)[0]
2wincmd w
let winid2 = win_getid()
let info2 = getwininfo(winid2)[0]
call assert_equal(1, info1.topline)
call assert_equal(1, info2.topline)
" Restore original state.
for i in range(1, 20)
wincmd -
redraw!
endfor
only!
bwipe!
let &so = so_save
endfunc
" Tests for the winnr() function
func Test_winnr()
only | tabonly

View File

@ -3117,7 +3117,6 @@ u_add_time(char_u *buf, size_t buflen, time_t tt)
if (vim_time() - tt >= 100)
{
curtime = localtime(&tt);
# ifdef HAVE_LOCALTIME_R
curtime = localtime_r(&tt, &tmval);
# else

View File

@ -432,16 +432,16 @@ emsg_funcname(char *ermsg, char_u *name)
*/
int
get_func_tv(
char_u *name, /* name of the function */
int len, /* length of "name" */
char_u *name, // name of the function
int len, // length of "name" or -1 to use strlen()
typval_T *rettv,
char_u **arg, /* argument, pointing to the '(' */
linenr_T firstline, /* first line of range */
linenr_T lastline, /* last line of range */
int *doesrange, /* return: function handled range */
char_u **arg, // argument, pointing to the '('
linenr_T firstline, // first line of range
linenr_T lastline, // last line of range
int *doesrange, // return: function handled range
int evaluate,
partial_T *partial, /* for extra arguments */
dict_T *selfdict) /* Dictionary for "self" */
partial_T *partial, // for extra arguments
dict_T *selfdict) // Dictionary for "self"
{
char_u *argp;
int ret = OK;
@ -1435,7 +1435,7 @@ func_call(
}
if (item == NULL)
r = call_func(name, (int)STRLEN(name), rettv, argc, argv, NULL,
r = call_func(name, -1, rettv, argc, argv, NULL,
curwin->w_cursor.lnum, curwin->w_cursor.lnum,
&dummy, TRUE, partial, selfdict);
@ -1458,20 +1458,20 @@ func_call(
*/
int
call_func(
char_u *funcname, /* name of the function */
int len, /* length of "name" */
typval_T *rettv, /* return value goes here */
int argcount_in, /* number of "argvars" */
typval_T *argvars_in, /* vars for arguments, must have "argcount"
PLUS ONE elements! */
char_u *funcname, // name of the function
int len, // length of "name" or -1 to use strlen()
typval_T *rettv, // return value goes here
int argcount_in, // number of "argvars"
typval_T *argvars_in, // vars for arguments, must have "argcount"
// PLUS ONE elements!
int (* argv_func)(int, typval_T *, int),
/* function to fill in argvars */
linenr_T firstline, /* first line of range */
linenr_T lastline, /* last line of range */
int *doesrange, /* return: function handled range */
// function to fill in argvars
linenr_T firstline, // first line of range
linenr_T lastline, // last line of range
int *doesrange, // return: function handled range
int evaluate,
partial_T *partial, /* optional, can be NULL */
dict_T *selfdict_in) /* Dictionary for "self" */
partial_T *partial, // optional, can be NULL
dict_T *selfdict_in) // Dictionary for "self"
{
int ret = FAIL;
int error = ERROR_NONE;
@ -1487,9 +1487,9 @@ call_func(
typval_T argv[MAX_FUNC_ARGS + 1]; /* used when "partial" is not NULL */
int argv_clear = 0;
/* Make a copy of the name, if it comes from a funcref variable it could
* be changed or deleted in the called function. */
name = vim_strnsave(funcname, len);
// Make a copy of the name, if it comes from a funcref variable it could
// be changed or deleted in the called function.
name = len > 0 ? vim_strnsave(funcname, len) : vim_strsave(funcname);
if (name == NULL)
return ret;
@ -3285,7 +3285,7 @@ ex_call(exarg_T *eap)
curwin->w_cursor.coladd = 0;
}
arg = startarg;
if (get_func_tv(name, (int)STRLEN(name), &rettv, &arg,
if (get_func_tv(name, -1, &rettv, &arg,
eap->line1, eap->line2, &doesrange,
!eap->skip, partial, fudi.fd_dict) == FAIL)
{

View File

@ -767,6 +767,36 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1330,
/**/
1329,
/**/
1328,
/**/
1327,
/**/
1326,
/**/
1325,
/**/
1324,
/**/
1323,
/**/
1322,
/**/
1321,
/**/
1320,
/**/
1319,
/**/
1318,
/**/
1317,
/**/
1316,
/**/
1315,
/**/

View File

@ -5827,9 +5827,13 @@ scroll_to_fraction(win_T *wp, int prev_height)
int sline, line_size;
int height = wp->w_height;
// Don't change w_topline when height is zero. Don't set w_topline when
// 'scrollbind' is set and this isn't the current window.
if (height > 0 && (!wp->w_p_scb || wp == curwin))
// Don't change w_topline in any of these cases:
// - window height is 0
// - 'scrollbind' is set and this isn't the current window
// - window height is sufficient to display the whole buffer
if (height > 0
&& (!wp->w_p_scb || wp == curwin)
&& (height < wp->w_buffer->b_ml.ml_line_count))
{
/*
* Find a value for w_topline that shows the cursor at the same