aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
Commit message (Collapse)AuthorAge
...
| * Remove char_u: add_pathsep()Mark Bainter2015-05-06
| |
* | vim-patch:7.4.574 #2539Bastian Winkler2015-05-03
|/ | | | | | | Problem: No error for eval('$'). Solution: Check for empty name. (Yasuhiro Matsumoto) https://github.com/vim/vim/commit/v7-4-574
* unify jobstart, termopen, and system interfacesScott Prager2015-05-02
| | | | | | | | | | | | | | | | | For any of these functions, if {cmd} is a string, execute "&shell &shellcmdflag '{cmd}'", or simply {cmd} if it's a list. In termopen(), if the 'name' option is not supplied, try to guess using '{cmd}' (string) or {cmd}[0] (list). Simplify ex_terminal to use the string form of termopen(). termopen: get name from argument Convert list_to_argv to tv_to_argv. Helped-by: Björn Linse <@bfredl> Helped-by: oni-link <knil.ino@gmail.com> Helped-by: Thiago de Arruda <@tarruda>
* term: use an argument vector for termopen().Scott Prager2015-05-02
| | | | | | | | | | | | | | | | | | | | | | Old behaviour: termopen('cmd') would run `&shell &shcf "cmd"`, which caused the functional tests to fail on some systems due to the process not "owning" the terminal. Also, it is inconsistent with jobstart(). Modify termopen() so that &shell is not invoked, but maintain the old behaviour with :terminal. Factor the common code for building the argument vector from jobstart() and modify the functional tests to call termopen() instead of :terminal (fixes #2354). Also: * Add a 'name' option for termopen() so that `:terminal {cmd}` produces a buffer named "term//{cwd}/{cmd}" and termopen() users can customize the name. * Update the documentation. * Add functional tests for `:terminal` sinse its behaviour now differs from termopen(). Add "test/functional/fixtures/shell-test.c" and move "test/functional/job/tty-test.c" there, too. Helped-by: Justin M. Keyes <@justinmk>
* vim-patch:7.4.633 #2526Florian Walch2015-04-28
| | | | | | | Problem: After 7.4.630 the problem persists. Solution: Also skip redo when calling a user function. https://github.com/vim/vim/commit/v7-4-633
* Enable -Wconversion: normal.c.Eliseo Martínez2015-04-27
| | | | | | | | | | | | | | | | | | | | | | | | Refactor summary: - extern int opcount --> extern long opcount - bool find_decl(..., int len, ...) --> bool find_decl(..., size_t len, ...) * int find_ident_under_cursor(...) --> size_t find_ident_under_cursor(...) - int find_ident_at_pos(...) --> size_t find_ident_at_pos(...) - int modify_fname(..., int *usedlen, ..., int *fnamelen) --> int modify_fname(..., size_t *usedlen, ..., size_t *fnamelen) * char_u *eval_vars(..., int *usedlen, ...) --> char_u *eval_vars(..., size_t *usedlen, ...) - int find_cmdline_var(..., int *usedlen) --> ssize_t find_cmdline_var(..., size_t *usedlen) - static char_u *repl_cmdline(..., int srclen, ...) --> static char_u *repl_cmdline(..., size_t srclen, ...) - bool get_visual_text(..., int *lenp) --> bool get_visual_text(..., size_t *lenp) * char_u *find_file_name_in_path(..., int len, ...) --> char_u *find_file_name_in_path(..., size_t len, ...) - static char_u *eval_includeexpr(..., int len) --> static char_u *eval_includeexpr(..., size_t len) - char_u *find_file_in_path(..., int len, ...) --> char_u *find_file_in_path(..., size_t len, ...) * char_u *find_file_in_path_option(..., int len, ...) --> char_u *find_file_in_path_option(..., size_t len, ...) - char_u *find_directory_in_path(..., int len, ...) --> char_u *find_directory_in_path(..., size_t len, ...) * int spell_move_to(...) --> size_t spell_move_to(...) - int spell_check(...) --> size_t spell_check(...) - static int spell_bad_len --> static size_t spell_bad_len - void find_pattern_in_path(..., int len, ...) --> void find_pattern_in_path(..., size_t len, ...) Helped-by: Justin M. Keyes <justinkz@gmail.com>
* Replace vim_isxdigit() with to ascii_isxdigit() defined in ascii.hFelipe Oliveira Carvalho2015-04-24
|
* Replace VIM_ISDIGIT() and vim_isdigit() with ascii_isdigit() defined in ascii.hFelipe Oliveira Carvalho2015-04-24
|
* Replace vim_iswhite with ascii_iswhite() defined in ascii.hFelipe Oliveira Carvalho2015-04-24
|
* rpcstart: check argvars, /then/ alloc argv #2462Scott Prager2015-04-23
| | | | fixes #2458
* Add if_python3 supportShougo Matsushita2015-04-21
| | | | | Reviewed-by: Michael Reed <m.reed@mykolab.com>, Daniel Hahler <github@thequod.de> Helped-by: Daniel Hahler <github@thequod.de>
* Merge #2418: Remove char_u (4)Eliseo Martínez2015-04-19
|\ | | | | | | | | | | Reviewed-by: Scott Prager <splinterofchaos@gmail.com> Reviewed-by: Michael Reed <m.reed@mykolab.com> Reviewed-by: Eliseo Martínez <eliseomarmol@gmail.com>
| * Refactor get_env() to respect const qualifierMark Bainter2015-04-18
| | | | | | | | | | | | Without the casts*, the compiler rightly warns about the os_getenv losing the qualifier. This refactor adds a variable to manage this properly, and renames the original variables to increase clarity.
| * Remove char_u: vim_setenv()Mark Bainter2015-04-18
| |
| * Remove char_u: vim_getenv()Mark Bainter2015-04-17
| |
| * Remove char_u: after_pathstep()Mark Bainter2015-04-17
| | | | | | | | See: #459
* | Merge pull request #2443 from jszakmeister/fix-more-release-warningsJohn Szakmeister2015-04-18
|\ \ | | | | | | Fix a few uninitialized variable warnings.
| * | Fix an uninitialized variable warning for call_start.Eliseo Martínez2015-04-18
| |/
* / ops.c: eliminate unneccesary static variable `y_append`Björn Linse2015-04-17
|/
* Eval: do not join a list if it's empty anyway #2441Marco Hinz2015-04-16
| | | | | | | | | | This spares some work and also prevents list_join() from calling ga_init() with a growsize of 0 which would lead to the nvimlog being littered with: [warning @ ga_set_growsize:64] 17675 - trying to set an invalid ga_growsize: 0 Also in Vim 7.4.702 https://github.com/vim/vim/commit/5216f767d4070d0085de6fa1391e6f2991c1baa5
* eval: learn serverstart, list, and close().Scott Prager2015-04-14
| | | | | | Implement functions for spawning, destroying, and listing active servers, and add server_address_list() to msgpack_rpc/server.c for the serverlist() vimL function.
* memory: Add `free` wrapper and refactor project to use itThiago de Arruda2015-04-13
| | | | | | We already use wrappers for allocation, the new `xfree` function is the equivalent for deallocation and provides a way to fully replace the malloc implementation used by Neovim.
* memory: Replace klib memory pools by malloc/freeThiago de Arruda2015-04-12
| | | | | | Klib pools were used to improve allocation efficiency for some small objects, but it is not a thread-safe approach. Thread safety in allocations will be required for implementing #2371).
* eval: Fix memory deallocation of JobEventThiago de Arruda2015-04-12
| | | | This causes a "read after free" error when kmp_free is replaced by `free`.
* eval: Fix `jobwait()`Thiago de Arruda2015-04-11
| | | | | | - Properly save job event deferring state for recursive calls - Disable breakcheck while running. Breakcheck can invoke job callbacks in unexpected places.
* eval: Fix segfault caused by passing invalid callback to jobstartThiago de Arruda2015-04-11
|
* Remove unused 'if_[language].txt': Clean upMichael Reed2015-04-10
| | | | | | Regarding |script-here|: despite being a language agnostic piece of advice, it was in `if_perl.txt`. Regardless, we now only have one support for one legacy plugin interface, so put it in `if_pyth.txt`
* eval: do not assume a vval.v_string is nonnull.Scott Prager2015-04-08
| | | | | | | | | | | In the fallowing functions, use get_tv_string() to safely avoid a NULL pointer dereference. * rpcstart * rpcrequest * rpcnotify * jobstart fixes #2321
* system(): Return an empty string if no output.Scott Prager2015-04-08
| | | | fixes #2286
* Fix warnings: eval.c: f_termopen(): Use-after-free: MI.Eliseo Martínez2015-04-07
| | | | | | | | | | | | | | | | | | | | | | | Problem : Use-after-free @ 15081. Diagnostic : Multithreading issue. Rationale : `get_dict_callback` can return NULL on two different cases: 1) when the dict doesn't contain the given key; this case is not considered an error. 2) when the key exists but there's some problem with its value; this is considered an error. Then, code calling `get_dict_callback` in `common_job_callbacks`, as well as code calling `common_job_callbacks`, uses `did_emsg` to distinguish between error/non-error cases. Suggested error path presumes an error condition within `common_job_callbacks`, with `did_emsg` being true, but then being false just after returning to calling code in `f_termopen`. That, clearly, could only happen if another thread run in between those points. Resolution : Refactor `get_dict_callback` and `common_job_callbacks`, so that they clearly distinguish between error/non-error situations, without recurring to globals.
* Fix warnings: eval.c: f_jobstart(): Np dereference: FP.Eliseo Martínez2015-04-07
| | | | | | | | Problem : Dereference of null pointer @ 10812. Diagnostic : False positive. Rationale : `args->lv_first` can't be NULL, as we have just stated above that that there's at least one item. Resolution : Assert.
* eval: Ensure all job callbacks are invoked by `jobwait()`Thiago de Arruda2015-04-02
| | | | | A call to `event_poll` is required to ensure the exit callback from the last job is invoked.
* eval: Add internal_refcount field to dict_TThiago de Arruda2015-04-02
| | | | | | | | Due to the way vimscript garbage collection handles cyclic references, its not possible to rely on incrementing `dv_refcount` to prevent dicts still used internally from being collected: If a object with dv_refcount > 0 isn't reachable by vimscript code, it will be freed when `garbage_collect()` is called. Add the `internal_refcount` field to prevent this.
* os_scandir: fname_case -> path_fix_caseScott Prager2015-03-31
| | | | | | | | | | Use os_scandir(). fname_case() only gets used when `defined(USE_FNAME_CASE)` (on operating systems with case-insensitive file systems), but may be useful in other contexts, so move it to path.c. (See the TODO.) Remove the unused parameter, len.
* Create new mode() value for terminal-mode ('t') #2287Harm te Hennepe2015-03-27
|
* eval: Improve validation of ids passed to job functionsThiago de Arruda2015-03-29
| | | | | Use the `is_user_job` to ensure that the job was started by `jobstart` or `termopen`.
* eval: Implement `jobclose()` vimscript functionThiago de Arruda2015-03-29
|
* eval: Implement `jobwait()` vimscript functionThiago de Arruda2015-03-29
|
* eval: Refactor vimscript job control APIThiago de Arruda2015-03-29
| | | | | | | | | | - Remove JobActivity autocmd and v:job_data variable - Simplify `jobstart` to receive: - An argument vector - An optional dictionary which may contain any of the current `jobstart` options plus `on_stdout`, `on_stderr` and `on_exit` callbacks. - Refactor and add more job tests - Update documentation
* eval: Refactor `call_func` and `func_unref`Thiago de Arruda2015-03-29
| | | | | | - Make it possible to call or unref ufunc_T pointers directly. - Keep refcount of named functions, and stop them from being deleted if the refcount is greater than 1.
* job: Fix memory errorsoni-link2015-03-25
| | | | - Free memory allocated for job data when the job table is full.
* terminal: New module that implements a terminal emulatorThiago de Arruda2015-03-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit integrates libvterm with Neovim and implements a terminal emulator with nvim buffers as the display mechanism. Terminal buffers can be created using any of the following methods: - Opening a file with name following the "term://[${cwd}//[${pid}:]]${cmd}" URI pattern where: - cwd is the working directory of the process - pid is the process id. This is just for use in session files where a pid would have been assigned to the saved buffer title. - cmd is the command to run - Invoking the `:terminal` ex command - Invoking the `termopen` function which returns a job id for automating the terminal window. Some extra changes were also implemented to adapt with terminal buffers. Here's an overview: - The `main` function now sets a BufReadCmd autocmd to intercept the term:// URI and spawn the terminal buffer instead of reading the file. - terminal buffers behave as if the following local buffer options were set: - `nomodifiable` - `swapfile` - `undolevels=-1` - `bufhidden=hide` - All commands that delete buffers(`:bun`, `:bd` and `:bw`) behave the same for terminal buffers, but only work when bang is passed(eg: `:bwipeout!`) - A new "terminal" mode was added. A consequence is that a new set of mapping commands were implemented with the "t" prefix(tmap, tunmap, tnoremap...) - The `edit` function(which enters insert mode) will actually enter terminal mode if the current buffer is a terminal - The `put` operator was adapted to send data to the terminal instead of modifying the buffer directly. - A window being resized will also trigger a terminal resize if the window displays the terminal.
* doc: Misc. cleanupJustin M. Keyes2015-03-24
| | | | | | | | | | Add missing parentheses and whatnot, move dangling comment, etc. Some specific items worth mentioning: Fixed some references to non-existent tags, found via `make html` msgpack_rpc/channel.c: ELOG already prefixes each line with "error @ ..."
* refactor: split some more functions from misc1.cbobtwinkles2015-03-24
| | | | | | | | | | | This commit pulls the some environment-variable handling functions out of misc1.c and in to os/env.c. Previously submited as #1231, this is the start of a patch series that does that work based on a more up-to-date master branch. Major tasks accomplished: - move functions and fix includes - fix clint/clang analysis warnings - correct documentation comments
* Remove *_BUILTIN_TCAPS & 'ttybuiltin'Michael Reed2015-03-22
| | | | | 'ttybuiltin' was removed and *_BUILTIN_TCAPS was made into dead code in PR #1820.
* vim-patch:7.4.503 #2178Perry Hung2015-03-20
| | | | | | | | | | | | | | | | Problem: Cannot append a list of lines to a file. Solution: Add the append option to writefile(). (Yasuhiro Matsumoto) https://code.google.com/p/vim/source/detail?r=v7-4-503 -Ported old legacy test over to test/functional/legacy/writefile_spec.lua -Tests for mapping and signs from the original patch were removed since they have nothing to do this with feature Tested with: make oldtest, make test on OS X. Signed-off-by: Perry Hung <iperry@gmail.com>
* Reuse f_browse function from f_browsedirAnton Ovchinnikov2015-03-16
| | | | The bodies of f_browse() and f_browsedir() were identical.
* config: split out versiondef.h from config.hBjörn Linse2015-03-08
| | | | This avoids recompiling every c file after comitting.
* vim-patch:7.4.578oni-link2015-03-04
| | | | | | | | Problem: Using getcurpos() after "$" in an empty line returns a negative number. Solution: Don't add one when this would overflow. (Hirohito Higashi) https://code.google.com/p/vim/source/detail?r=v7-4-578
* jobsend: Don't append extra newline after last itemBjörn Linse2015-03-03
| | | | This allows sending binary data that is not newline terminated