Compare commits

...

29 Commits

Author SHA1 Message Date
Kazuki Sakamoto 5cc2a2b8f8 MacVim Snapshot 117
Binary targets macOS 10.8+

- Vim patch 8.0.0106
- Fixed feedkeys in timer callback
- [Experimental] Automatic Python settings
  - Python 2.7.x: Homebrew python2 or System's
  - Python 3.5.2 or later: Homebrew python3 or python.org binary

Script interfaces have compatibility with these versions

- Lua 5.2
- Perl 5.16
- Python2 2.7
- Python3 3.5.2
- Ruby 2.0
2016-11-30 20:52:28 -08:00
Kazuki Sakamoto 34d4c9f566 Update README_mac.txt for MacVim 2016-11-29 20:58:03 -08:00
Kazuki Sakamoto d05258ea2a Merge remote-tracking branch 'vim/master' 2016-11-29 20:38:44 -08:00
Bram Moolenaar 0945eaface patch 8.0.0106
Problem:    Cannot use a semicolon in 'backupext'. (Jeff)
Solution:   Allow for a few more characters when "secure" isn't set.
2016-11-29 22:10:48 +01:00
Bram Moolenaar 4b785f69c0 patch 8.0.0105
Problem:    When using ch_read() with zero timeout, can't tell the difference
            between reading an empty line and nothing available.
