Justin M. Keyes
6c53c3ee55
eventloop: restore redraw in cmdline K_EVENT handler
...
Restores behavior from commit: 02e86ef04cc1
2017-09-05 15:01:06 +02:00
Justin M. Keyes
d47b538f39
eventloop: do not redraw in cmdline K_EVENT handler
...
If :echo is done by an timer or event (such as FocusGained/FocusLost),
redrawcmdline() clobbers it.
2017-09-05 15:01:06 +02:00
Justin M. Keyes
4bf953cca4
test: FocusGained/FocusLost
2017-09-05 15:01:06 +02:00
Justin M. Keyes
f9af824832
test: use global_helpers.uname() instead of calling to nvim UUT
2017-09-05 15:01:06 +02:00
Justin M. Keyes
d30abd8857
eventloop: FocusGained: schedule the schedule
...
main_loop.fast_events does not manifest as K_EVENT, because it is
processed at a different stage than main_loop.events. In order to queue
into main_loop.events, we need to go through the threadsafe
loop_schedule(), which queues into main_loop.thread_events and
eventually main_loop.fast_events. _Then_ it is safe to directly queue
into main_loop.events.
This makes it more likely that the event is treated as K_EVENT.
2017-09-05 15:01:06 +02:00
Justin M. Keyes
46fdacc5b5
doc: eventloop
2017-09-05 15:01:06 +02:00
Justin M. Keyes
b6b6e4a96f
eventloop: FocusGained: schedule event instead of pseudokey
...
closes #4840
closes #6164
2017-09-05 15:01:06 +02:00
Justin M. Keyes
ce852bab04
eventloop: K_EVENT does not finish mapping
...
The "mapping" tests added in 541dde36e3
were flawed:
- Unlike op-pending mode, RPCs are _blocked_ during map-pending. So
a synchronous RPC like nvim_get_current_buf() waits until
'timeoutlen', then the mapping is canceled.
- helpers.expect() also performs a blocking RPC, so again that must not
intervene the two nvim_input() calls.
closes #6166
2017-09-04 22:51:04 +02:00
Vadim A. Misbakh-Soloviov
f050aaabbb
tui: DECSCUSR workaround for Konsole ( #7236 )
...
closes #7235
2017-09-04 18:48:05 +02:00
Justin M. Keyes
3922237b14
test: lint
2017-09-04 10:46:10 +02:00
Matthew Malcomson
541dde36e3
eventloop: K_EVENT should not finish operator
...
normal_finish_command() and normal_prepare() assume that any pending
operator needs to be finished after any subsequent key.
Set `finish_op = false` in nv_event() to indicate that the pending
operator shouldn't be finished in normal_execute().
This is how nv_visual() indicates that 'v' or 'V' in operator-pending
mode should not finish the current pending operator.
fixes #5398
fixes #6166 (partially; mappings are still interrupted)
2017-09-04 08:20:04 +02:00
James McCoy
fec6ca7511
Merge pull request #7233 from yjhan96/vim-8.0.0125
...
vim-patch:8.0.0125
2017-09-03 12:58:41 -04:00
Albert Han
69a201d6c5
vim-patch:8.0.0125
...
Problem: Not enough testing for entering Ex commands.
Solution: Add test for CTRL-\ e {expr}. (Dominique Pelle)
eaaa9bbda6
2017-09-03 09:26:46 -04:00
KunMing Xie
11429f9429
vim-patch:8.0.0247 ( #7232 )
...
Problem: Under some circumstances, one needs to type Ctrl-N or Ctrl-P twice
to have a menu entry selected. (Lifepillar)
Solution: call ins_compl_free(). (Christian Brabandt, closes vim/vim#1411 )
aed6d0b81a
2017-09-03 10:58:32 +02:00
ckelsel
70c62d58d5
Merge remote-tracking branch 'upstream/master'
2017-09-01 07:33:29 +08:00
James McCoy
7bfa4406c1
Merge pull request #7227 from ckelsel/vim-8.0.0209
...
vim-patch:8.0.0209
2017-08-30 10:34:42 -04:00
ckelsel
0e13b15fde
vim-patch:8.0.0209
...
Problem: When using :substitute with the "c" flag and 'cursorbind' is set
the cursor is not updated in other windows.
Solution: Call do_check_cursorbind(). (Masanori Misono)
41baa7983a
2017-08-30 19:59:18 +08:00
ckelsel
9ae353ab44
Merge remote-tracking branch 'upstream/master'
2017-08-30 19:44:19 +08:00
James McCoy
5566f30006
Merge pull request #7218 from jamessan/stderr_collector-fix
...
provider: Remove dict attribute from stderr_collector
2017-08-26 15:06:48 -04:00
James McCoy
ffdddcd93d
provider: Remove dict attribute from stderr_collector
...
If an autoloaded function hasn't been resolved before it is used in
function(), the self dict will not be created which causes E725 when
calling the function. Since self isn't being used in
provider#stderr_collector, we can remove the dict attribute to
workaround the self dict bug[0].
Closes #7115
[0]: https://groups.google.com/d/msg/vim_dev/I7AXOyv-P4o/DzbyOxDHBgAJ
2017-08-26 13:49:39 -04:00
Matthieu Coudron
f612e99db5
ci: XXX: permissive termclose_spec timer ( #7217 )
...
We probably need to revisit the process_stop() logic.
In the meantime this hack avoids CI noise.
2017-08-26 17:18:46 +02:00
Leonardo Brondani Schenkel
e1628fab00
tui: support new iterm2, iTerm2.app terminfo entries
...
iTerm2 got its own entry in Thomas Dickey's terminfo.src on 2017-08-16.
Make sure that the new entry is handled in the same way as the old entry.
closes #7209
closes #7214
2017-08-26 17:11:56 +02:00
Justin M. Keyes
6e7a8c3fe2
Merge #7081 from justinmk/rpcstop
...
rpc: close channel if stream was closed
2017-08-26 16:41:35 +02:00
James McCoy
46a4099dfb
Merge pull request #7192 from llorens/vim-8.0.0092
...
vim-patch:8.0.0092
2017-08-25 11:21:36 -04:00
Justin M. Keyes
0f2873ce99
Merge #7205 from justinmk/win-wmain
2017-08-24 09:31:08 +02:00
Fredrik Fornwall
da84f7dcf9
tui: always use unibi_add_ext_str with unibi_get_ext_str #7204
...
When using an index returned by unibi_add_ext_str() we should
always use unibi_get_ext_str() and not rely on the index being
lower than unibi_string_begin_.
Closes #7206
2017-08-24 09:22:21 +02:00
Justin M. Keyes
02e5eafa86
win: expect utf8-encoded argv
when built as a library
2017-08-24 08:42:45 +02:00
Justin M. Keyes
71df5dde6d
win: wmain(): use utf16_to_utf8() #7060
2017-08-24 08:42:45 +02:00
Yuto Tokunaga
e5565891af
win: wmain(): locale-independent argv ( #7180 )
...
fix #7060
2017-08-23 00:55:00 +02:00
Justin M. Keyes
85f3084e21
clipboard: disallow recursion; show hint only once ( #7203 )
...
- Show hint only once per session.
- provider#clipboard#Call(): prevent recursion
- provider#clear_stderr(): use has_key(), because :silent! is still
captured by :redir.
closes #7184
2017-08-22 20:31:54 +02:00
Justin M. Keyes
7f7698649f
Merge #6973 from teto/normal_hl
2017-08-22 20:01:50 +02:00
James McCoy
1d175f3448
Merge pull request #7201 from jamessan/vim-8.0.0308
...
vim-patch:8.0.0308,8.0.0325,8.0.0326,8.0.0437,8.0.0612,8.0.0680
2017-08-22 09:53:02 -04:00
Matthieu Coudron
5f6ad863c6
syntax.c: style
...
Converts some documentation to doxygen format + minor styling
improvements.
2017-08-22 12:37:59 +02:00
Matthieu Coudron
4d91369fd7
syntax.c: register 'Normal' highlight group
...
- :hi Normal works with -u NONE
- Makes HL_TABLE and ATTR_ENTYRY a function instead of a macro so that in can be used in gdb.
- Introduces ATTRENTRY_INIT to init attrentry_t
2017-08-22 12:37:59 +02:00
James McCoy
41d180abb4
vim-patch:8.0.0680
...
Problem: Plugins in start packages are sourced twice. (mseplowitz)
Solution: Use the unmodified runtime path when loading plugins (test by Ingo
Karkat, closes vim/vim#1801 )
07ecfa64a1
2017-08-21 20:29:49 -04:00
James McCoy
622c3454df
vim-patch:8.0.0612
...
Problem: Package directories are added to 'runtimepath' only after loading
non-package plugins.
Solution: Split off the code to add package directories to 'runtimepath'.
(Ingo Karkat, closes vim/vim#1680 )
ce876aaa9a
2017-08-21 20:29:49 -04:00
James McCoy
fc7bf1c71d
vim-patch:8.0.0437
...
Problem: The packadd test does not create the symlink correctly and does
not test the right thing.
Solution: Create the directory and symlink correctly.
644df41c44
2017-08-21 20:29:49 -04:00
James McCoy
651c6f9b6e
vim-patch:8.0.0326
...
Problem: Packadd test uses wrong directory name.
Solution: Use the variable name value. (Hirohito Higashi)
24f8f543d4
2017-08-21 20:29:49 -04:00
James McCoy
24a5564196
vim-patch:8.0.0325
...
Problem: Packadd test does not clean up symlink.
Solution: Delete the link. (Hirohito Higashi)
913727e567
2017-08-21 20:29:48 -04:00
James McCoy
a66eca78c2
vim-patch:8.0.0308
...
Problem: When using a symbolic link, the package path will not be inserted
at the right position in 'runtimepath'. (Dugan Chen, Norio Takagi)
Solution: Resolve symbolic links when finding the right position in
'runtimepath'. (Hirohito Higashi)
2f9e575583
2017-08-21 20:29:48 -04:00
James McCoy
9ff0cc7085
Merge pull request #6808 from nelstrom/normal-mode-terminal
...
Make :terminal remain in normal mode when created
2017-08-21 19:46:43 -04:00
Lech Lorens
d2595ba1c4
vim-patch:8.0.0092
...
Problem: C indenting does not support nested namespaces that C++ 17 has.
Solution: Add check that passes double colon inside a name. (Pauli, closes
vim/vim#1214 )
ca8b8d6956
2017-08-21 23:00:51 +02:00
Drew Neil
73286a81cf
Repair tui_spec functional tests
2017-08-21 20:44:03 +01:00
Drew Neil
ac52947838
Repair job_spec functional tests
2017-08-21 20:44:03 +01:00
Drew Neil
642e14d9e7
Repair ex_terminal_spec functional tests
2017-08-21 20:44:03 +01:00
Drew Neil
5a214a9ed0
Update documentation
2017-08-21 20:44:03 +01:00
Drew Neil
7d183e89f7
Use Normal mode as default when opening a new terminal
2017-08-21 20:44:03 +01:00
ckelsel
0b6fa3a553
Merge remote-tracking branch 'upstream/master'
2017-08-21 09:19:08 +08:00
Justin M. Keyes
0f442c328e
channel.c:call_set_error(): fix memory leak
2017-08-21 01:04:28 +02:00
Justin M. Keyes
af993da435
rpc: close channel if stream was closed
...
f_jobstop()/f_rpcstop() .. process_stop() .. process_close_in(proc)
closes the write-stream of a RPC channel. But there might be
a pending RPC notification on the queue, which may get processed just
before the channel is closed.
To handle that case, check the Stream.closed in
channel.c:receive_msgpack().
Before this change, the above scenario could trigger
this assert(!stream->closed) in wstream_write():
0x00007f96e1cd3428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
0x00007f96e1cd502a in __GI_abort () at abort.c:89
0x00007f96e1ccbbd7 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x768f9b "!stream->closed",
file=file@entry=0x768f70 "../src/nvim/event/wstream.c", line=line@entry=77,
function=function@entry=0x768fb0 <__PRETTY_FUNCTION__.13735> "wstream_write") at assert.c:92
0x00007f96e1ccbc82 in __GI___assert_fail (assertion=0x768f9b "!stream->closed", file=0x768f70 "../src/nvim/event/wstream.c", line=77,
function=0x768fb0 <__PRETTY_FUNCTION__.13735> "wstream_write") at assert.c:101
0x00000000004d2c1f in wstream_write (stream=0x7f96e0a35078, buffer=0x7f96e09f9b40) at ../src/nvim/event/wstream.c:77
0x00000000005857b2 in channel_write (channel=0x7f96e0ae5800, buffer=0x7f96e09f9b40) at ../src/nvim/msgpack_rpc/channel.c:551
0x000000000058567d in on_request_event (argv=0x7ffed792efa0) at ../src/nvim/msgpack_rpc/channel.c:523
0x00000000005854c8 in handle_request (channel=0x7f96e0ae5800, request=0x7ffed792f1b8) at ../src/nvim/msgpack_rpc/channel.c:503
0x00000000005850cb in parse_msgpack (channel=0x7f96e0ae5800) at ../src/nvim/msgpack_rpc/channel.c:423
0x0000000000584f90 in receive_msgpack (stream=0x7f96e0a35218, rbuf=0x7f96e0d1d4c0, c=22, data=0x7f96e0ae5800, eof=false)
at ../src/nvim/msgpack_rpc/channel.c:389
0x00000000004d0b20 in read_event (argv=0x7ffed792f4a8) at ../src/nvim/event/rstream.c:190
0x00000000004ce462 in multiqueue_process_events (this=0x7f96e18172d0) at ../src/nvim/event/multiqueue.c:150
0x000000000059b630 in nv_event (cap=0x7ffed792f620) at ../src/nvim/normal.c:7908
0x000000000058be69 in normal_execute (state=0x7ffed792f580, key=-25341) at ../src/nvim/normal.c:1137
0x0000000000652463 in state_enter (s=0x7ffed792f580) at ../src/nvim/state.c:61
0x000000000058a1fe in normal_enter (cmdwin=false, noexmode=false) at ../src/nvim/normal.c:467
0x00000000005500c2 in main (argc=2, argv=0x7ffed792f8d8) at ../src/nvim/main.c:554
Alternative approach suggested by bfredl is to use close_cb of the
process. My unsuccessful attempt is below. (It seems close_cb is queued
too late, which is the similar problem addressed by this commit):
commit 75fc12c6ab15711bdb7b18c6d42ec9d157f5145e
Author: Justin M. Keyes <justinkz@gmail.com>
Date: Fri Aug 18 01:30:41 2017 +0200
rpc: use Stream's close_cb instead of explicit check in receive_msgpack()
diff --git a/src/nvim/event/process.c b/src/nvim/event/process.c
index 8371d3cd482e..e52da23cdc40 100644
--- a/src/nvim/event/process.c
+++ b/src/nvim/event/process.c
@@ -416,6 +416,10 @@ static void on_process_exit(Process *proc)
static void on_process_stream_close(Stream *stream, void *data)
{
Process *proc = data;
+ ILOG("on_process_stream_close");
+ if (proc->stream_close_cb != NULL) {
+ proc->stream_close_cb(stream, proc->stream_close_data);
+ }
decref(proc);
}
diff --git a/src/nvim/event/process.h b/src/nvim/event/process.h
index 5c00e8e7ecd5..34a8d54f6f8c 100644
--- a/src/nvim/event/process.h
+++ b/src/nvim/event/process.h
@@ -26,6 +26,11 @@ struct process {
Stream *in, *out, *err;
process_exit_cb cb;
internal_process_cb internal_exit_cb, internal_close_cb;
+
+ // Called when any of the process streams (in/out/err) closes.
+ stream_close_cb stream_close_cb;
+ void *stream_close_data;
+
bool closed, detach;
MultiQueue *events;
};
@@ -50,6 +55,8 @@ static inline Process process_init(Loop *loop, ProcessType type, void *data)
.closed = false,
.internal_close_cb = NULL,
.internal_exit_cb = NULL,
+ .stream_close_cb = NULL,
+ .stream_close_data = NULL,
.detach = false
};
}
diff --git a/src/nvim/event/stream.c b/src/nvim/event/stream.c
index 7c865bfe1e8c..c8720d1e45d9 100644
--- a/src/nvim/event/stream.c
+++ b/src/nvim/event/stream.c
@@ -95,7 +95,11 @@ void stream_close(Stream *stream, stream_close_cb on_stream_close, void *data)
void stream_close_handle(Stream *stream)
FUNC_ATTR_NONNULL_ALL
{
+ ILOG("stream=%d", stream);
+ // LOG_CALLSTACK();
if (stream->uvstream) {
+ // problem: this schedules on the queue, but channel.c:receive_msgpack may
+ // be processed before close_cb is called by libuv.
uv_close((uv_handle_t *)stream->uvstream, close_cb);
} else {
uv_close((uv_handle_t *)&stream->uv.idle, close_cb);
@@ -105,6 +109,7 @@ void stream_close_handle(Stream *stream)
static void close_cb(uv_handle_t *handle)
{
Stream *stream = handle->data;
+ ILOG(">>>>>>>>>>>>>>>>>>>>>>> stream=%p stream->internal_close_cb=%p", stream, stream->internal_close_cb);
if (stream->buffer) {
rbuffer_free(stream->buffer);
}
diff --git a/src/nvim/msgpack_rpc/channel.c b/src/nvim/msgpack_rpc/channel.c
index 782eabe04e4a..dc2b794e366a 100644
--- a/src/nvim/msgpack_rpc/channel.c
+++ b/src/nvim/msgpack_rpc/channel.c
@@ -128,6 +128,8 @@ uint64_t channel_from_process(Process *proc, uint64_t id, char *source)
source);
incref(channel); // process channels are only closed by the exit_cb
channel->data.proc = proc;
+ channel->data.proc->stream_close_cb = close_cb2;
+ channel->data.proc->stream_close_data = channel;
wstream_init(proc->in, 0);
rstream_init(proc->out, 0);
@@ -387,17 +389,6 @@ static void receive_msgpack(Stream *stream, RBuffer *rbuf, size_t c,
goto end;
}
- if ((chan_wstream(channel) != NULL && chan_wstream(channel)->closed)
- || (chan_rstream(channel) != NULL && chan_rstream(channel)->closed)) {
- char buf[256];
- snprintf(buf, sizeof(buf),
- "ch %" PRIu64 ": stream closed unexpectedly. "
- "closing channel",
- channel->id);
- call_set_error(channel, buf, WARN_LOG_LEVEL);
- goto end;
- }
-
size_t count = rbuffer_size(rbuf);
DLOG("ch %" PRIu64 ": parsing %u bytes from msgpack Stream: %p",
channel->id, count, stream);
@@ -571,23 +562,6 @@ static Stream *chan_wstream(Channel *chan)
abort();
}
-/// Returns the Stream that a Channel reads from.
-static Stream *chan_rstream(Channel *chan)
-{
- switch (chan->type) {
- case kChannelTypeSocket:
- return &chan->data.stream;
- case kChannelTypeProc:
- return chan->data.proc->out;
- case kChannelTypeStdio:
- return &chan->data.std.in;
- case kChannelTypeInternal:
- return NULL;
- }
- abort();
-}
-
-
static bool channel_write(Channel *channel, WBuffer *buffer)
{
bool success = false;
@@ -799,6 +773,12 @@ static void close_cb(Stream *stream, void *data)
decref(data);
}
+static void close_cb2(Stream *stream, void *data)
+{
+ ILOG("close_cb2");
+ close_channel(data);
+}
+
/// @param source description of source function, rplugin name, TCP addr, etc
static Channel *register_channel(ChannelType type, uint64_t id,
MultiQueue *events, char *source)
2017-08-21 01:04:28 +02:00