Commit Graph

2595 Commits

Author SHA1 Message Date
David Bürgin
21f446ebb4 vim-patch:7.4.324
Problem:    In Ex mode, cyrillic characters are not handled. (Stas Malavin)
Solution:   Support multi-byte characters in Ex mode. (Yukihiro Nakadaira)

https://github.com/vim/vim/releases/tag/v7-4-324
2015-03-30 12:03:33 +02:00
Thiago de Arruda
88d8ca73f9 eval: Improve validation of ids passed to job functions
Use the `is_user_job` to ensure that the job was started by `jobstart` or
`termopen`.
2015-03-29 20:35:45 -03:00
Thiago de Arruda
b8b9e5ebad eval: Implement jobclose() vimscript function 2015-03-29 20:35:44 -03:00
Thiago de Arruda
028f6d7d3f eval: Implement jobwait() vimscript function 2015-03-29 20:35:44 -03:00
Thiago de Arruda
6e7757ad51 eval: Refactor vimscript job control API
- 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
2015-03-29 20:35:44 -03:00
Thiago de Arruda
4b98ea1e80 eval: Refactor call_func and func_unref
- 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.
2015-03-29 20:35:44 -03:00
David Bürgin
2c7e8c38e0 vim-patch:7.4.502 #2282
Problem:    Language mapping also applies to mapped characters.
Solution:   Add the 'langnoremap' option, when on 'langmap' does not apply to
            mapped characters. (Christian Brabandt)

https://github.com/vim/vim/releases/tag/v7-4-502
2015-03-29 09:55:59 -04:00
David Bürgin
d06b4933ed vim-patch:7.4.529 #2270
Problem:    No test for what 7.4.517 fixes.
Solution:   Adjust the tests for breakindent. (Christian Brabandt)

https://github.com/vim/vim/releases/tag/v7-4-529
2015-03-27 12:55:52 -04:00
David Bürgin
fa8ccda518 Vim patch: Add missing patch version 422 in version.c #2268
Completes #1332.
2015-03-27 12:13:07 -04:00
Harm te Hennepe
27ead64da0 Create new mode() value for terminal-mode ('t') #2287 2015-03-27 05:25:28 -04:00
Thiago de Arruda
41b05a0a3c tui: Fix reading when stdin is not a tty
Instead of selecting stderr on startup if stdin is not a tty, first try reading
from it and only switch to stderr when reading fails. With this behavior we
support commands like:

```
echo q | nvim -es
```

and

```
ls *.md | xargs nvim
```

Fixed small bugs in rstream.c to make this happen.
2015-03-26 22:06:57 -03:00
Thiago de Arruda
710002c820 job: Close the process in a queued event handler
Since all reads are queued by the event loop, we must also queue the exit event,
or else the process_close function can close the job streams before received
data is processed.
2015-03-25 18:57:35 -03:00
oni-link
727f524167 job: Fix memory errors
- Free memory allocated for job data when the job table is full.
2015-03-25 18:57:35 -03:00
Thiago de Arruda
cdedd89d22 terminal: New module that implements a terminal emulator
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.
2015-03-25 18:57:35 -03:00
Thiago de Arruda
6f471fa4fc event: Ensure the loop is stopped when a event is pushed. 2015-03-25 18:57:35 -03:00
Thiago de Arruda
b16c5bf5e6 buffer: Move b_p_ma(modifiable) checks into the MODIFIABLE macro 2015-03-25 18:57:35 -03:00
Thiago de Arruda
8b6b06c2e0 buffer: Add WITH_BUFFER macro to simplify global buffer modification
Most internal functions to modify buffers operate on the current buffer and
require temporary switchs. This macro is a temporary workaround until a cleaner
refactoring of the internal API is performed.
2015-03-25 18:57:35 -03:00
Thiago de Arruda
2b90aed831 vim.h: remove #ifndef EINTR
This ifndef causes problems when including fileio headers.
2015-03-25 18:57:35 -03:00
Thiago de Arruda
071aca9c8a api: Move switch_to_win_for_buf/restore_win_for_buf to api helpers 2015-03-25 18:57:35 -03:00
Thiago de Arruda
05d60c4812 ui: Schedule screen refreshs to run in the event loop
This is required to avoid event loop recursion due to indirect calls to
os_breakcheck by screenalloc
2015-03-25 18:57:35 -03:00
Thiago de Arruda
51c69b89a7 map: Add Map(int, int) 2015-03-25 18:57:34 -03:00
Thiago de Arruda
05c030c725 map: Add map_clear method 2015-03-25 18:57:34 -03:00
Thiago de Arruda
5cf3dec9a9 syntax: Fix possible invalid read in hl_combine_attr 2015-03-25 18:57:34 -03:00
David Bürgin
d2d99454e6 tests: Migrate legacy test 94 #2218 2015-03-25 16:33:24 -04:00
Michael Reed
d85fabc24f doc: Remove refs to 'compatible' and friends
Also remove some MS-DOS references on lines already being touched.