Solution:   Add ch_canread().
2016-11-29 21:54:44 +01:00
Kazuki Sakamoto 1b15a7159b Merge pull request #423 from macvim-dev/experimental/pythonhomeopt
[Experimental] Set pythonhome and pythonthreehome automatically
2016-11-28 22:13:16 -08:00
Kazuki Sakamoto e3e3a15159 Set pythonhome and pythonthreehome automatically
MacVim uses Homebrew python2 if installed, otherwise System's
MacVim uses Homebrew python3 if installed, next try to use python.org binary
2016-11-28 22:10:23 -08:00
Kazuki Sakamoto 16974f80f9 Introduce pythonhome and pythonthreehome options
It is really difficult to set Python home directory properly for Python
2.7 and 3.5 in .vimrc at the same time since both versions use `$PYTHONHOME`
environment variable. Introduce `pythonhome` and `pythonthreehome`
options in order to set Python home directory via `Py_SetPythonHome` API
for both versions.
2016-11-28 20:53:43 -08:00
Kazuki Sakamoto f9248a4311 Merge remote-tracking branch 'vim/master' 2016-11-28 20:51:35 -08:00
Bram Moolenaar f422bcc7f9 patch 8.0.0104
Problem:    Value of 'thesaurus' option not checked properly.
Solution:   Add P_NDNAME flag. (Daisuke Suzuki)
2016-11-26 17:45:53 +01:00
Bram Moolenaar 8a8199e4a1 patch 8.0.0103
Problem:    May not process channel readahead. (skywind)
Solution:   If there is readahead don't block on input.
2016-11-26 15:13:33 +01:00
Bram Moolenaar 7554da4033 patch 8.0.0102
Problem:    Cannot set 'dictionary' to a path.
Solution:   Allow for slash and backslash.  Add a test (partly by Daisuke
            Suzuki, closes #1279, closes #1284)
2016-11-25 22:04:13 +01:00
Bram Moolenaar 031cb743ae patch 8.0.0101
Problem:    Some options are not strictly checked.
Solution:   Add flags for strickter checks.
2016-11-24 21:46:19 +01:00
Bram Moolenaar 319afe3804 patch 8.0.0100
Problem:    Options that are a file name may contain non-filename characters.
Solution:   Check for more invalid characters.
2016-11-24 18:30:59 +01:00
Bram Moolenaar 73095288da patch 8.0.0099
Problem:    Popup menu always appears above the cursor when it is in the lower
            half of the screen. (Matt Gardner)
Solution:   Compute the available space better. (Hirohito Higashi,
            closes #1241)
2016-11-24 17:47:07 +01:00
Bram Moolenaar 58c358753e patch 8.0.0098
Problem:    Can't build on MS-Windows.
Solution:   Add missing parenthesis.
2016-11-24 17:33:17 +01:00
Bram Moolenaar 833eb1d752 patch 8.0.0097
Problem:    When a channel callback consumes a lot of time Vim becomes
            unresponsive. (skywind)
Solution:   Bail out of checking channel readahead after 100 msec.
2016-11-24 17:22:50 +01:00
Bram Moolenaar 2cab0e1910 patch 8.0.0096
Problem:    When the input or output is not a tty Vim appears to hang.
Solution:   Add the --ttyfail argument.  Also add the "ttyin" and "ttyout"
            features to be able to check in Vim script.
2016-11-24 15:09:07 +01:00
Kazuki Sakamoto f7c4ef23fa Merge pull request #417 from ichizok/fix/timer-feedkeys
Fix job/channel/timer handling
2016-11-21 13:05:11 -08:00
Bram Moolenaar 182707ac10 patch 8.0.0095
Problem:    Problems with GTK 3.22.2 fixed in 3.22.4.
Solution:   Adjust the #ifdefs. (Kazunobu Kuriyama)
2016-11-21 20:55:58 +01:00
ichizok c8b6fd59f0 Enable Test_exit_callback_interval() 2016-11-21 23:40:46 +09:00
ichizok 235364e825 Check for jobs and channels more often 2016-11-21 23:40:46 +09:00
ichizok 362a5c0b39 Fix feedkeys in timer callback 2016-11-21 23:40:46 +09:00
Kazuki Sakamoto ca82514bff Merge pull request #416 from macvim-dev/revert-415-fix/py3
Revert "Set Python3 settings automatically"
2016-11-20 22:37:01 -08:00
Kazuki Sakamoto 414abe65f1 Revert "Set Python3 settings automatically" 2016-11-20 22:36:32 -08:00
Kazuki Sakamoto 6cfc463126 Merge pull request #415 from macvim-dev/fix/py3
Set Python3 settings automatically
2016-11-20 22:13:24 -08:00
Kazuki Sakamoto 031dd64ad7 Set Python3 settings automatically
Supports
- Homebrew Python3 (Default)
- https://www.python.org/downloads/mac-osx/
2016-11-20 22:11:00 -08:00
Kazuki Sakamoto c85f864c35 Merge pull request #413 from osheroff/layer_transparency
fixes for transparency + cgLayer code
2016-11-20 19:16:14 -08:00
Ben Osheroff 75c997049e fixes for transparency + cgLayer code 2016-11-20 18:53:50 -08:00
31 changed files with 440 additions and 131 deletions
+5 -30
View File
@@ -1,38 +1,13 @@
README_mac.txt for version 8.0 of Vim: Vi IMproved.
This file explains the installation of MacVim.
See "README.txt" for general information about Vim.
See "src/MacVim/README" for an overview of the MacVim specific source code.
MacVim uses the usual configure/make steps to build the binary but instead of
"make install" you just drag the app bundle into the directory you wish to
install in (usually `/Applications').
How to build and install
How to install MacVim?
========================
Run `./configure` in the `src/` directory with the flags you want (call
`./configure --help` to see a list of flags) e.g.:
Download MacVim.dmg from latest binary release page https://github.com/macvim-dev/macvim/releases/latest , open the dmg file, and copy MacVim.app to /Applications.
$ cd src
$ ./configure --with-features=huge \
--enable-rubyinterp \
--enable-pythoninterp \
--enable-perlinterp \
--enable-cscope
Now build the project using `make`:
Questions?
========================
$ make
Please take a look at the home page http://macvim-dev.github.io/macvim/
The resulting app bundle will reside under `MacVim/build/Release`. To try it
out quickly, type:
$ open MacVim/build/Release/MacVim.app
To install MacVim, type
$ open MacVim/build/Release
and drag the MacVim icon into your `Applications` folder.
+10 -1
View File
@@ -418,7 +418,11 @@ This uses the channel timeout. To read without a timeout, just get any
message that is available: >
let output = ch_read(channel, {'timeout': 0})
When no message was available then the result is v:none for a JSON or JS mode
channels, an empty string for a RAW or NL channel.
channels, an empty string for a RAW or NL channel. You can use |ch_canread()|
to check if there is something to read.
Note that when there is no callback message are dropped. To avoid that add a
close callback to the channel.
To read all output from a RAW channel that is available: >
let output = ch_readraw(channel)
@@ -470,6 +474,11 @@ This depends on the system (on Unix this happens because closing the write end
of a pipe causes the read end to get EOF). To avoid this make the job sleep
for a short while before it exits.
Note that if the job exits before you read the output, the output may be lost.
This depends on the system (on Unix this happens because closing the write end
of a pipe causes the read end to get EOF). To avoid this make the job sleep
for a short while before it exits.
The handler defined for "out_cb" will not receive stderr. If you want to
handle that separately, add an "err_cb" handler: >
let job = job_start(command, {"out_cb": "MyHandler",
+24 -9
View File
@@ -2009,6 +2009,7 @@ byteidxcomp({expr}, {nr}) Number byte index of {nr}'th char in {expr}
call({func}, {arglist} [, {dict}])
any call {func} with arguments {arglist}
ceil({expr}) Float round {expr} up
ch_canread({handle}) Number check if there is something to read
ch_close({handle}) none close {handle}
ch_close_in({handle}) none close in part of {handle}
ch_evalexpr({handle}, {expr} [, {options}])
@@ -2980,16 +2981,28 @@ confirm({msg} [, {choices} [, {default} [, {type}]]])
don't fit, a vertical layout is used anyway. For some systems
the horizontal layout is always used.
ch_canread({handle}) *ch_canread()*
Return non-zero when there is something to read from {handle}.
{handle} can be a Channel or a Job that has a Channel.
This is useful to read from a channel at a convenient time,
e.g. from a timer.
Note that messages are dropped when the channel does not have
a callback. Add a close callback to avoid that.
{only available when compiled with the |+channel| feature}
ch_close({handle}) *ch_close()*
Close {handle}. See |channel-close|.
{handle} can be Channel or a Job that has a Channel.
{handle} can be a Channel or a Job that has a Channel.
A close callback is not invoked.
{only available when compiled with the |+channel| feature}
ch_close_in({handle}) *ch_close_in()*
Close the "in" part of {handle}. See |channel-close-in|.
{handle} can be Channel or a Job that has a Channel.
{handle} can be a Channel or a Job that has a Channel.
A close callback is not invoked.
{only available when compiled with the |+channel| feature}
@@ -2998,7 +3011,7 @@ ch_evalexpr({handle}, {expr} [, {options}]) *ch_evalexpr()*
Send {expr} over {handle}. The {expr} is encoded
according to the type of channel. The function cannot be used
with a raw channel. See |channel-use|.
{handle} can be Channel or a Job that has a Channel.
{handle} can be a Channel or a Job that has a Channel.
*E917*
{options} must be a Dictionary. It must not have a "callback"
entry. It can have a "timeout" entry to specify the timeout
@@ -3012,7 +3025,7 @@ ch_evalexpr({handle}, {expr} [, {options}]) *ch_evalexpr()*
ch_evalraw({handle}, {string} [, {options}]) *ch_evalraw()*
Send {string} over {handle}.
{handle} can be Channel or a Job that has a Channel.
{handle} can be a Channel or a Job that has a Channel.
Works like |ch_evalexpr()|, but does not encode the request or
decode the response. The caller is responsible for the
@@ -3025,7 +3038,7 @@ ch_evalraw({handle}, {string} [, {options}]) *ch_evalraw()*
ch_getbufnr({handle}, {what}) *ch_getbufnr()*
Get the buffer number that {handle} is using for {what}.
{handle} can be Channel or a Job that has a Channel.
{handle} can be a Channel or a Job that has a Channel.
{what} can be "err" for stderr, "out" for stdout or empty for
socket output.
Returns -1 when there is no buffer.
@@ -3099,7 +3112,7 @@ ch_open({address} [, {options}]) *ch_open()*
ch_read({handle} [, {options}]) *ch_read()*
Read from {handle} and return the received message.
{handle} can be Channel or a Job that has a Channel.
{handle} can be a Channel or a Job that has a Channel.
See |channel-more|.
{only available when compiled with the |+channel| feature}
@@ -3113,7 +3126,7 @@ ch_sendexpr({handle}, {expr} [, {options}]) *ch_sendexpr()*
according to the type of channel. The function cannot be used
with a raw channel.
See |channel-use|. *E912*
{handle} can be Channel or a Job that has a Channel.
{handle} can be a Channel or a Job that has a Channel.
{only available when compiled with the |+channel| feature}
@@ -3134,7 +3147,7 @@ ch_setoptions({handle}, {options}) *ch_setoptions()*
"timeout" default read timeout in msec
"mode" mode for the whole channel
See |ch_open()| for more explanation.
{handle} can be Channel or a Job that has a Channel.
{handle} can be a Channel or a Job that has a Channel.
Note that changing the mode may cause queued messages to be
lost.
@@ -3148,7 +3161,7 @@ ch_status({handle} [, {options}]) *ch_status()*
"open" channel can be used
"buffered" channel can be read, not written to
"closed" channel can not be used
{handle} can be Channel or a Job that has a Channel.
{handle} can be a Channel or a Job that has a Channel.
"buffered" is used when the channel was closed but there is
still data that can be obtained with |ch_read()|.
@@ -8420,6 +8433,8 @@ timers Compiled with |timer_start()| support.
title Compiled with window title support |'title'|.
toolbar Compiled with support for |gui-toolbar|.
transparency Compiled with 'transparency' support.
ttyin input is a terminal (tty)
ttyout output is a terminal (tty)
unix Unix version of Vim.
user_commands User-defined commands.
vertsplit Compiled with vertically split windows |:vsplit|.
+30
View File
@@ -5921,6 +5921,21 @@ A jump table for the options with a short description can be found at |Q_op|.
DYNAMIC_PYTHON_DLL, which was specified at compile time.
Environment variables are expanded |:set_env|.
This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons.
*'pythonhome'*
'pythonhome' string (default "")
global
{not in Vi}
{only available when compiled with the |+python/dyn|
feature}
Note: EXPERIMENTAL. It may be changed or removed in the future.
Specifies the name of the Python 2.x home directory. When 'pythonhome'
and the PYTHONHOME environment variable are not set, PYTHON_HOME,
which was specified at compile time, will be used for the Python 2.x
home directory.
Environment variables are expanded |:set_env|.
This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons.
*'pythonthreedll'*
@@ -5933,6 +5948,21 @@ A jump table for the options with a short description can be found at |Q_op|.
DYNAMIC_PYTHON3_DLL, which was specified at compile time.
Environment variables are expanded |:set_env|.
This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons.
*'pythonthreehome'*
'pythonthreehome' string (default "")
global
{not in Vi}
{only available when compiled with the |+python3/dyn|
feature}
Note: EXPERIMENTAL. It may be changed or removed in the future.
Specifies the name of the Python 3 home directory. When
'pythonthreehome' and the PYTHONHOME environment variable are not set,
PYTHON3_HOME, which was specified at compile time, will be used for
the Python 3 home directory.
Environment variables are expanded |:set_env|.
This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons.
*'quoteescape'* *'qe'*
+2
View File
@@ -840,7 +840,9 @@ Short explanation of each option: *option-list*
'prompt' 'prompt' enable prompt in Ex mode
'pumheight' 'ph' maximum height of the popup menu
'pythondll' name of the Python 2 dynamic library
'pythonhome' name of the Python 2 home directory
'pythonthreedll' name of the Python 3 dynamic library
'pythonthreehome' name of the Python 3 home directory
'quoteescape' 'qe' escape characters used in a string
'readonly' 'ro' disallow writing the buffer
'redrawtime' 'rdt' timeout for 'hlsearch' and |:match| highlighting
+4
View File
@@ -421,6 +421,10 @@ a slash. Thus "-R" means recovery and "-/R" readonly.
not connected to a terminal. This will avoid the warning and
the two second delay that would happen. {not in Vi}
*--ttyfail*
--ttyfail When the stdin or stdout is not a terminal (tty) then exit
right away.
*-d*
-d Start in diff mode, like |vimdiff|.
{not in Vi} {not available when compiled without the |+diff|
+8
View File
@@ -1345,10 +1345,18 @@ if exists("&pythondll")
call append("$", "pythondll\tname of the Python 2 dynamic library")
call <SID>OptionG("pythondll", &pythondll)
endif
if exists("&pythonhome")
call append("$", "pythonhome\tname of the Python 2 home directory")
call <SID>OptionG("pythonhome", &pythonhome)
endif
if exists("&pythonthreedll")
call append("$", "pythonthreedll\tname of the Python 3 dynamic library")
call <SID>OptionG("pythonthreedll", &pythonthreedll)
endif
if exists("&pythonthreehome")
call append("$", "pythonthreehome\tname of the Python 3 home directory")
call <SID>OptionG("pythonthreehome", &pythonthreehome)
endif
if exists("&rubydll")
call append("$", "rubydll\tname of the Ruby dynamic library")
call <SID>OptionG("rubydll", &rubydll)
+1 -1
View File
@@ -1255,7 +1255,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>116</string>
<string>117</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
+40 -1
View File
@@ -198,6 +198,9 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
#ifdef FEAT_BEVAL
- (void)bevalCallback:(id)sender;
#endif
#ifdef MESSAGE_QUEUE
- (void)checkForProcessEvents:(NSTimer *)timer;
#endif
@end
@@ -679,13 +682,26 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
// Only start the run loop if the input queue is empty, otherwise process
// the input first so that the input on queue isn't delayed.
if ([inputQueue count]) {
if ([inputQueue count] || input_available()) {
inputReceived = YES;
} else {
// Wait for the specified amount of time, unless 'milliseconds' is
// negative in which case we wait "forever" (1e6 seconds translates to
// approximately 11 days).
CFTimeInterval dt = (milliseconds >= 0 ? .001*milliseconds : 1e6);
NSTimer *timer = nil;
// Set interval timer which checks for the events of job and channel
// when there is any pending job or channel.
if (dt > 0.1 && (has_any_channel() || has_pending_job())) {
timer = [NSTimer scheduledTimerWithTimeInterval:0.1
target:self
selector:@selector(checkForProcessEvents:)
userInfo:nil
repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:timer
forMode:NSDefaultRunLoopMode];
}
while (CFRunLoopRunInMode(kCFRunLoopDefaultMode, dt, true)
== kCFRunLoopRunHandledSource) {
@@ -695,6 +711,11 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
dt = 0.0;
inputReceived = YES;
}
if (input_available())
inputReceived = YES;
[timer invalidate];
}
// The above calls may have placed messages on the input queue so process
@@ -3004,6 +3025,24 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
}
#endif
#ifdef MESSAGE_QUEUE
- (void)checkForProcessEvents:(NSTimer *)timer
{
# ifdef FEAT_TIMERS
did_add_timer = FALSE;
# endif
parse_queued_messages();
if (input_available()
# ifdef FEAT_TIMERS
|| did_add_timer
# endif
)
CFRunLoopStop(CFRunLoopGetCurrent());
}
#endif
@end // MMBackend (Private)
+6 -1
View File
@@ -607,7 +607,11 @@ defaultAdvanceForFont(NSFont *font)
cgLayerSize.width,
cgLayerSize.height);
CGContextDrawLayerInRect([context graphicsPort], drawRect, l);
CGContextRef cgContext = [context graphicsPort];
CGContextSaveGState(cgContext);
CGContextSetBlendMode(cgContext, kCGBlendModeCopy);
CGContextDrawLayerInRect(cgContext, drawRect, l);
CGContextRestoreGState(cgContext);
}
}
@@ -1487,6 +1491,7 @@ recurseDraw(const unichar *chars, CGGlyph *glyphs, CGPoint *positions,
// draw self on top of self, offset so as to "scroll" lines vertically
CGContextSaveGState(context);
CGContextClipToRect(context, clipRect);
CGContextSetBlendMode(context, kCGBlendModeCopy);
CGContextDrawLayerAtPoint(
context, CGPointMake(0, -yOffset), [self getCGLayer]);
CGContextRestoreGState(context);
+22
View File
@@ -13,3 +13,25 @@ set backspace+=indent,eol,start
" the entire MacVim menu is set up in a nib file which currently only is
" translated to English).
set langmenu=none
" Python2
" MacVim uses Homebrew python2 if installed, otherwise configured one
if exists("&pythondll") && exists("&pythonhome")
if filereadable("/usr/local/Frameworks/Python.framework/Versions/2.7/Python")
" Homebrew python 2.7
set pythondll=/usr/local/Frameworks/Python.framework/Versions/2.7/Python
set pythonhome=/usr/local/Frameworks/Python.framework/Versions/2.7
endif
endif
" Python3
" MacVim uses Homebrew python3 if installed, next try to use python.org binary
if exists("&pythonthreedll") && exists("&pythonthreehome") &&
\ !filereadable(&pythonthreedll)
if filereadable("/Library/Frameworks/Python.framework/Versions/3.5/Python")
" https://www.python.org/downloads/mac-osx/
set pythonthreedll=/Library/Frameworks/Python.framework/Versions/3.5/Python
set pythonthreehome=/Library/Frameworks/Python.framework/Versions/3.5
endif
endif
+39 -2
View File
@@ -2624,7 +2624,7 @@ channel_is_open(channel_T *channel)
/*
* Return TRUE if "channel" has JSON or other typeahead.
*/
static int
int
channel_has_readahead(channel_T *channel, ch_part_T part)
{
ch_mode_T ch_mode = channel->ch_part[part].ch_mode;
@@ -3840,6 +3840,11 @@ channel_parse_messages(void)
int ret = FALSE;
int r;
ch_part_T part = PART_SOCK;
#ifdef ELAPSED_FUNC
ELAPSED_TYPE start_tv;
ELAPSED_INIT(start_tv);
#endif
++safe_to_invoke_callback;
@@ -3884,7 +3889,14 @@ channel_parse_messages(void)
r = may_invoke_callback(channel, part);
if (r == OK)
ret = TRUE;
if (channel_unref(channel) || r == OK)
if (channel_unref(channel) || (r == OK
#ifdef ELAPSED_FUNC
/* Limit the time we loop here to 100 msec, otherwise
* Vim becomes unresponsive when the callback takes
* more than a bit of time. */
&& ELAPSED_FUNC(start_tv) < 100L
#endif
))
{
/* channel was freed or something was done, start over */
channel = first_channel;
@@ -3912,6 +3924,31 @@ channel_parse_messages(void)
return ret;
}
/*
* Return TRUE if any channel has readahead. That means we should not block on
* waiting for input.
*/
int
channel_any_readahead(void)
{
channel_T *channel = first_channel;
ch_part_T part = PART_SOCK;
while (channel != NULL)
{
if (channel_has_readahead(channel, part))
return TRUE;
if (part < PART_ERR)
++part;
else
{
channel = channel->ch_next;
part = PART_SOCK;
}
}
return FALSE;
}
/*
* Mark references to lists used in channels.
*/
+21
View File
@@ -76,6 +76,7 @@ static void f_call(typval_T *argvars, typval_T *rettv);
static void f_ceil(typval_T *argvars, typval_T *rettv);
#endif
#ifdef FEAT_JOB_CHANNEL
static void f_ch_canread(typval_T *argvars, typval_T *rettv);
static void f_ch_close(typval_T *argvars, typval_T *rettv);
static void f_ch_close_in(typval_T *argvars, typval_T *rettv);
static void f_ch_evalexpr(typval_T *argvars, typval_T *rettv);
@@ -499,6 +500,7 @@ static struct fst
{"ceil", 1, 1, f_ceil},
#endif
#ifdef FEAT_JOB_CHANNEL
{"ch_canread", 1, 1, f_ch_canread},
{"ch_close", 1, 1, f_ch_close},
{"ch_close_in", 1, 1, f_ch_close_in},
{"ch_evalexpr", 2, 3, f_ch_evalexpr},
@@ -1778,6 +1780,21 @@ f_ceil(typval_T *argvars, typval_T *rettv)
#endif
#ifdef FEAT_JOB_CHANNEL
/*
* "ch_canread()" function
*/
static void
f_ch_canread(typval_T *argvars, typval_T *rettv)
{
channel_T *channel = get_channel_arg(&argvars[0], TRUE, TRUE, 0);
rettv->vval.v_number = 0;
if (channel != NULL)
rettv->vval.v_number = channel_has_readahead(channel, PART_SOCK)
|| channel_has_readahead(channel, PART_OUT)
|| channel_has_readahead(channel, PART_ERR);
}
/*
* "ch_close()" function
*/
@@ -5978,6 +5995,10 @@ f_has(typval_T *argvars, typval_T *rettv)
}
else if (STRICMP(name, "vim_starting") == 0)
n = (starting != 0);
else if (STRICMP(name, "ttyin") == 0)
n = mch_input_isatty();
else if (STRICMP(name, "ttyout") == 0)
n = stdout_isatty;
#ifdef FEAT_MBYTE
else if (STRICMP(name, "multi_byte_encoding") == 0)
n = has_mbyte;
+2
View File
@@ -643,6 +643,8 @@ EXTERN int exiting INIT(= FALSE);
EXTERN int really_exiting INIT(= FALSE);
/* TRUE when we are sure to exit, e.g., after
* a deadly signal */
EXTERN int stdout_isatty INIT(= TRUE); /* is stdout a terminal? */
#if defined(FEAT_AUTOCHDIR)
EXTERN int test_autochdir INIT(= FALSE);
#endif
+10 -2
View File
@@ -3102,7 +3102,7 @@ drawarea_configure_event_cb(GtkWidget *widget,
g_return_val_if_fail(event
&& event->width >= 1 && event->height >= 1, TRUE);
# if GTK_CHECK_VERSION(3,22,2)
# if GTK_CHECK_VERSION(3,22,2) && !GTK_CHECK_VERSION(3,22,4)
/* As of 3.22.2, GdkWindows have started distributing configure events to
* their "native" children (https://git.gnome.org/browse/gtk+/commit/?h=gtk-3-22&id=12579fe71b3b8f79eb9c1b80e429443bcc437dd0).
*
@@ -3123,6 +3123,10 @@ drawarea_configure_event_cb(GtkWidget *widget,
* implementation details. Therefore, watch out any relevant internal
* changes happening in GTK in the feature (sigh).
*/
/* Follow-up
* After a few weeks later, the GdkWindow change mentioned above was
* reverted (https://git.gnome.org/browse/gtk+/commit/?h=gtk-3-22&id=f70039cb9603a02d2369fec4038abf40a1711155).
* The corresponding official release is 3.22.4. */
if (event->send_event == FALSE)
return TRUE;
# endif
@@ -4492,7 +4496,7 @@ form_configure_event(GtkWidget *widget UNUSED,
{
int usable_height = event->height;
#if GTK_CHECK_VERSION(3,22,2)
#if GTK_CHECK_VERSION(3,22,2) && !GTK_CHECK_VERSION(3,22,4)
/* As of 3.22.2, GdkWindows have started distributing configure events to
* their "native" children (https://git.gnome.org/browse/gtk+/commit/?h=gtk-3-22&id=12579fe71b3b8f79eb9c1b80e429443bcc437dd0).
*
@@ -4508,6 +4512,10 @@ form_configure_event(GtkWidget *widget UNUSED,
* To filter out such fallacious events, check if the given event is the
* one that was sent out to the right place. Ignore it if not.
*/
/* Follow-up
* After a few weeks later, the GdkWindow change mentioned above was
* reverted (https://git.gnome.org/browse/gtk+/commit/?h=gtk-3-22&id=f70039cb9603a02d2369fec4038abf40a1711155).
* The corresponding official release is 3.22.4. */
if (event->window != gtk_widget_get_window(gui.formwin))
return TRUE;
#endif
+9 -5
View File
@@ -933,13 +933,17 @@ Python_Init(void)
EMSG(_("E263: Sorry, this command is disabled, the Python library could not be loaded."));
goto fail;
}
#endif
#ifdef PYTHON_HOME
# ifdef DYNAMIC_PYTHON
if (mch_getenv((char_u *)"PYTHONHOME") == NULL)
# endif
if (p_pyhome && *p_pyhome != '\0')
Py_SetPythonHome((char *)p_pyhome);
# ifdef PYTHON_HOME
else if (mch_getenv((char_u *)"PYTHONHOME") == NULL)
Py_SetPythonHome(PYTHON_HOME);
# endif
#else
# ifdef PYTHON_HOME
Py_SetPythonHome(PYTHON_HOME);
# endif
#endif
init_structs();
+18 -5
View File
@@ -860,12 +860,25 @@ Python3_Init(void)
init_structs();
#ifdef PYTHON3_HOME
# ifdef DYNAMIC_PYTHON3
if (mch_getenv((char_u *)"PYTHONHOME") == NULL)
# endif
#ifdef DYNAMIC_PYTHON3
if (p_py3home && *p_py3home != '\0')
{
int len;
wchar_t *buf;
len = mbstowcs(NULL, (char *)p_py3home, 0) + 1;
buf = (wchar_t *)alloc(len * sizeof(wchar_t));
if (buf && mbstowcs(buf, (char *)p_py3home, len) != (size_t)-1)
Py_SetPythonHome(buf);
vim_free(buf);
}
# ifdef PYTHON3_HOME
else if (mch_getenv((char_u *)"PYTHONHOME") == NULL)
Py_SetPythonHome(PYTHON3_HOME);
# endif
#else
# ifdef PYTHON3_HOME
Py_SetPythonHome(PYTHON3_HOME);
# endif
#endif
PyImport_AppendInittab("vim", Py3Init_vim);
+10 -4
View File
@@ -1036,7 +1036,7 @@ common_init(mparm_T *paramp)
* (needed for :! to * work). mch_check_win() will also handle the -d or
* -dev argument.
*/
paramp->stdout_isatty = (mch_check_win(paramp->argc, paramp->argv) != FAIL);
stdout_isatty = (mch_check_win(paramp->argc, paramp->argv) != FAIL);
TIME_MSG("window checked");
/*
@@ -1906,6 +1906,7 @@ command_line_scan(mparm_T *parmp)
/* "--literal" take files literally */
/* "--nofork" don't fork */
/* "--not-a-term" don't warn for not a term */
/* "--ttyfail" exit if not a term */
/* "--noplugin[s]" skip plugins */
/* "--cmd <cmd>" execute cmd before vimrc */
if (STRICMP(argv[0] + argv_idx, "help") == 0)
@@ -1935,6 +1936,8 @@ command_line_scan(mparm_T *parmp)
p_lpl = FALSE;
else if (STRNICMP(argv[0] + argv_idx, "not-a-term", 10) == 0)
parmp->not_a_term = TRUE;
else if (STRNICMP(argv[0] + argv_idx, "ttyfail", 7) == 0)
parmp->tty_fail = TRUE;
else if (STRNICMP(argv[0] + argv_idx, "cmd", 3) == 0)
{
want_argument = TRUE;
@@ -2573,7 +2576,7 @@ check_tty(mparm_T *parmp)
if (!input_isatty)
silent_mode = TRUE;
}
else if (parmp->want_full_screen && (!parmp->stdout_isatty || !input_isatty)
else if (parmp->want_full_screen && (!stdout_isatty || !input_isatty)
#ifdef FEAT_GUI
/* don't want the delay when started from the desktop */
&& !gui.starting
@@ -2588,7 +2591,7 @@ check_tty(mparm_T *parmp)
* input buffer so fast I can't even kill the process in under 2
* minutes (and it beeps continuously the whole time :-)
*/
if (netbeans_active() && (!parmp->stdout_isatty || !input_isatty))
if (netbeans_active() && (!stdout_isatty || !input_isatty))
{
mch_errmsg(_("Vim: Error: Failure to start gvim from NetBeans\n"));
exit(1);
@@ -2601,11 +2604,13 @@ check_tty(mparm_T *parmp)
exit(1);
}
#endif
if (!parmp->stdout_isatty)
if (!stdout_isatty)
mch_errmsg(_("Vim: Warning: Output is not to a terminal\n"));
if (!input_isatty)
mch_errmsg(_("Vim: Warning: Input is not from a terminal\n"));
out_flush();
if (parmp->tty_fail && (!stdout_isatty || !input_isatty))
exit(1);
if (scriptin[0] == NULL)
ui_delay(2000L, TRUE);
TIME_MSG("Warning delay");
@@ -3371,6 +3376,7 @@ usage(void)
#endif
main_msg(_("-T <terminal>\tSet terminal type to <terminal>"));
main_msg(_("--not-a-term\t\tSkip warning for input/output not being a terminal"));
main_msg(_("--ttyfail\t\tExit if input or output is not a terminal"));
main_msg(_("-u <vimrc>\t\tUse <vimrc> instead of any .vimrc"));
#ifdef FEAT_GUI
main_msg(_("-U <gvimrc>\t\tUse <gvimrc> instead of any .gvimrc"));
+28
View File
@@ -6269,3 +6269,31 @@ parse_queued_messages(void)
# endif
}
#endif
#ifdef ELAPSED_TIMEVAL /* no PROTO here, proto is defined in vim.h */
/*
* Return time in msec since "start_tv".
*/
long
elapsed(struct timeval *start_tv)
{
struct timeval now_tv;
gettimeofday(&now_tv, NULL);
return (now_tv.tv_sec - start_tv->tv_sec) * 1000L
+ (now_tv.tv_usec - start_tv->tv_usec) / 1000L;
}
#endif
#ifdef ELAPSED_TICKCOUNT
/*
* Return time in msec since "start_tick".
*/
long
elapsed(DWORD start_tick)
{
DWORD now = GetTickCount();
return (long)now - (long)start_tick;
}
#endif
+31 -16
View File
@@ -458,10 +458,11 @@ struct vimoption
#define P_NFNAME 0x400000L /* only normal file name chars allowed */
#define P_INSECURE 0x800000L /* option was set from a modeline */
#define P_PRI_MKRC 0x1000000L /* priority for :mkvimrc (setting option has
side effects) */
side effects) */
#define P_NO_ML 0x2000000L /* not allowed in modeline */
#define P_CURSWANT 0x4000000L /* update curswant required; not needed when
* there is a redraw flag */
#define P_NDNAME 0x8000000L /* only normal dir name chars allowed */
#define ISK_LATIN1 (char_u *)"@,48-57,_,192-255"
@@ -1004,7 +1005,7 @@ static struct vimoption options[] =
(char_u *)NULL, PV_NONE,
#endif
{(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
{"dictionary", "dict", P_STRING|P_EXPAND|P_VI_DEF|P_ONECOMMA|P_NODUP,
{"dictionary", "dict", P_STRING|P_EXPAND|P_VI_DEF|P_ONECOMMA|P_NODUP|P_NDNAME,
#ifdef FEAT_INS_EXPAND
(char_u *)&p_dict, PV_DICT,
#else
@@ -2111,7 +2112,7 @@ static struct vimoption options[] =
{(char_u *)NULL, (char_u *)0L}
#endif
SCRIPTID_INIT},
{"printexpr", "pexpr", P_STRING|P_VI_DEF,
{"printexpr", "pexpr", P_STRING|P_VI_DEF|P_SECURE,
#ifdef FEAT_POSTSCRIPT
(char_u *)&p_pexpr, PV_NONE,
{(char_u *)"", (char_u *)0L}
@@ -2186,12 +2187,20 @@ static struct vimoption options[] =
(char_u *)&p_py3dll, PV_NONE,
{(char_u *)DYNAMIC_PYTHON3_DLL, (char_u *)0L}
SCRIPTID_INIT},
{"pythonthreehome", NULL, P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
(char_u *)&p_py3home, PV_NONE,
{(char_u *)NULL, (char_u *)0L}
SCRIPTID_INIT},
#endif
#if defined(DYNAMIC_PYTHON)
{"pythondll", NULL, P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
(char_u *)&p_pydll, PV_NONE,
{(char_u *)DYNAMIC_PYTHON_DLL, (char_u *)0L}
SCRIPTID_INIT},
{"pythonhome", NULL, P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
(char_u *)&p_pyhome, PV_NONE,
{(char_u *)NULL, (char_u *)0L}
SCRIPTID_INIT},
#endif
{"quoteescape", "qe", P_STRING|P_ALLOCED|P_VI_DEF,
#ifdef FEAT_TEXTOBJ
@@ -2712,7 +2721,7 @@ static struct vimoption options[] =
{"textwidth", "tw", P_NUM|P_VI_DEF|P_VIM|P_RBUF,
(char_u *)&p_tw, PV_TW,
{(char_u *)0L, (char_u *)0L} SCRIPTID_INIT},
{"thesaurus", "tsr", P_STRING|P_EXPAND|P_VI_DEF|P_ONECOMMA|P_NODUP,
{"thesaurus", "tsr", P_STRING|P_EXPAND|P_VI_DEF|P_ONECOMMA|P_NODUP|P_NDNAME,
#ifdef FEAT_INS_EXPAND
(char_u *)&p_tsr, PV_TSR,
#else
@@ -5961,11 +5970,15 @@ did_set_string_option(
errmsg = e_secure;
}
/* Check for a "normal" file name in some options. Disallow a path
* separator (slash and/or backslash), wildcards and characters that are
* often illegal in a file name. */
else if ((options[opt_idx].flags & P_NFNAME)
&& vim_strpbrk(*varp, (char_u *)"/\\*?[|<>") != NULL)
/* Check for a "normal" directory or file name in some options. Disallow a
* path separator (slash and/or backslash), wildcards and characters that
* are often illegal in a file name. Be more permissive if "secure" is off.
*/
else if (((options[opt_idx].flags & P_NFNAME)
&& vim_strpbrk(*varp, (char_u *)(secure
? "/\\*?[|;&<>\r\n" : "/\\*?[<>\r\n")) != NULL)
|| ((options[opt_idx].flags & P_NDNAME)
&& vim_strpbrk(*varp, (char_u *)"*?[|;&<>\r\n") != NULL))
{
errmsg = e_invarg;
}
@@ -7111,6 +7124,7 @@ did_set_string_option(
#if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32)
/* 'toolbar' */
else if (varp == &p_toolbar)
{
if (opt_strings_flags(p_toolbar, p_toolbar_values,
@@ -7335,6 +7349,7 @@ did_set_string_option(
#endif
#if defined(FEAT_RENDER_OPTIONS)
/* 'renderoptions' */
else if (varp == &p_rop && gui.in_use)
{
if (!gui_mch_set_rendering_options(p_rop))
@@ -7362,19 +7377,19 @@ did_set_string_option(
else
{
p = NULL;
if (varp == &p_ww)
if (varp == &p_ww) /* 'whichwrap' */
p = (char_u *)WW_ALL;
if (varp == &p_shm)
if (varp == &p_shm) /* 'shortmess' */
p = (char_u *)SHM_ALL;
else if (varp == &(p_cpo))
else if (varp == &(p_cpo)) /* 'cpoptions' */
p = (char_u *)CPO_ALL;
else if (varp == &(curbuf->b_p_fo))
else if (varp == &(curbuf->b_p_fo)) /* 'formatoptions' */
p = (char_u *)FO_ALL;
#ifdef FEAT_CONCEAL
else if (varp == &curwin->w_p_cocu)
else if (varp == &curwin->w_p_cocu) /* 'concealcursor' */
p = (char_u *)COCU_ALL;
#endif
else if (varp == &p_mouse)
else if (varp == &p_mouse) /* 'mouse' */
{
#ifdef FEAT_MOUSE
p = (char_u *)MOUSE_ALL;
@@ -7384,7 +7399,7 @@ did_set_string_option(
#endif
}
#if defined(FEAT_GUI)
else if (varp == &p_go)
else if (varp == &p_go) /* 'guioptions' */
p = (char_u *)GO_ALL;
#endif
if (p != NULL)
+2
View File
@@ -706,9 +706,11 @@ EXTERN char_u *p_perldll; /* 'perldll' */
#endif
#if defined(DYNAMIC_PYTHON3)
EXTERN char_u *p_py3dll; /* 'pythonthreedll' */
EXTERN char_u *p_py3home; /* 'pythonthreehome' */
#endif
#if defined(DYNAMIC_PYTHON)
EXTERN char_u *p_pydll; /* 'pythondll' */
EXTERN char_u *p_pyhome; /* 'pythonhome' */
#endif
#ifdef FEAT_RELTIME
EXTERN long p_rdt; /* 'redrawtime' */
+30 -44
View File
@@ -376,21 +376,6 @@ mch_write(char_u *s, int len)
RealWaitForChar(read_cmd_fd, p_wd, NULL, NULL);
}
#if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
/*
* Return time in msec since "start_tv".
*/
static long
elapsed(struct timeval *start_tv)
{
struct timeval now_tv;
gettimeofday(&now_tv, NULL);
return (now_tv.tv_sec - start_tv->tv_sec) * 1000L
+ (now_tv.tv_usec - start_tv->tv_usec) / 1000L;
}
#endif
/*
* mch_inchar(): low level input function.
* Get a characters from the keyboard.
@@ -411,10 +396,10 @@ mch_inchar(
int did_start_blocking = FALSE;
long wait_time;
long elapsed_time = 0;
#if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
struct timeval start_tv;
#ifdef ELAPSED_FUNC
ELAPSED_TYPE start_tv;
gettimeofday(&start_tv, NULL);
ELAPSED_INIT(start_tv);
#endif
/* repeat until we got a character or waited long enough */
@@ -438,8 +423,8 @@ mch_inchar(
else
/* going to block after p_ut */
wait_time = p_ut;
#if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
elapsed_time = elapsed(&start_tv);
#ifdef ELAPSED_FUNC
elapsed_time = ELAPSED_FUNC(start_tv);
#endif
wait_time -= elapsed_time;
if (wait_time < 0)
@@ -477,6 +462,10 @@ mch_inchar(
/* Checking if a job ended requires polling. Do this every 100 msec. */
if (has_pending_job() && (wait_time < 0 || wait_time > 100L))
wait_time = 100L;
/* If there is readahead then parse_queued_messages() timed out and we
* should call it again soon. */
if ((wait_time < 0 || wait_time > 100L) && channel_any_readahead())
wait_time = 10L;
#endif
/*
@@ -1554,18 +1543,16 @@ mch_input_isatty(void)
#ifdef FEAT_X11
# if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) \
# if defined(ELAPSED_TIMEVAL) \
&& (defined(FEAT_XCLIPBOARD) || defined(FEAT_TITLE))
static void xopen_message(struct timeval *start_tv);
/*
* Give a message about the elapsed time for opening the X window.
*/
static void
xopen_message(struct timeval *start_tv)
xopen_message(long elapsed_msec)
{
smsg((char_u *)_("Opening the X display took %ld msec"), elapsed(start_tv));
smsg((char_u *)_("Opening the X display took %ld msec"), elapsed_msec);
}
# endif
#endif
@@ -1864,11 +1851,11 @@ get_x11_windis(void)
#endif
if (x11_display != NULL)
{
# if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
# ifdef ELAPSED_FUNC
if (p_verbose > 0)
{
verbose_enter();
xopen_message(&start_tv);
xopen_message(ELAPSED_FUNC(start_tv));
verbose_leave();
}
# endif
@@ -4648,8 +4635,8 @@ mch_call_shell(
ga_init2(&ga, 1, BUFLEN);
noread_cnt = 0;
# if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
gettimeofday(&start_tv, NULL);
# ifdef ELAPSED_FUNC
ELAPSED_INIT(start_tv);
# endif
for (;;)
{
@@ -4684,8 +4671,8 @@ mch_call_shell(
/* Get extra characters when we don't have any.
* Reset the counter and timer. */
noread_cnt = 0;
# if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
gettimeofday(&start_tv, NULL);
# ifdef ELAPSED_FUNC
ELAPSED_INIT(start_tv);
# endif
len = ui_inchar(ta_buf, BUFLEN, 10L, 0);
}
@@ -4908,10 +4895,10 @@ mch_call_shell(
if (got_int)
break;
# if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
# ifdef ELAPSED_FUNC
if (wait_pid == 0)
{
long msec = elapsed(&start_tv);
long msec = ELAPSED_FUNC(start_tv);
/* Avoid that we keep looping here without
* checking for a CTRL-C for a long time. Don't
@@ -5654,15 +5641,14 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED, int *interrupted)
/* May retry getting characters after an event was handled. */
# define MAY_LOOP
# if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
# ifdef ELAPSED_FUNC
/* Remember at what time we started, so that we know how much longer we
* should wait after being interrupted. */
# define USE_START_TV
long start_msec = msec;
struct timeval start_tv;
ELAPSED_TYPE start_tv;
if (msec > 0)
gettimeofday(&start_tv, NULL);
ELAPSED_INIT(start_tv);
# endif
/* Handle being called recursively. This may happen for the session
@@ -5969,9 +5955,9 @@ select_eintr:
/* We're going to loop around again, find out for how long */
if (msec > 0)
{
# ifdef USE_START_TV
# ifdef ELAPSED_FUNC
/* Compute remaining wait time. */
msec = start_msec - elapsed(&start_tv);
msec = start_msec - ELAPSED_FUNC(start_tv);
# else
/* Guess we got interrupted halfway. */
msec = msec / 2;
@@ -7068,11 +7054,11 @@ setup_term_clip(void)
#if defined(HAVE_SETJMP_H)
int (*oldIOhandler)();
#endif
# if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
struct timeval start_tv;
# ifdef ELAPSED_FUNC
ELAPSED_TYPE start_tv;
if (p_verbose > 0)
gettimeofday(&start_tv, NULL);
ELAPSED_INIT(start_tv);
# endif
/* Ignore X errors while opening the display */
@@ -7114,11 +7100,11 @@ setup_term_clip(void)
/* Catch terminating error of the X server connection. */
(void)XSetIOErrorHandler(x_IOerror_handler);
# if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
# ifdef ELAPSED_FUNC
if (p_verbose > 0)
{
verbose_enter();
xopen_message(&start_tv);
xopen_message(ELAPSED_FUNC(start_tv));
verbose_leave();
}
# endif
+7 -4
View File
@@ -1351,9 +1351,15 @@ WaitForChar(long msec)
DWORD dwWaitTime = dwEndTime - dwNow;
#ifdef FEAT_JOB_CHANNEL
/* Check channel while waiting input. */
/* Check channel while waiting for input. */
if (dwWaitTime > 100)
{
dwWaitTime = 100;
/* If there is readahead then parse_queued_messages() timed out
* and we should call it again soon. */
if (channel_any_readahead())
dwWaitTime = 10;
}
#endif
#ifdef FEAT_MZSCHEME
if (mzthreads_allowed() && p_mzq > 0
@@ -4287,9 +4293,6 @@ mch_system_piped(char *cmd, int options)
/* Get extra characters when we don't have any. Reset the
* counter and timer. */
noread_cnt = 0;
# if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
gettimeofday(&start_tv, NULL);
# endif
len = ui_inchar(ta_buf, BUFLEN, 10L, 0);
}
if (ta_len > 0 || len > 0)
+2 -1
View File
@@ -105,7 +105,8 @@ redo:
/* Put the pum below "row" if possible. If there are few lines decide on
* where there is more room. */
if (row - above_row >= below_row - row)
if (row + 2 >= below_row - pum_height
&& row - above_row > (below_row - above_row) / 2)
{
/* pum above "row" */
+2
View File
@@ -25,6 +25,7 @@ void channel_consume(channel_T *channel, ch_part_T part, int len);
int channel_collapse(channel_T *channel, ch_part_T part, int want_nl);
int channel_can_write_to(channel_T *channel);
int channel_is_open(channel_T *channel);
int channel_has_readahead(channel_T *channel, ch_part_T part);
char *channel_status(channel_T *channel, int req_part);
void channel_info(channel_T *channel, dict_T *dict);
void channel_close(channel_T *channel, int invoke_close_cb);
@@ -44,6 +45,7 @@ int channel_poll_check(int ret_in, void *fds_in);
int channel_select_setup(int maxfd_in, void *rfds_in, void *wfds_in);
int channel_select_check(int ret_in, void *rfds_in, void *wfds_in);
int channel_parse_messages(void);
int channel_any_readahead(void);
int set_ref_in_channel(int copyID);
ch_part_T channel_part_send(channel_T *channel);
ch_part_T channel_part_read(channel_T *channel);
+1 -1
View File
@@ -3244,8 +3244,8 @@ typedef struct
#endif
int want_full_screen;
int stdout_isatty; /* is stdout a terminal? */
int not_a_term; /* no warning for missing term? */
int tty_fail; /* exit if not a tty */
char_u *term; /* specified terminal name */
#ifdef FEAT_CRYPT
int ask_for_key; /* -x argument */
+1 -1
View File
@@ -88,7 +88,7 @@ func RunServer(cmd, testfunc, args)
call call(function(a:testfunc), [port])
catch
call assert_false(1, "Caught exception: " . v:exception)
call assert_false(1, 'Caught exception: "' . v:exception . '" in ' . v:throwpoint)
finally
call s:kill_server(a:cmd)
endtry
+12 -3
View File
@@ -58,6 +58,9 @@ func Ch_communicate(port)
" string with ][ should work
call assert_equal('this][that', ch_evalexpr(handle, 'echo this][that'))
" nothing to read now
call assert_equal(0, ch_canread(handle))
" sending three messages quickly then reading should work
for i in range(3)
call ch_sendexpr(handle, 'echo hello ' . i)
@@ -368,7 +371,7 @@ func Ch_raw_one_time_callback(port)
endif
call ch_setoptions(handle, {'mode': 'raw'})
" The message are sent raw, we do our own JSON strings here.
" The messages are sent raw, we do our own JSON strings here.
call ch_sendraw(handle, "[1, \"hello!\"]\n", {'callback': 'Ch_handleRaw1'})
call WaitFor('g:Ch_reply1 != ""')
call assert_equal("[1, \"got it\"]", g:Ch_reply1)
@@ -431,7 +434,10 @@ func Test_raw_pipe()
return
endif
call ch_log('Test_raw_pipe()')
let job = job_start(s:python . " test_channel_pipe.py", {'mode': 'raw'})
" Add a dummy close callback to avoid that messages are dropped when calling
" ch_canread().
let job = job_start(s:python . " test_channel_pipe.py",
\ {'mode': 'raw', 'close_cb': {chan -> 0}})
call assert_equal(v:t_job, type(job))
call assert_equal("run", job_status(job))
@@ -458,6 +464,9 @@ func Test_raw_pipe()
call assert_equal("something\n", substitute(msg, "\r", "", 'g'))
call ch_sendraw(job, "double this\n")
let g:handle = job_getchannel(job)
call WaitFor('ch_canread(g:handle)')
unlet g:handle
let msg = ch_readraw(job)
call assert_equal("this\nAND this\n", substitute(msg, "\r", "", 'g'))
@@ -1396,7 +1405,7 @@ function MyExitTimeCb(job, status)
endfunction
func Test_exit_callback_interval()
if !has('job') || has('gui_macvim')
if !has('job')
return
endif
+23
View File
@@ -106,3 +106,26 @@ func Test_keymap_valid()
call assert_fails(":set kmp=trunc\x00name", "E544:")
call assert_fails(":set kmp=trunc\x00name", "trunc")
endfunc
func Check_dir_option(name)
" Check that it's possible to set the option.
exe 'set ' . a:name . '=/usr/share/dict/words'
call assert_equal('/usr/share/dict/words', eval('&' . a:name))
exe 'set ' . a:name . '=/usr/share/dict/words,/and/there'
call assert_equal('/usr/share/dict/words,/and/there', eval('&' . a:name))
exe 'set ' . a:name . '=/usr/share/dict\ words'
call assert_equal('/usr/share/dict words', eval('&' . a:name))
" Check rejecting weird characters.
call assert_fails("set " . a:name . "=/not&there", "E474:")
call assert_fails("set " . a:name . "=/not>there", "E474:")
call assert_fails("set " . a:name . "=/not.*there", "E474:")
endfunc
func Test_dictionary()
call Check_dir_option('dictionary')
endfunc
func Test_thesaurus()
call Check_dir_option('thesaurus')
endfunc
+24
View File
@@ -779,6 +779,30 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
106,
/**/
105,
/**/
104,
/**/
103,
/**/
102,
/**/
101,
/**/
100,
/**/
99,
/**/
98,
/**/
97,
/**/
96,
/**/
95,
/**/
94,
/**/
+16
View File
@@ -2506,4 +2506,20 @@ typedef enum
# define OPEN_CHR_FILES
#endif
#if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
# define ELAPSED_TIMEVAL
# define ELAPSED_INIT(v) gettimeofday(&v, NULL)
# define ELAPSED_FUNC(v) elapsed(&v)
# define ELAPSED_TYPE struct timeval
long elapsed(struct timeval *start_tv);
#else
# if defined(WIN32)
# define ELAPSED_TICKCOUNT
# define ELAPSED_INIT(v) v = GetTickCount()
# define ELAPSED_FUNC(v) elapsed(v)
# define ELAPSED_TYPE DWORD
long elapsed(DWORD start_tick);
# endif
#endif
#endif /* VIM__H */