Commit Graph

19394 Commits

Author SHA1 Message Date
Justin M. Keyes
49d5ed5591 fix #1027: :wundo segfault in new, non-empty buffer 2014-10-26 20:03:02 +00:00
Justin M. Keyes
3fc542b45b Merge pull request #1347 from splinterofchaos/433
vim-patch:7.4.433
2014-10-29 12:09:02 -04:00
Kartik K. Agaram
250298884b fix 'sign unplace id'
Since the introduction of the FOR_ALL_BUFFERS macro, 'sign unplace id'
without a buffer was only removing the sign from the first buffer rather
than all buffers, as described in the documentation.

  :help sign-unplace

--

modeline discussion: https://github.com/akkartik/neovim/commit/7863c247db#commitcomment-8342590
2014-10-28 23:12:41 -04:00
Thiago de Arruda
94f59fc9be api: Implement vim_command_output function
This function can be used by API clients to execute a command and capture the
output.
2014-10-28 23:12:41 -04:00
Scott Prager
dd4263a0c8 job_start: Do not close in/out/err on error.
The streams job_close_*() reference have not been initialized by the
time we call uv_spawn() and libuv closes these pipes for us when spawn()
fails.
2014-10-28 14:09:28 -03:00
Scott Prager
d10e83fec2 job/valgrind: Fix invalid reads/missing free.
The JobEvent structure may refer to a job after it has been freed. Apply
@tarruda's patch to extract the job data before pushing the event.

Also, fix the type, "data" -> "job", in on_job_exit() and free the job
name in the last job event.
2014-10-28 14:09:28 -03:00
Thiago de Arruda
c95bc3349b input: Fix conversion error in convert_input()
The `rbuffer_consumed` was being passed a consumed count from another buffer,
causing integer overflow in `rbuffer_relocate`.

Fixes #1343
2014-10-28 10:21:05 -03:00
Thiago de Arruda
4d70fe89bf msgpack-rpc: Terminate server->client calls when the channel closes 2014-10-28 08:54:44 -03:00
Thiago de Arruda
3cacdae044 channel: fix REQ definition for msgpack-rpc logging 2014-10-28 08:54:24 -03:00
Scott Prager
ba527b6f34 version: Mark patch 430 NA.
Not relevant because we always compile with +conceal.
2014-10-25 14:53:32 -04:00
Scott Prager
d14c124847 vim-patch:7.4.433
Problem:    Test 75 fails on MS-Windows.
Solution:   Use ":normal" instead of feedkeys(). (Michael Soyka)

https://code.google.com/p/vim/source/detail?r=v7-4-433
2014-10-25 14:52:29 -04: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
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
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
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
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
cdfdfae322 input: Fix ctrl+c handling in convert_input 2014-10-22 09:58:17 -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
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
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
Victor Fonseca
1be1964f34 coverity/71507: Unchecked return value (CHECKED_RETURN)
Don't check for err->set since object_to_vim always return false when error is set
2014-10-20 11:01:25 -02: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
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
Thiago de Arruda
68de5d79a2 rstream: Extract some RStream functionality to RBuffer
RBuffer instances represent the internal buffer used by RStreams.

This changes RStream constructor to receive RBuffer pointers and adds a set of
RBuffer methods that expose the lower level buffer manipulation to consumers of
the RStream API.
2014-10-18 08:42:49 -03:00
Justin M. Keyes
56ef9e8668 Merge pull request #1297 from splinterofchaos/server-errors
server: Improve error reporting.
2014-10-17 14:03:58 -04:00
Scott Prager
792882e9e4 server: Improve error reporting.
If we fail to bind to the server address, do not try and listen lest the
reported error always be "invalid argument".

Also, return whether or not we errored from server_init() in case we
want to respond differently in the future.
2014-10-17 12:26:10 -04:00
Scott Prager
f2e5851dd9 vim-patch:7.4.418
Problem:    When leaving ":append" the cursor shape is like in Insert mode.
            (Jacob Niehus)
Solution:   Do not have State set to INSERT when calling getline().

https://code.google.com/p/vim/source/detail?r=v7-4-418
2014-10-16 15:55:54 -04:00
Naveen Kumar Molleti
0a2d9fa8c8 vim-patch:7.4.440 #1244
Problem:  Omni complete popup drawn incorrectly.
Solution: Call validate_cursor() instead of check_cursor(). (Hirohito
          Higashi)

https://code.google.com/p/vim/source/detail?r=v7-4-440
2014-10-16 04:18:18 +00:00
Naveen Kumar Molleti
af40647b66 vim-patch:7.4.439 #1245
Problem:  Duplicate message in message history. Some quickfix messages
          appear twice. (Gary Johnson)
Solution: Do not reset keep_msg too early. (Hirohito Higashi)

https://code.google.com/p/vim/source/detail?r=v7-4-439
2014-10-16 04:04:49 +00:00
Naveen Kumar Molleti
3195aadf27 vim-patch:7.4.436 #1246
Problem:  ml_get error for autocommand that moves the cursor of the
          current window.
Solution: Check the cursor position after switching back to the current
          buffer. (Christian Brabandt)

https://code.google.com/p/vim/source/detail?r=v7-4-436
2014-10-16 03:49:05 +00:00