Based on this commit:
e4db01ca87
2015-03-24 19:33:42 -04:00
Justin M. Keyes
adfc8cf50a doc: Misc. cleanup
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 @ ..."
2015-03-24 19:29:29 -04:00
Michael Reed
bb7aa04e61 Remove --nofork / -f remnants 2015-03-24 19:29:29 -04:00
bobtwinkles
03d47965c0 refactor: split some more functions from misc1.c
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
2015-03-24 16:13:00 -04:00
oni-link
56ef37eb59 job: Fix memory error
Fix pointer passed to the handles in the uv_close() calls when process_spawn()
fails.
2015-03-24 10:56:53 -03:00
Thiago de Arruda
a6fb511c7f job: Fix process cleanup using SIGCHLD/waitpid
Add a SIGCHLD handler for cleaning up pty processes passing the WNOHANG flag. It
may also be used to cleanup processes spawned with uv_spawn.
2015-03-24 10:56:42 -03:00
Justin M. Keyes
424c04f2c9 Merge pull request #2214 from Pyrohh/version-cleanup
Version output cleanup
2015-03-23 08:20:22 -04:00
Michael Reed
8c19152dcb version.c: Clean up --version / :version output
Despite the +/- prefix, the majority of these features have been made
non-optional at compile time, so their presence here is misleading.

Also mention `:h vim-differences` to make it clear our that many
features are non-optional.
2015-03-22 16:55:50 -04:00
Björn Linse
1257b303ac Merge pull request #2212 from bfredl/concealfix
fix missing  conceal cchar when it is the first syntax group shown
2015-03-22 21:17:35 +01:00
Michael Reed
eea804ab59 Remove *_BUILTIN_TCAPS & 'ttybuiltin'
'ttybuiltin' was removed and *_BUILTIN_TCAPS was made into dead code in
PR #1820.
2015-03-22 15:41:29 -04:00
Eliseo Martínez
44b563409e Passing-by: Add function attributes. 2015-03-22 11:32:30 +01:00
Eliseo Martínez
c6784d9f6f coverity/105985: Resource leak: RI.
Problem    : Resource leak @ 94, 98, 102.
Diagnostic : Real issue.
Rationale  : Coverity doesn't know that uv_pipe_open will save file
             descriptor to close them later. So, it signals file
             descriptors being leaked. This would then seem like a false
             positive we can fix by teaching coverity about uv_pipe_open
             through model file.
             But then we realize that the above is only true if
             uv_pipe_open succeeds. It it fails, then descriptors are
             really being leaked, which is why this is considered a real
             issue and not a false positive after all.
Resolution : Add error handling to correctly close descriptors if
             uv_pipe_open fails at any point.
             Add model for uv_pipe_open so that Coverity knows it will
             save descriptors when no error.

Helped-by: oni-link <knil.ino@gmail.com>
2015-03-22 11:32:30 +01:00
Eliseo Martínez
a2b4535747 coverity/105982: Unckecked return value: RI.
Problem    : Unchecked return value from library @ 91.
Diagnostic : Real issue.
Rationale  : fcntl can fail, which is not being checked.
Resolution : Add corresponding error handling.

