Commit Graph

1861 Commits

Author SHA1 Message Date
Thiago de Arruda
65942d3a8d Merge PR #1331 'Fixes to job and channel modules' 2014-10-23 22:19:18 -03:00
Thiago de Arruda
d696fa51f8 test: verify that msgpacks-rpc exceptions are working 2014-10-23 21:46:09 -03:00
Thiago de Arruda
64844b7312 msgpack-rpc: Improve logging of msgpack-rpc messages
- Expose more logging control from the log.c module(get log stream and omit
  newlines)
- Remove logging from the generated functions in msgpack-gen.lua
- Refactor channel.c/helpers.c to log every msgpack-rpc payload using
  msgpack_object_print(a helper function from msgpack.h)
- Remove the api_stringify function, it was only useful for logging msgpack-rpc
  which is now handled by msgpack_object_print.
2014-10-23 21:46:03 -03:00
Thiago de Arruda
f05fead12e job: Only decrease refcount after settmode in job_wait
This is required to prevent the scenario explained by @akkartik in #1324
2014-10-23 21:19:08 -03:00
Thiago de Arruda
6f5f3faa84 travis: Setup xvfb for running xclip tests 2014-10-23 21:19:08 -03:00
Thiago de Arruda
d561ba223d job: Refactor to ensure that all callbacks will be invoked
It's possible that a child process won't close it's standard streams, even after
it exits. This can be evidenced with the "xclip" program:

    :call system('xclip -i -selection clipboard', 'DATA')

Before this commit, the above command wouldn't return, even though the xclip
program had exited. That is because `xclip` wasn't closing it's stdout/stderr
streams, which would block pending_refs from ever reaching 0.

Now the job.c module was refactored to ensure all streams are closed when the
uv_process_t handle is closed.
2014-10-23 21:19:08 -03:00
Thiago de Arruda
9abcd9a4a0 msgpack-rpc: Fix error handling and leak in call_request_handler
Free the arguments array after sending the response and also avoid
double-sending responses in cases of errors.
2014-10-23 21:19:08 -03:00
Thiago de Arruda
d4f78127fb msgpack-rpc: Ensure stdio channels are properly closed
When stdio was closed, parse_msgpack was called with eof == true, with caused a
free_channel call. To ensure the correct behavior for all types of channels, the
close_channel must be called before free_channel.
2014-10-23 21:19:08 -03:00
Thiago de Arruda
b4ec764e8e runtime: Fix rpcstop call in python_setup.vim 2014-10-23 21:19:08 -03:00
Justin M. Keyes
d1e063a8af Merge pull request #1332 from splinterofchaos/listbr
vim-patch:7.4.422
2014-10-23 15:20:01 -04:00
Scott Prager
87cf661af6 vim-patch:7.4.422
Problem:    When using conceal with linebreak some text is not displayed
            correctly. (Grüner Gimpel)
Solution:   Check for conceal mode when using linebreak. (Christian Brabandt)

https://code.google.com/p/vim/source/detail?r=v7-4-422
2014-10-23 14:37:55 -04:00
Justin M. Keyes
b8401550a7 Merge pull request #1330 from splinterofchaos/na-patches
N/A patches
2014-10-23 14:22:01 -04:00
Scott Prager
089f977d18 version: update patches to 488 2014-10-23 13:18:02 -04:00
Scott Prager
95cdf32f24 version: More NA patches. 2014-10-23 13:18:02 -04:00
Scott Prager
46c610c9fe vim-patch:7.4.406
Problem:    Test 72 and 100 fail on MS-Windows.
Solution:   Set fileformat to unix in the tests. (Taro Muraoka)

https://code.google.com/p/vim/source/detail?r=v7-4-406
2014-10-23 13:18:02 -04:00
Nate Sullivan
d11fd1950f legacy tests: migrate test35. #1318
Migrate vim's integration test 35 (increment/decrement commands) to
lua/busted.
2014-10-22 15:28:26 -04:00
Thiago de Arruda
2f31c3d6ce Merge PR #1326 'Add verification of log macros' 2014-10-22 11:40:38 -03:00
Thiago de Arruda
b31a74ad11 debug: Improve debugging of msgpack-rpc requests
- Add the api_stringify function to display API objects
- Use api_stringify to display request arguments and return values in DLOG
  statements.
2014-10-22 11:26:43 -03:00
Thiago de Arruda
4233446344 debug: Fix broken DLOG macro calls 2014-10-22 11:26:43 -03:00
Thiago de Arruda
97f0c1eda1 travis: Force verification of DLOG macros
We use INFO as the default log level, which leaves code inside DLOG macros
unverified(currently it has compilation errors).

