Commit Graph

3902 Commits

Author SHA1 Message Date
Justin M. Keyes
3ce1b4015f fs.c: implement os_file_is_readable()
Use access() because:

- We already use it for os_file_is_writable()
- Vim's old check_file_readonly() ends up using access() after all.
2015-08-17 01:06:00 -04:00
Justin M. Keyes
616b787d12 tutor: avoid 'wildignore' pain 2015-08-16 21:13:26 -04:00
Justin M. Keyes
521a9816d0 Merge pull request #3179 from ZyX-I/clint-find-new-errors
Add ability to suppress errors to clint.py
2015-08-16 17:17:34 -04:00
oni-link
db7b970057 rstream.c: Prevent stream closing if a read event is still queued. #3172
Processing a stream's output can be queued. If stream_close() is called
before the queue is processed, the RBuffer containing the stream's data
is freed and the next read event would try to access freed memory.

To fix this behavior, use the stream's pending requests counter.
2015-08-16 14:09:29 -04:00
Pepe Padial
2bd3351c37 Remove unused assignement #3173
Based on this report
http://neovim.io/doc/reports/clang/report-808d3e.html#EndPath
2015-08-16 14:06:48 -04:00
Felipe Morales
4912dcf3c7 install tutorial files #3180 2015-08-16 14:02:35 -04:00
ZyX
b9276dd630 vim.h: Fix error which is not suppressed by clint 2015-08-16 16:14:15 +03:00
Florian Walch
90ef218610 Add introductory text to intro screen. #1885 2015-08-15 15:11:28 -04:00
Justin M. Keyes
197a5ad376 Merge pull request #2700 from fmoralesc/vim-tutor-mode
runtime: Include vim-tutor-mode
2015-08-15 14:56:46 -04:00
Felipe Morales
4fc1ab779d runtime: Include vim-tutor-mode
vim-tutor-mode provides a mechanism to write and read interactive
tutorials in vim. It's aim is to replace the venerable vimtutor with a
more modern system.

The plugin's development is maintained at https://github.com/fmoralesc
/vim-tutor-mode

Closes #2351.
2015-08-15 15:25:30 -03:00
Felipe Morales
d8f1acbf9d tui: restore got_winch in sigwinch_cb #3171
Fixes minor regression from #3145.
2015-08-15 12:57:18 -04:00
ZyX
aa6723d16b clint: Add support for errors suppression 2015-08-15 19:09:16 +03:00
Thiago de Arruda
a94a68145b Merge PR #3029 'Refactor event processing architecture'
Helped-by: oni-link <knil.ino@gmail.com>
Reviewed-by: oni-link <knil.ino@gmail.com>
2015-08-13 12:20:53 -03:00
Thiago de Arruda
f1de097dbb eval: Fix jobwait() to process multiple jobs concurrently
The new event processing architecture changed `jobwait()` semantics: Only one
job is processed at time since process_wait only focuses on one queue.

This fixes the problem with a few changes:

- Allow the event queue polled by `process_wait` to be overriden by a new
  argument.
- Allow the parent queue to be overriden with `queue_replace_parent`
- Create a temporary queue that serves as the parent for all jobs passed to
  `jobwait()`
2015-08-13 11:53:19 -03:00
Thiago de Arruda
a816c726bb pty_process: Make termios structure a static variable
The structure has a constant initializer and is only used for reading.
2015-08-13 08:52:17 -03:00
Thiago de Arruda
6b3cd381dc rstream: Pass read count to read events
This is necessary to keep events in the same order received from the OS.
2015-08-13 08:52:17 -03:00
oni-link
166d8c799f process: Remove indeterminism that causes reordering of pty events
Since pty events are queued, it is possible that the reads will be reordered.
Example scenario:

In the terminal you have output combined from stdout and stderr. A program
generates output, first you have some output on stdout, then output on stderr,
output on stdout, output on stderr,...  The whole output should be interleaved
from both streams.