Helped-by: oni-link <knil.ino@gmail.com>
2015-03-22 11:32:20 +01:00
Eliseo Martínez
3db0a40d69 coverity/105568: Free of array-typed value: FP.
Problem    : Free of array-typed value @ 3628.
Diagnostic : False positive.
Rationale  : expand_shell_cmd() is called with a mock value for file
             (*file = (char_u **)""). That means we want file to be
             filled with a new value. We can't use *file = NULL because
             that means we don't want file to be filled.
             Now, coverity incorrectly thinks that sentinel value is the
             one we are freeing up at some other later point, which is
             not the case.
Resolution : Assert that, when we are freeing *file, its value is
             different than the sentinel one.
2015-03-22 11:31:47 +01:00
Eliseo Martínez
fb44a233a5 coverity/13777: String not null terminated: RI.
Problem    : String not null terminated @ 1543.
Diagnostic : Real issue.
Rationale  : We are reading a struct block0, which contains some string
             fields, from a file, without checking for string fields to
             be correctly terminated. That could cause a buffer overrun
             if file has somehow been garbled.
Resolution : Add string fields check for nul termination.
             Mark issue as intentional (there seems to be no way of
             teaching coverity about read_eintr being ok that way).

Helped-by: oni-link <knil.ino@gmail.com>
2015-03-22 11:31:46 +01:00
Björn Linse
04c8235df0 vim-patch: mark 7.4.673 as included 2015-03-21 22:05:50 +01:00
Björn Linse
19ca54b969 syntax: let first syntax item seqnr be 1 instead of 0
in screen.c:win_line seqnr 0 represents the state: no current syntax
item
2015-03-21 13:48:29 +01:00
Perry Hung
26e6bca769 vim-patch:7.4.503 #2178
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>
2015-03-20 17:54:28 -04:00
Thiago de Arruda
8dd415e887 tui: Add support for true color terminals
This is enabled by setting the `$NVIM_TUI_ENABLE_TRUE_COLOR` environment
variable, eg:

```
$ NVIM_TUI_ENABLE_TRUE_COLOR=1 nvim
```
2015-03-20 13:20:21 -03:00
John Szakmeister
90bce5ad38 Merge pull request #2144 from jszakmeister/fix-warning-in-release
Fix a couple warnings in the release build.
2015-03-20 09:54:06 -04:00
Perry Hung
657d274520 Remove BINARY_FILE_IO option #2179
The 'binary' mode flag is ignored on all POSIX conforming systems (man 3
fopen). For all the others, BINARY_FILE_IO needs to be set.

Always set BINARY_FILE_IO.

Signed-off-by: Perry Hung <iperry@gmail.com>
2015-03-18 04:42:39 -04:00
Michael Reed
8f6ecc4089 misc2.c: Move emsg* functions to message.c #2152
Clean up said functions and some outdated comments while we're at it.
2015-03-19 18:33:39 -04:00
Björn Linse
a040aa95c1 tests/legacy: convert test 63 (:match and matchadd() ) 2015-03-19 23:09:56 +01:00
Justin M. Keyes
63d2564409 tests: update legacy Makefile #2186
Many tests were migrated, but entries were left in the old Makefile.
2015-03-19 11:02:49 -04:00
Thiago de Arruda
4d63d99174 main: Simplify code that deals with early user input
A read stream will be started before the first ex command is processed. This
stream will be used to read early user input before handling control over to the
UI module.

Which stdio stream will be used depends on which types of file descriptors are
connected, and whether the "-" argument was passed.
2015-03-18 21:28:20 -03:00
Thiago de Arruda
8b7b71f474 ui: Refactor so that busy state won't be the default
Even though assuming nvim is busy most times is simpler, it has a problem: A lot
of unnecessary busy_start/busy_stop notifications are sent to the UI. That's
because in the majority of scenarios almost no time is spent between
`event_poll` calls.

This restores the normal behavior which is to call busy_start only when nvim is
going to perform some task that can take a significant amount of time. Also
improve the usage of buffering in the TUI when changing the cursor state.
2015-03-18 14:16:23 -03:00