Decrease the log level on travis builds for automatic verification in PRs.
2014-10-22 11:26:36 -03:00
Thiago de Arruda
cdfdfae322 input: Fix ctrl+c handling in convert_input 2014-10-22 09:58:17 -03:00
Thiago de Arruda
5cd9b64742 Merge PR #1316 'Refactor event deferral' 2014-10-22 07:30:32 -03:00
Thiago de Arruda
f7fab4af86 test: verify that v:shell_error is set by system()/systemlist() 2014-10-22 07:15:55 -03:00
Thiago de Arruda
b49460f930 input: Don't remove Ctrl+C from the input_buffer 2014-10-21 21:20:31 -03:00
Thiago de Arruda
b6c9883169 event: Remove direct calls to uv_run from job.c/shell.c 2014-10-21 12:27:25 -03:00
Thiago de Arruda
276ac99350 travis: Remove install_functional_test_deps function
It is no longer needed after the lua client was added as dependency
(@69561ea922ae6789703c06cbc245929d7c625db9)
2014-10-21 11:07:13 -03:00
Thiago de Arruda
79b7263f79 compilation: Add -Wconversion to more files and validate CONV_SOURCES
All files under the os, api and msgpack_rpc directories have -Wconversion
automatically applied. CONV_SOURCES is also checked for missing files(when
renaming, for example)
2014-10-21 11:05:49 -03:00
Thiago de Arruda
cf9571b7b1 api: Add FUNC_ATTR_DEFERRED attribute to a number of functions
Any function that can directly mutate the screen or execute vimscript had the
attribute applied.
2014-10-21 11:05:49 -03:00
Thiago de Arruda
72e3e57bf1 msgpack-rpc: Allow selective deferral API calls
Since all API functions now run immediately after a msgpack-rpc request is
parsed by libuv callbacks, a mechanism was added to override this behavior and
allow certain functions to run in Nvim main loop.

The mechanism is simple: Any API function tagged with the FUNC_ATTR_DEFERRED (a
"dummy" attribute only used by msgpack-gen.lua) will be called when Nvim main
loop receives a K_EVENT key.

To implement this mechanism it was necessary some restructuration on the
msgpack-rpc modules, especially in the msgpack-gen.lua script.
2014-10-21 11:05:49 -03:00
Thiago de Arruda
72f028abcb eval: Defer execution of JobActivity autocommands
JobActivity autocommands run vimscript and must be executed on Nvim main loop.
Since the previous commit removed automatic calls to `event_push` on RStream/Job
callbacks, this adds it back, but in eval.c where job control is implemented.
2014-10-21 11:05:49 -03:00
Thiago de Arruda
b527ac752f event: Extract event_poll loops to event_poll_until macro
A pattern that is becoming common across the project is to poll for events until
a certain condition is true, optionally passing a timeout. To address this
scenario, the event_poll_until macro was created and the job/channel/input
modules were refactored to use it on their blocking functions.
2014-10-21 11:05:49 -03:00
Thiago de Arruda
264e0d872c event: Remove automatic event deferall
This is how asynchronous events are currently handled by Nvim:

- Libuv event loop is entered when Nvim blocks for user input(os_inchar is
  called)
- Any event delivered by libuv that is not user input is queued for processing
- The `K_EVENT` special key code is returned by os_inchar
- `K_EVENT` is returned to a loop that is reading keys for the current Nvim
  mode, which will be handled by calling event_process()

This approach has the advantage of integrating nicely with the current
codebase, eg: vimscript code can be executed asynchronously with little
surprises(Its the same as if the user typed a key).

The problem with using keys to represent any event is that it also interferes with
operators, and not every event needs or should do that. For example, consider
this scenario:

- A msgpack-rpc client calls vim_feedkeys("d")
- Nvim processes K_EVENT, pushing "d" to the input queue
- Nvim processes "d", entering operator-pending mode to wait for a motion
- The client calls vim_feedkeys("w"), expecting Nvim to delete a word
- Nvim processes K_EVENT, breaking out of operator-pending and pushing "w"
- Nvim processes "w", moving a word

