Commit Graph

3938 Commits

Author SHA1 Message Date
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
Rui Abreu Ferreira
2e1a80563b os_get_user_name() for non UNIX system #2729
os_get_user_name() requires getuid(), which is only available in UNIX. Return
FAIL for non UNIX systems.

On FAIL os_get_user_name() fills the buffer with the uid.  In Windows libuv
uses 0 for uid in stat structs, so 0 is used here too.
2015-08-04 19:15:17 -04:00
Michael Reed
8f3eb69207 doc: Fix nit in previous commit
...sorry
2015-08-04 17:10:44 -04:00
Florian Walch
61e6665652 doc: Add transition instructions to nvim_from_vim.txt
Also move introduction to Nvim and topic overview to nvim.txt.

Reviewed-by: Michael Reed <Pyrohh@users.noreply.github.com>
Reviewed-by: Justin M. Keyes <justinkz@gmail.com>
2015-08-04 16:46:15 -04:00
Keerthan Jaic
5fc4c2d442 tui: Fix terminal detection for cursor shape #3129
Default to DECSCUSR, except for known cases where other codes are used
or changing cursor shape is unsupported
2015-08-04 12:33:43 -04:00
Florian Walch
95a4dc6487 vim-patch.sh: Add --review option to compare PR and original diffs. #3083
Helped-by: Michael Reed <m.reed@mykolab.com>
2015-08-03 21:36:33 +02:00
Justin M. Keyes
9f350e615c Merge pull request #3034 from ZyX-I/msgpack-eval
msgpack viml functions for dump/restore
2015-08-03 00:24:10 -04:00
ZyX
030f360312 functests: Use eval subdirectory in place of viml 2015-08-02 22:19:58 +03:00
ZyX
401ae724ea eval: Call list_append_allocated_string from list_append_string 2015-08-02 20:38:09 +03:00
ZyX
69a42f2d1d documentation: Add {Nvim} tag to new functions 2015-08-02 19:34:32 +03:00
ZyX
ec95a58377 vim_to_msgpack: Silence -Werror=unitialized compiler error
Compiler warning was found in [QuickBuild logs][1] from [this page][2]. GCC and
clang on travis appear to be fine. Relevant log parts:

    Step Log (master>buildall>build-node?testNode=linux-64>build-and-run-tests>build-and-run-tests-parameterized?buildType=Release>configure-neovim-and-build-nvim)
    <…>
    16:26:31,364 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/eval.c: In function ‘f_msgpackdump’:
    16:26:31,364 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/eval.c:12371:26: error: ‘cur_tv’ may be used uninitialized in this function [-Werror=uninitialized]
    16:26:31,364 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/eval.c:12328:21: note: ‘cur_tv’ was declared here
    16:26:31,938 WARN  - cc1: all warnings being treated as errors

[1]: http://neovim-qb.szakmeister.net/wicket/page?4-1.ILinkListener-content-buildTab-panel-errorContainer-steps-5-logLink
[2]: http://neovim-qb.szakmeister.net/build/2099/overview
2015-08-02 19:32:41 +03:00
ZyX
fea633d0fa ex_cmds*: Silence -Wstrict-prototypes warnings
Due to a number of places where headers generated from these files are included
gcc with -DEXITFREE produces *loads* of warnings for these functions.
2015-08-02 19:32:41 +03:00
ZyX
7fbefd585e eval: Remove most of msgpack* functions limitations 2015-08-02 19:32:41 +03:00
ZyX
5a7135fa1c eval: Add msgpackparse and msgpackdump functions 2015-08-02 19:32:41 +03:00
Justin Gassner
63d5b8707b vim-patch:5d89d9b #2922
Update runtime files.

https://code.google.com/p/vim/source/detail?r=5d89d9b40499059e1a64dc35fbae94313fba0098
2015-08-02 05:17:49 -04:00