aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
Commit message (Collapse)AuthorAge
...
* 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
* illumos requires the use of limits.h for things like INT_MAX #2049Mike Zeller2015-02-26
|
* job: Allow spawning jobs connected to pseudo terminalsThiago de Arruda2015-02-23
|
* job: Refactor process spawning and startup argumentsThiago de Arruda2015-02-23
| | | | | | | | - process spawning was decoupled from the rest of the job control logic. The goal is reusing it for spawning processes connected to pseudo terminal file descriptors. - job_start now receives a JobOptions structure containing all the startup options.
* eval: Fix buffering of data in job autocommandsThiago de Arruda2015-02-23
| | | | | Job autocommands will no longer buffer data chunks that don't end in newlines characters.
* refactor: Remove term modules and termcap optionsThiago de Arruda2015-02-21
| | | | | | | | | | | | | | | - Removed term.c, term.h and term_defs.h - Tests for T_* values were removed. screen.c was simplified as a consequence(the best strategy for drawing is implemented in the UI layer) - Redraw functions now call ui.c functions directly. Updates are flushed with `ui_flush()` - Removed all termcap options(they now return empty strings for compatibility) - &term/&ttybuiltin options return a constant value(nvim) - &t_Co is still available, but it mirrors t_colors directly - Remove cursor tracking from screen.c and the `screen_start` function. Now the UI is expected to maintain cursor state across any call, and reset it when resized. - Remove unused code
* vim-patch:7.4.525 #1988Fabian Brosda2015-02-19
| | | | | | | Problem: map() leaks memory when there is an error in the expression. Solution: Call clear_tv(). (Christian Brabandt) https://code.google.com/p/vim/source/detail?r=v7-4-525
* Enable -Wconversion: mark.c.Eliseo Martínez2015-02-18
| | | | | | Refactoring summary: - MB_STRNICMP: Inlined. - MB_STRNCMP: Inlined.
* syntax: Refactor to store all term and gui attributes independentlyThiago de Arruda2015-02-16
| | | | | Now the attrentry_T structure will store all attributes in separate fields for cterm and rgb UIs.
* ui: Remove/adapt some old code for a big UI refactorThiago de Arruda2015-02-16
| | | | | | | | | | | | | - Remove abstract_ui global, now it is always active - Remove some terminal handling code - Remove unused functions - Remove HAVE_TGETENT/TERMINFO/TERMIOS/IOCTL #ifdefs - Remove tgetent/terminfo from version.c - Remove curses/terminfo dependencies - Only start/stop termcap when starting/exiting the program - msg_use_printf will return true if there are no attached UIs( messages will be written to stdout) - Remove `ex_winpos`(implement `:winpos` with `ex_ni`)
* Remove nonnullret deadcode: xmalloc.Eliseo Martínez2015-01-27
|
* Remove nonnullret deadcode: vim_strsave.Eliseo Martínez2015-01-27
|
* vim-patch:7.4.446Pavel Platto2015-01-20
| | | | | | | | | Problem: In some situations, when setting up an environment to trigger an autocommand, the environment is not properly restored. Solution: Check the return value of switch_win() and call restore_win() always. (Daniel Hahler) https://code.google.com/p/vim/source/detail?r=v7-4-446
* Remove long_u: ex_docmd.c: Refactor long_u.Eliseo Martínez2015-01-19
|
* Merge pull request #1816 from Pyrohh/macro_cleanupJustin M. Keyes2015-01-15
|\ | | | | Macro cleanup
| * Macro cleanup: PROTOMichael Reed2015-01-14
| | | | | | | | | | | | Regarding dict_lookup() in eval.c: both definitions are the same, the only difference being the spacing between the indirection operator and the indentation level.
* | main: Fix color schemes for abstract_uiThiago de Arruda2015-01-13
|/ | | | | | | | | - Set 't_Co' to 256 at startup. The value can be changed by the user for compatibility with terminals that are less capable. - `has('gui_running')` will return 1 if at least one rgb UI is attached. Even though these changes are hacky, they are necessary to make the transition to the new UI architecture smoother.
* Revert "[WIP] "abstract_ui" fixes and improvements"Justin M. Keyes2015-01-12
|
* Merge pull request #1657 from tarruda/abstract-ui-fixesJustin M. Keyes2015-01-12
|\ | | | | [WIP] "abstract_ui" fixes and improvements
| * ui: Test for abstract_ui whenever a minimal t_colors value is requiredThiago de Arruda2015-01-10
| | | | | | | | | | t_colors should not be checked when abstract_ui is active, because nvim UI is not limited to a terminal.
* | Cleanup: Rename getdigits() family functions.Eliseo Martínez2015-01-11
| |