This commit fixes the above problem by removing all automatic calls to
`event_push`(which is what generates K_EVENT input). Right now this also breaks
redrawing initiated by asynchronous events(and possibly other stuff too, Nvim is
a complex state machine and we can't simply run vimscript code anywhere).

In future commits the calls to `event_push` will be inserted only where it's
absolutely necessary to run code in "key reading loops", such as when executing
vimscript code or mutating editor data structures in ways that currently can
only be done by the user.
2014-10-21 11:05:49 -03:00
Thiago de Arruda
77cc078c41 event: Remove EventType enum and pass a callback to event_push
This approach is more flexible because we don't need to support a fixed set of
"event types", any module can push events to be handled in main loop by simply
passing a callback to the Event structure.
2014-10-21 11:05:49 -03:00
Thiago de Arruda
cf6f60ce4d channel: Simplify resource management
- Remove unused rpc_call_level field
- Add `returned` field to ChannelCallFrame. This is set when the call returns
  and is the only condition checked by `channel_send_call`.
- Add job_exit callback for properly closing channels created from job(the
  job_exit callback is only called after all read callbacks, so it's the only
  safe place to free the channel).
2014-10-21 11:05:49 -03:00
Thiago de Arruda
b280308ac6 msgpack-rpc: Create subdirectory for msgpack-rpc modules
Create the msgpack_rpc subdirectory and move all modules that deal with
msgpack-rpc to it. Also merge msgpack_rpc.c into msgpack_rpc/helpers.c
2014-10-21 11:05:49 -03:00
Thiago de Arruda
6e268cd0d4 Merge pull request #1319 '[RFC] A few fixes for YCM contrib docs and code' 2014-10-21 11:04:52 -03:00
Jeff Widman
fe7db21c73 A few fixes for YCM contrib docs and code 2014-10-21 11:03:11 -03:00
John Szakmeister
7e1b285c57 Merge pull request #1313 from fwalch/runtime-programs
CMake: Set execute permissions during installation.
2014-10-21 04:31:38 -04:00
Justin M. Keyes
56339036a7 Merge pull request #1311 from GokuITA/issue1295
Fixed sign column redraw
2014-10-20 16:17:51 -04:00
Victor Fonseca
9097b69088 Fix sign column redraw
Fixed a bug introduced in SHA:aa66f2487edde49b9a5ba10cd70d706d06a94e25,
due to a misapplied patch. buf_del_sign should redraw the window if the
sign deleted was the last one in the buffer.
Also moved the curwin verification to the correct function.
2014-10-20 17:23:09 -02:00
Jeff Widman
6c78fd1a64 version: remove "Running in Vi compatible mode" message #1309 2014-10-20 13:29:18 -04:00
Florian Walch
0b775e3513 CMake: Set execute permissions during installation. 2014-10-20 15:07:14 +02:00
Thiago de Arruda
1eb3dae04a Merge PR #1310 'Improve YCM contrib.' 2014-10-20 08:14:44 -03:00
Eliseo Martínez
20649051dd Improve YCM contrib: Improve documentation. 2014-10-20 08:14:30 -03:00
Eliseo Martínez
d9592fdbd0 Improve YCM contrib: Fix 'no newline at end of file' issue.
Problem:  YCM was reporting a much disturbing warning about a missing
          newline at the end of some files. This was odd, as the
          newlines were there and the warning only was shown for some
          files, not for all of them.
Cause:    After discussing this issue with @Valloric (see
          https://github.com/Valloric/YouCompleteMe/issues/950), it
          turned out that not YCM, but libclang is responsible for it.
          This is, same compilation flags that produce no warnings with
          clang-the-binary on the command line, do produce them with
          libclang-the-library when used by YCM.
Solution: Add an extra flag (-Wno_newline_eof) to those extracted from
          configuration database before passing them to YCM.
2014-10-20 08:14:30 -03:00
Thiago de Arruda
77e918bc1f Merge PR #1306 'RBuffer fixes' 2014-10-20 07:31:32 -03:00
Thiago de Arruda
72ae4e8a93 rstream: Add rbuffer_read_ptr/rbuffer_write_ptr functions
rbuffer_data was renamed to rbuffer_read_ptr, and it represents the next read
position in a RBuffer instance. Similarly, rbuffer_write_ptr was added to
represent the next write position.

Also, rbuffer_data was being used for writing(in alloc_cb), replace that by
rbuffer_write_ptr.
2014-10-19 17:53:32 -03:00
Thiago de Arruda
38aa222658 rstream: Initialize 'rstream' field in RBuffer class
This field is used in a conditional jump, so this initialization is fixing a
bug.
2014-10-19 17:53:32 -03:00
Thiago de Arruda
fb34028c1e Merge PR #1300 'Refactor input buffer' 2014-10-18 13:57:58 -03:00
Thiago de Arruda
42112e04a9 ui: Refactor input buffer handling
All input buffer code was moved to os/input.c, and `inbuf` is now a `RBuffer`
instance(which abstracts static buffer manipulation).
2014-10-18 12:51:35 -03:00