aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
Commit message (Collapse)AuthorAge
...
* ui: Extract mouse.c/mouse.hThiago de Arruda2014-11-27
|
* ui: Remove ui_delay, ui_breakcheck and ui_set_shellsizeThiago de Arruda2014-11-27
| | | | | These functions only used to call another os_* function, so remove them and replace all occurences in the project.
* ui: Remove ui_inchar/ui_char_availThiago de Arruda2014-11-27
| | | | | | | | | Also: - Remove NO_CONSOLE_INPUT/NO_CONSULE preprocessor conditionals - Remove ctrl_c_interrupts variable, check for mapped_ctrl_c directly in process_interrupts() - Move ui_inchar profiling to input_poll which is where Nvim blocks for input.
* Add Boolean argument escape_csi to vim_feedkeysRui Abreu Ferreira2014-11-27
| | | | | | | | | - By default vim_feedkeys escaped all input for CSI/K_SPECIAL bytes before using it. However since vim_replace_termcodes() also escapes the input string chaining these functions together escapes input twice - vim_feedkeys() now takes a third Boolean argument to enable/disable escaping - Breaks API compatibility
* Add missing refcount increment for systemlist()Rui Abreu Ferreira2014-11-25
| | | | | | | - get_system_output_as_rettv() was missing a refcount increment when returning an empty list, i.e. when there was no output - we now use rettv_list_aloc() instead of list_alloc() - issue #1530
* Fix warnings: eval.c: f_rpcrequest(): Garbage value: MI.Eliseo Martínez2014-11-18
| | | | | | | | Problem : Assigned value is garbage or undefined @ 12578. Diagnostic : Multithreading issue. Rationale : Error can only occur if global `provider_call_nesting` is changed while function is executing. Resolution : Use local copy of global.
* Fix warnings: eval.c: do_return(): Np dereference: FP.Eliseo Martínez2014-11-18
| | | | | | | | | | | Problem : Dereference of null pointer @ 18841. Diagnostic : False positive. Rationale : Suggested error path takes `reanimate` branch at 18827, assigning `rettv = current_funccal->rettv`. Then, inmediately after, it supposes rettv is null, which cannot happen, since current_funccal->rettv should always be non null. Resolution : Assert current_funccal->rettv non null.
* Fix warnings: eval.c: add_nr_var(): Out of bounds: FP.Eliseo Martínez2014-11-18
| | | | | | | | | | | | | | Problem : Out-of-bound array access @ 18737. Diagnostic : False positive. Rationale : Situation is intentional. `dictitem_T` is a prefix all dict items whill share, but actual size of each item will be different depending on its key length. `di_key` array field is declared of size 1 just to have a field name, but real size will vary for each item. Resolution : Make analyzer ignore it. This could be refactored to use C99-allowed variable length arrays, but eval.c is bound to dissappear, so no effort is done in that sense.
* Fix warnings: eval.c: call_user_func(): Out of bounds: FP.Eliseo Martínez2014-11-18
| | | | | | | | | | | | | | Problem : Out-of-bound array access @ 18429. Diagnostic : False positive. Rationale : Situation is intentional. `dictitem_T` is a prefix all dict items whill share, but actual size of each item will be different depending on its key length. `di_key` array field is declared of size 1 just to have a field name, but real size will vary for each item. Resolution : Make analyzer ignore it. This could be refactored to use C99-allowed variable length arrays, but eval.c is bound to dissappear, so no effort is done in that sense.
* Fix warnings: eval.c: get_user_func_name(): Np dereference: FP.Eliseo Martínez2014-11-18
| | | | | | | | Problem : Dereference of null pointer @ 18216. Diagnostic : False positive. Rationale : `hi` and `done` are static. Intended usage is for the first call to have idx == 0, so that they are initialized. Resolution : Assert hi after (optional) initialization.
* Fix warnings: eval.c: clear_tv(): Bad free: RI.Eliseo Martínez2014-11-18
| | | | | | | | | | | | | | Problem : Bad free @ 16076. Diagnostic : Real issue. Rationale : A non-allocated string is set at 4127, which later on can be tried to be freed if aborting. Resolution : Detect particular case (func with empty name) and don't free in that case. Another solution (use allocated string) was tried before, but it produced a leak difficult to solve. Finally applied solution works, but it produces a new false positive warning (Np dereference at 13763), deactivated by `assert(ptrs[i].item->li_next)`.
* Fix warnings: eval.c: item_compare(): Garbage value: MI.Eliseo Martínez2014-11-18
| | | | | | | | | | | | | | | | | Problem : Result of operation is garbage or undefined @ 13565. Diagnostic : Multithreading issue. Rationale : Problem occurs only if global (static) variable `item_compare_keep_zero` changes after being used by `do_sort_uniq` but before being used by `item_compare` or `item_compare2`. Resolution : This is not an intra-function problem, as other MI's before, but rather an inter-function one. Thus, it can't be solved by using local copy of global. Therefore, we are forced to do a bit refactoring. We can't simply add a bool param to item_compare/item_compare2, as they couldn't be passed to qsort() that way. So, item_compare/item_compare2 are added a bool param and curried versions of them are added and used in their place.
* Fix warnings: eval.c: dictitem_alloc(): Out-of-bounds access: FP.Eliseo Martínez2014-11-18
| | | | | | | | | | | | | | Problem : Out-of-bound array access @ 5737. Diagnostic : False positive. Rationale : Situation is intentional. `dictitem_T` is a prefix all dict items whill share, but actual size of each item will be different depending on its key length. `di_key` array field is declared of size 1 just to have a field name, but real size will vary for each item. Resolution : Make analyzer ignore it. This could be refactored to use C99-allowed variable length arrays, but eval.c is bound to dissappear, so no effort is done in that sense.
* Fix warnings: eval.c: set_var_lval(): Np dereference: FP.Eliseo Martínez2014-11-18
| | | | | | | | | | | | | | | | | | | Problem : Dereference of null pointer @ 2273. Diagnostic : False positive. Rationale : Suggested error would happen when assigning an rvalue with more items than the lvalue. Then we would enter conditional at: ``` if (lp->ll_li->li_next == NULL) { /* Need to add an empty item. */ list_append_number(lp->ll_list, 0); } lp->ll_li = lp->ll_li->li_next; ``` Analyzer thinks the value assigned to lp->ll_li is still NULL and is hit on the next iteration. Resolution : Assert lp->ll_li->li_next is not null anymore after list_append_number().
* Remove os/provider.{c,h} and all of its referencesThiago de Arruda2014-11-18
|
* eval/ex_cmds2/ops: Implement providers with eval_call_providerThiago de Arruda2014-11-18
| | | | | Replace references to provider_call/provider_has with the new functions eval_call_provider/eval_has_provider.
* eval: Add eval_call_provider/eval_has_provider functionsThiago de Arruda2014-11-18
| | | | | | | | | | | These use autoloaded vimscript to replace the provider_call/provider_has functions, moving the implementation of providers to pure vimscript(we lose nothing since vimscript can also call msgpack-rpc functions). When calling the rpcrequest function from a provider, temporarily switch to the caller scope. This is required for compatibility with legacy plugins, because they may depend on scope information that changes when "leaving" the C stack to enter the vimscript stack.
* Merge pull request #1471 from splinterofchaos/fix-jobstartJustin M. Keyes2014-11-15
|\ | | | | jobstart: Check prg arguments for NULL.
| * jobstart: Check prg arguments for NULL.Scott Prager2014-11-13
| |
* | vim-patch:7.4.419Scott Prager2014-11-11
|/ | | | | | | | Problem: Whan part of a list is locked it's possible to make changes. Solution: Check if any of the list items is locked before make a change. (ZyX) https://code.google.com/p/vim/source/detail?r=v7-4-419
* eval: Return an empty list from systemlist() when there's no outputThiago de Arruda2014-11-10
| | | | This is the behavior on vim's `systemlist()`.
* job: Let vimL jobsend() accept a list.Scott Prager2014-11-07
| | | | | | | | Use save_tv_as_string(), same as vimL system(). This also makes jobsend() more liberal in what it can accept. For example, `jobsend(j, 123)` is now valid. Closes #1176
* job: Make v:job_data[2] a list.Scott Prager2014-11-07
| | | | | | | | Factor out string_to_list() from f_system()'s implementation and use that to set job_data. This has the technical advantage of preserving NULs, and may be more convenient for users. Required for #1176.
* job: Read job data line-wise.Scott Prager2014-11-07
| | | | Only read up to the last newline in push_job_event().
* Remove long_u: eval: Replace with size_t.Eliseo Martínez2014-11-06
| | | | | Note: No effort is done on refactoring anything in eval module, as it will be eventually dropped.
* iconv: re-enableNicolas Hillegeer2014-11-06
| | | | | This seems to have been disabled in the transition from vim to neovim, re-enable it.
* event: Reintroduce the immediate event queueThiago de Arruda2014-11-02
| | | | | | | | | | | | | Commit @264e0d872c("Remove automatic event deferral") removed the immediate event queue because event deferral now had to be explicit. The problem is that while some events don't need to be deferred, they still can result in recursive `event_poll` calls, and recursion is not supported by libuv. Examples of those are msgpack-rpc requests while a server->client request is pending, or signals which can call `mch_exit`(and that will result in `uv_run` calls). To fix the problem, this reintroduces the immediate event queue for events that can potentially result in event loop recursion. The non-deferred events are still processed in `event_poll`, but only after `uv_run` returns.
* job: Let job_start callers to selectively ignore stdioThiago de Arruda2014-10-31
| | | | | | | | Passing NULL as the callback for stdout/stderr will result in job_start ignoring stdout/stderr, respectively. A 'writable' boolean argument was also added, and when false `job_start` will ignore stdin. Also, refactor os_system to allow passing NULL as the `output` argument.
* Merge pull request #1312 from GokuITA/coverity1289Justin M. Keyes2014-10-30
|\ | | | | coverity/71507: Unchecked return value (CHECKED_RETURN)
| * coverity/71507: Unchecked return value (CHECKED_RETURN)Victor Fonseca2014-10-20
| | | | | | | | Don't check for err->set since object_to_vim always return false when error is set
* | api: Implement vim_command_output functionThiago de Arruda2014-10-28
| | | | | | | | | | This function can be used by API clients to execute a command and capture the output.
* | job/valgrind: Fix invalid reads/missing free.Scott Prager2014-10-28
| | | | | | | | | | | | | | | | 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.
* | eval: Defer execution of JobActivity autocommandsThiago de Arruda2014-10-21
| | | | | | | | | | | | 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.
* | msgpack-rpc: Create subdirectory for msgpack-rpc modulesThiago de Arruda2014-10-21
|/ | | | | 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
* rstream: Extract some RStream functionality to RBufferThiago de Arruda2014-10-18
| | | | | | | | 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.
* Merge pull request #1208 from war1025/dev/remove_for_all_windowsJustin M. Keyes2014-10-03
|\ | | | | Remove FOR_ALL_WINDOWS and replace with FOR_ALL_WINDOWS_IN_TAB(curtab)
| * Replace FOR_ALL_WINDOWS with FOR_ALL_WINDOWS_IN_TAB(curtab)Wayne Rowcliffe2014-09-24
| |
* | eval: Fix `save_tv_as_string` to handle non-string typesThiago de Arruda2014-10-01
| |
* | Implement save_tv_as_string to assist in #1176.Scott Prager2014-09-30
| |
* | Fix system() output truncation bug.Scott Prager2014-09-30
| | | | | | | | Replace NULs with SOH to restore the old behaviour of get_cmd_output().
* | vim-patch:7.4.256Scott Prager2014-09-30
| | | | | | | | | | | | | | | | | | Problem: Using systemlist() may cause a crash and does not handle NUL characters properly. Solution: Increase the reference count, allocate memory by length. (Yasuhiro Matsumoto) https://code.google.com/p/vim/source/detail?r=v7-4-256
* | Return list from rettv_list_alloc.Scott Prager2014-09-30
| |
* | vim-patch:7.4.248Scott Prager2014-09-30
| | | | | | | | | | | | | | Problem: Cannot distinguish between NL and NUL in output of system(). Solution: Add systemlist(). (ZyX) https://code.google.com/p/vim/source/detail?r=v7-4-248
* | vim-patch:7.4.247Scott Prager2014-09-30
| | | | | | | | | | | | | | | | | | | | | | Problem: When passing input to system() there is no way to keep NUL and NL characters separate. Solution: Optionally use a list for the system() input. (ZyX) https://code.google.com/p/vim/source/detail?r=v7-4-247 Implement write_list_to_string() as well since write_list() only works on files.
* | vim-patch:7.4.411André Twupack2014-09-22
|/ | | | | | | Problem: "foo bar" sorts before "foo" with sort(). (John Little) Solution: Avoid putting quotes around strings before comparing them. https://code.google.com/p/vim/source/detail?r=v7-4-411
* FOR_ALL_WINDOWS_IN_TAB and local variables in FOR_ALL_TAB_WINDOWSWayne Rowcliffe2014-09-22
|
* FOR_ALL_TABS helperWayne Rowcliffe2014-09-22
|
* Merge pull request #1197 from Shougo/vim-patch-7.4.392Justin M. Keyes2014-09-20
|\ | | | | vim-patch:7.4.392
| * vim-patch:7.4.392Shougo Matsushita2014-09-18
| | | | | | | | | | | | | | Problem: Not easy to detect type of command line window. Solution: Add the getcmdwintype() function. (Jacob Niehus) https://code.google.com/p/vim/source/detail?r=v7-4-392
* | api/msgpack-rpc: Improve error infrastructureThiago de Arruda2014-09-18
|/ | | | | | | | | | | | | | | | - Add error type information to `Error` - Rename `set_api_error` to `api_set_error` for consistency with other api_* functions/macros. - Refactor the api_set_error macro to accept formatted strings and error types - Improve error messages - Wrap error messages with gettext macro - Refactor msgpack-rpc serialization to transform Error instances into [type, message] arrays - Add error type information to API metadata - Normalize nvim->client and client->nvim error handling(change channel_send_call to accept an Error pointer instead of the `errored` boolean pointer) - Use macro to initialize Error structures