Commit Graph

3097 Commits

Author SHA1 Message Date
Thiago de Arruda
9d02e5b984 test: Add missing before_each call to sign_spec.lua
Without this the test will inherit the previous test environment, causing random
failures.

Close #2243
2015-03-28 12:04:14 -03: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
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
Michael Reed
c47e0d6210 doc: Introduce vim-differences #2141
This documents the differences between nvim and nvim.

Regarding the removal of references to 'renderoptions': it was never
added in the first place, so there's no need to mention its "removal".
2015-03-26 17:36:40 -04:00
Florian Walch
13f0ef66b4 doc: Document g:python_host_prog. #2205 2015-03-26 17:30:26 -04:00
Thiago de Arruda
a6e53a3797 Merge PR #2076 'Builtin terminal emulation' 2015-03-25 22:08:14 -03:00
Thiago de Arruda
2aa2513b8e test: Add terminal tests
- Modify tty-test to allow easier control over the terminal
- Add a new directory with various terminal tests/specifications
- Remove a pending job/pty test.
- Flush stdout in Screen:snapshot_util() (avoid waiting for the test to finish)
- Replace libuv sigwinch watcher by a sigaction handler. libuv randomly fails to
  deliver signals on OSX. Might be related to the problem fixed by
  @bbcddc55ee1e5605657592644be0102ed3a5f104 (under the hoods, libuv uses a pipe
  to deliver signals to the main thread, which might be blocking in some
  situations)
2015-03-25 18:57:36 -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
Justin M. Keyes
c56c035576 Merge #2236 'docs cleanup' 2015-03-24 19:53:31 -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
Justin M. Keyes
ab68ac4c02 doc: Add one-liner job control example 2015-03-24 19:29:29 -04:00
Michael Reed
c60dd09408 doc: Cleanup for #2099
Said PR changed the behavior of `undercurl` in the TUI, but didn't
document it.
2015-03-24 19:29:29 -04:00
Michael Reed
bb7aa04e61 Remove --nofork / -f remnants 2015-03-24 19:29:29 -04:00
Justin M. Keyes
e16ff72e71 Merge #2148 'misc1.c: split some environment functions' 2015-03-24 16:29:18 -04:00
bobtwinkles
3fc18e25b8 refactor: add tests for env_expand_esc 2015-03-24 16:13:00 -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
Thiago de Arruda
ed1070bb24 Merge PR #2146 'Improve functional test debuggability and efficiency' 2015-03-24 12:59:59 -03:00
Thiago de Arruda
1ee7ca7bc0 test: Improve functional test debuggability and efficiency
- Read TEST_TAG/TEST_FILTER env vars from cmake/RunTests.cmake. Setting these
  environment variables will pass --tags/--filter to busted, which can used to
  filter which tests are executed.
- Remove calls to nvim msgpack-rpc API outside tests. This removes the
  requirement of having a static `clear` call in test/functional/helpers.lua
- Use the new busted command-line option "--lazy" to ensure the setup/teardown
  hooks are only executed when a suite runs at least one test.

Now its possible to run/debug a single test like this:

```sh
TEST_FILTER='some test string' make test
```

Which will only run tests containing "some test string" in the title.
Another option is:

```sh
TEST_TAG=some-tag make test
```

After putting #some-tag into the test title. This also improves debugging
experience because there will be no unnecessary gdbserver instances whe GDB=1 is
passed.
2015-03-24 12:46:15 -03:00
Thiago de Arruda
47e90ea1c5 test: Extract code to spawn nvim into the "spawn" helper function
This is can be used for spawning nvim outside a test context. Also refactor
screen.lua to use this function when loading the color map(It is better because
the GDB/VALGRIND environment variables are ignored)
2015-03-24 12:46:15 -03:00
Thiago de Arruda
5874bc28ea deps: Update busted and dependencies 2015-03-24 12:46:15 -03:00
Thiago de Arruda
5860d65f9c Merge PR #2237 'Job fixes to core and tests' 2015-03-24 12:04:46 -03:00
Thiago de Arruda
d6369707c2 test: Fix tty-test program
The "tty ready" string must only be printed when the process is ready to receive
signals, and this only happens when the event loop has started.
2015-03-24 10:56:53 -03: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
John Szakmeister
0c6fdd5251 Merge pull request #2213 from jszakmeister/add-junit-support
build: add support for running the tests in junit format
2015-03-24 06:00:44 -04: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
4bc62c76c7 Merge #2184: Fix coverity issues. (6)
Reviewed-by: oni-link <knil.ino@gmail.com>
2015-03-22 11:45:48 +01: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