Commit Graph

3133 Commits

Author SHA1 Message Date
oni-link
db3ae72d19 Prevent too early sending of delayed notifications.
Notifications for a channel will be sent directly if there are no
pending requests (for this channel). Otherwise notifications are queued
for later sending.

But in two cases a notification could be sent with pending requests:
* Broadcasting a notification
* A channel that has just finished its last pending request
  would call send_delayed_notifications() for all channels.

To prevent this, every channel can now only send its own delayed
notifications and broadcasting checks for pending requests.
2015-04-03 08:03:25 -03:00
John Szakmeister
ab02637592 Merge pull request #2318 from yshui/master
CMakeLists: fix build when there're multiple arguments in C_FLAGS
2015-04-03 04:57:44 -04:00
Michael Reed
dfdc6a76b1 README.md: Avoid redirect in wiki link 2015-04-02 17:46:08 -04:00
Thiago de Arruda
1b2e991cf2 Merge PR #2314 'Add vimexpect library and example gdb plugin' 2015-04-02 11:55:17 -03:00
Thiago de Arruda
617878f747 runtime: Add vimexpect library and example gdb plugin
This library makes it easier to script communication with interactive programs.
It is similar to what the "expect" tcl extension does, but uses an object
oriented API and is designed to integrate nicely with Neovim job control.
2015-04-02 11:33:48 -03:00
Thiago de Arruda
6abde99ff2 test: Remove indeterminism from jobwait tests
- Use on_exit instead of on_stdout since there's no guarantee that the OS will
  send the data in time(It fails randomly in slow environments such as
  travis/valgrind)
- Increase the timeout gap for the "jobwait with timeout" test
2015-04-02 11:33:48 -03:00
Thiago de Arruda
d487dc1a9a eval: Ensure all job callbacks are invoked by jobwait()
A call to `event_poll` is required to ensure the exit callback from the last job
is invoked.
2015-04-02 11:33:48 -03:00
Thiago de Arruda
2b7f460716 eval: Add internal_refcount field to dict_T
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.
2015-04-02 11:33:48 -03:00
David Bürgin
b3f07b2468 vim-patch:7.4.336 #2299
Problem:    Setting 'history' to a big value causes out-of-memory errors.
Solution:   Limit the value to 10000. (Hirohito Higashi)

https://github.com/vim/vim/tree/v7-4-336
2015-04-02 01:22:02 -04:00
Michael Reed
119a3f2485 Merge pull request #2124 from Pyrohh/improve-contrib
[RDY] CONTRIBUTING.md: Misc improvements
2015-04-01 13:56:29 -04:00
Michael Reed
82d2b8a45f CONTRIBUTING.md: Review
Helped-by: Florian Walch <florian@fwalch.com>
Helped-by: oni-link <knil.ino@gmail.com>
2015-04-01 13:46:54 -04:00
Florian Walch
4b585c52f3 Merge pull request #2284 from glts/vim-7.4.515
vim-patch:7.4.515
2015-04-01 16:34:52 +03:00
David Bürgin
db90dcb6fd vim-patch:7.4.515
Problem:    In a help buffer the global 'foldmethod' is used.  (Paul Marshall)
Solution:   Reset 'foldmethod' when starting to edit a help file.  Move the
            code to a separate function.

https://github.com/vim/vim/releases/tag/v7-4-515
2015-04-01 14:41:53 +02:00
Michael Reed
3e6989b5ec Merge pull request #2279 from Pyrohh/modeline
[RDY] Small modeline cleanup
2015-03-31 16:58:31 -04:00
Michael Reed
00e1b62ca8 Modeline cleanup
If users want folds to be automatically collapsed, then they should just
set foldmethod=marker in their vimrc.
2015-03-31 16:56:41 -04:00
Prajjwal Bhandari
d2c3592da1 Remove potential NULL dereference. #2316
This also removes the `#elseif defined(MSWIN)` clause. Due to the
enclosing `if` block, we will never get to this point when src starts with
a '%', making the whole #elseif block dead code.
2015-03-31 22:36:38 +02:00
Florian Walch
7080041465 Merge pull request #2296 from glts/vim-7.4.324
[RDY] vim-patch:7.4.324
2015-03-31 23:07:13 +03:00
Yuxuan Shui
80e80e467f CMakeLists: fix build when there're multiple arguments in C_FLAGS
Because the COMMAND arguments of custom_command takes a list, and
CMAKE_C_FLAGS is a string, it will be treated as a single long
argument, which will cause the build to fail.
2015-03-31 14:46:17 -04:00
Thiago de Arruda
ad7a317c42 Merge PR #1212 'os_scandir/scandir_next/closedir()' 2015-03-31 11:50:39 -03:00
Scott Prager
feca9624b8 CMakeLists: enable USE_FNAME_CASE on Mac 2015-03-31 11:20:24 -03:00
Scott Prager
93bfe6a400 path_fix_case: unit test 2015-03-31 11:20:24 -03:00
Scott Prager
0f4976687d os_scandir: fname_case -> path_fix_case
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.
2015-03-31 11:20:23 -03:00
Scott Prager
24da0d49d0 os_scandir: mch/unix_expandpath() -> path_expand()
Merge unix_expandpath with dos_expandpath from upstream vim and use
os_scandir() over POSIX readdir().
2015-03-31 11:20:23 -03:00
Scott Prager
3f74067565 Un-mch mch_has_(exp_)wildcard().
Merge mch_has_wildcard() and mch_has_exp_wildcar() with their upstream
equivalents for Windows and replace the "mch_" suffix with "path_".
2015-03-31 11:20:23 -03:00
Scott Prager
99869989c8 os_scandir(), scandir_next(), and os_closedir() 2015-03-31 11:20:23 -03:00
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
960b9108c2 Merge PR #2247 'Refactor/enhance job api' 2015-03-29 21:07:56 -03:00
Thiago de Arruda
b94f29004b doc: Begin terminal emulator documentation
With some spacing/indentation fixes.

Helped by: @Pyrohh, @kopischke
2015-03-29 20:35:45 -03: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
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
Michael Reed
97df129956 CONTRIBUTING.md: Misc improvements
- In general, many sections have been expanded a lot.
- Defer to the wiki when it makes sense.
- Rewrite a bunch of things to be clearer. There is a lot more
  verbosity, but clarifying as many items as we can in this document is
  preferable to it being done later in the issue tracker.

(alphabetically sorted)
Helped-by: David Granström <david@davidgranstrom.com>
Helped-by: Florian Walch <florian@fwalch.com>
Helped-by: John Szakmeister <john@szakmeister.net>
Helped-by: Justin M. Keyes <justinkz@gmail.com>
Helped-by: Martin Kopischke <martin@kopischke.net>
Helped-by: oni-link <knil.ino@gmail.com>

[ci skip]
2015-03-27 22:53:52 -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
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