Each output generates a read_event and they are placed in the same queue. If the
queue is processed, the first read_event will send the whole stdout output to
the terminal (on_job_output() consumes the whole buffer). The next read_event is
similar for stderr. The remaining read events do nothing because now both
RBuffer are already empty. So the terminal would show first the stdout output
and after that the stderr output.

This commit fixes the problem by disabling stderr stream in pty processes.
That's ok because they all represent the same stream(duplicate file
descriptors), plus one stream is simpler to deal with.
2015-08-13 08:52:17 -03:00
Thiago de Arruda
502aee690c event: Refactor async event processing
- Improve the implementation of deferred/immediate events.
- Use the new queue module to change how/when events are queued/processed by
  giving a private queue to each emitter.
- Immediate events(which only exist to break uv_run recursion) are now
  represented in the `loop->fast_events` queue.
- Events pushed to child queues are propagated to the event loop main queue and
  processed as K_EVENT keys.
2015-08-13 08:49:38 -03:00
Thiago de Arruda
a6e0d35d2d queue: Implement a more flexible event queue 2015-08-13 08:46:21 -03:00
Thiago de Arruda
1a7a020b68 lib: Include libuv circularly linked list
This is simpler and more efficient than klist.h for implementing queues that
support insertion or removal at arbitrary positions.
2015-08-13 07:41:04 -03:00
Thiago de Arruda
0d71354058 test: Make sure ENTER prompt is exited in clipboard_provider_spec
The test may hang without this.
2015-08-13 07:41:04 -03:00
Thiago de Arruda
bef0c03b25 terminal: Ensure terminal buffers are flushed on exit
When a terminal closed, make sure it is refreshed before the Terminal structure
is freed. Also extract `refresh_terminal` from `on_refresh`.
2015-08-13 07:41:04 -03:00
Thiago de Arruda
696f9c2759 process: Pass loop reference during initialization
Change the API so that it is passed to {uv,pty}_process_init instead of
`process_spawn`.
2015-08-13 07:41:04 -03:00
Thiago de Arruda
3f5af6c1c4 loop: Simplify loop.c and move some code to input.c
- Declare poll timer in Loop structure instead of a loop_poll_events local
  variable.
- Move deferred event management to input.c
2015-08-13 07:41:04 -03:00
Thiago de Arruda
ccdeb91e12 msgpack: Replace FUNC_ATTR_DEFERRED by FUNC_ATTR_ASYNC
API functions exposed via msgpack-rpc now fall into two categories:

- async functions, which are executed as soon as the request is parsed
- sync functions, which are invoked in nvim main loop when processing the
  `K_EVENT special key

Only a few functions which can be safely executed in any context are marked as
async.
2015-08-13 07:41:04 -03:00
Thiago de Arruda
b13011ff47 pty_process: Simplify cleanup after error during spawn 2015-08-13 07:41:04 -03:00
Thiago de Arruda
024b1f39a3 eval: Fixes to job control
- Ensure TerminalJobData is freed in case of error when spawning pty jobs
- Check if job was stopped in every function that receives a job id.
2015-08-13 07:41:04 -03:00
Thiago de Arruda
a10b327073 events: Add missing function attributes to some APIs 2015-08-13 07:41:04 -03:00
Daniel Kosinski
6bf322c6ff doc: Fix typo in nvim-python. #3162 2015-08-12 21:57:29 -04:00
ZyX
a6c6128681 runtime: Do install generated syntax file, also test this. #3160
Fixes #3157
2015-08-11 13:50:43 -04:00
Justin M. Keyes
d21690a66e test: cover :grep
References #3156
2015-08-11 12:49:50 -04:00
oni-link
c6af09c566 shell.c: A full RBuffer with no NL can freeze shell output. #3156
out_data_cb() can return without emptying the full RBuffer (no NL was
seen). Because the shell output stream is stopped until space in the
Rbuffer is freed up, no more shell output is written.

To prevent this, output the full RBuffer when write_output() did not
write anything.

write_output() can also process the same RBuffer content more than once,
if no NL was seen. To prevent NUL bytes from producing new lines (if
lines are not written to a buffer), translate NUL to SOH(1).

Fixes #2983
2015-08-11 09:36:06 -04:00
Felipe Morales
7d9472ab1b tui: avoid double-resize on SIGWINCH. #3145 2015-08-10 00:01:27 -04:00
Justin M. Keyes
389c3b8581 Merge #3149 'Fix pending() invocations'. 2015-08-09 22:34:07 -04:00
Justin M. Keyes
5c1dc0fbe7 test: fix pending() invocations
AFAICT busted does not report pending() invocations without the 2nd
argument.
2015-08-09 22:33:28 -04:00
Justin M. Keyes
62c53c404b test: move runtime/autoload/* to provider/
- Organize tests by logical function, not the literal impl location.
- Avoid deep nesting / hyper-hierarchy.
2015-08-09 22:33:28 -04:00
Justin M. Keyes
698482ec3e test: python: report pending() if python{2,3} is missing 2015-08-09 22:33:28 -04:00
Marco Hinz
21c0d87a24 vim-patch:7.4.781 #3065
Problem:  line2byte() returns one less when 'bin' and 'noeol' are set.
Solution: Only adjust the size for the last line. (Rob Wu)

Original patch:
  https://code.google.com/p/vim/source/detail?r=30c9301f33ed76d0b76b9e22362f5e78e26786da
2015-08-09 21:13:25 -04:00
Marco Hinz
990c0350ab vim-patch:7.4.773 #3066
Problem:  'langmap' is used in command-line mode when checking for mappings.
Solution: Do not use 'langmap' in command-line mode. (Larry Velazquez)

Original patch:
  https://code.google.com/p/vim/source/detail?r=5b1eefbf9a532f32a66fa13abbd671488aaafd5c
2015-08-09 21:12:11 -04:00
Marco Hinz
3df37a8424 vim-patch:7.4.776 #3062
Problem:  Equivalence class for 'd' does not work correctly.
Solution: Fix 0x1e0f and 0x1d0b. (Dominique Pelle)

Original patch:
  https://code.google.com/p/vim/source/detail?r=94b17958585153641ad1e813fa144cad57c7170f
2015-08-09 21:09:28 -04:00
Justin M. Keyes
ef6451a113 Merge #3141 'handle clipboard=unnamedplus,unnamed correctly'. 2015-08-09 21:04:43 -04:00
Björn Linse
41e9ebcf41 clipboard: remove documentation for unsupported options
Both these were relevant only to the old gui implementation.
2015-08-07 13:06:17 +02:00
Björn Linse
d4ebbaa91a clipboard: support clipboard=unnamedplus,unnamed 2015-08-07 13:06:13 +02:00
Björn Linse
162361abac clipboard: fixup inconsequential yet embarrassing mixup 2015-08-06 22:39:47 +02:00
Justin M. Keyes
5a19585865 test: cover msgpackparse() regression 2015-08-05 19:08:06 -04:00
Justin M. Keyes
029b58e417 Merge #3135 'Use proper refcount of msgpack type lists'. 2015-08-05 19:08:03 -04:00
ZyX
718504e18d documentation: Replace undefined help tag 2015-08-06 01:41:01 +03:00
ZyX
fe3c8690f6 documentation: Fix special dictionary value key name 2015-08-06 01:40:01 +03:00
ZyX
172272ef3f eval: Use proper refcount of msgpack type lists 2015-08-05 22:50:46 +03:00
oni-link
b732a27c4e channel.c: Only free a channel after close callbacks are executed #3132
parse_msgpack() closes a channel's stream on EOF error and the stream's
close callback close_cb() is queued for the next libuv loop iteration.
When parse_msgpack() returns, it has freed the channel and the queued
stream callback will access this freed memory.

To prevent this, increase the channel's reference count and let the
stream's close callback call decref().

Fixes #3128
2015-08-05 11:17:08 -04:00