Commit Graph

93 Commits

Author SHA1 Message Date
Justin M. Keyes
b9ad12e6c2 UI/nvim_ui_attach(): add override option
Before now, Nvim always degrades UI capabilities to the lowest-common
denominator. For example, if any connected UI has `ext_messages=false`
then `ext_messages=true` requested by any other connected UI is ignored.

Now `nvim_ui_attach()` supports `override=true`, which flips the
behavior: if any UI requests an `ext_*` UI capability then the
capability is enabled (and the legacy behavior is disabled).

Legacy UIs will be broken while a `override=true` UI is connected, but
it's useful for debugging: you can type into the TUI and observe the UI
events from another connected (UI) client. And the legacy UI will
"recover" after the `override=true` UI disconnects.

Example using pynvim:

    >>> n.ui_attach(2048, 2048, rgb=True, override=True, ext_multigrid=True, ext_messages=True, ext_popupmenu=True)
    >>> while True: n.next_message();
2019-05-09 22:27:41 +02:00
Justin M. Keyes
7e1591e06a API: emit nvim_error_event on failed async request
We already do this for _invalid_ async requests #9300.
Now we also do it for failed invocation of valid requests.
2019-04-13 17:07:58 +02:00
Justin M. Keyes
943bedfc86
event-loop: do not set CA_COMMAND_BUSY #9853
CA_COMMAND_BUSY in nv_event() was carried over from Vim nv_cursorhold()
(ref: e5165bae11). It prevents :startinsert from working during a RPC
call, so remove it.

Helped-by: glacambre <me@r4>
closes #7254
2019-04-08 02:33:00 +02:00
Björn Linse
f5d5da3917 buffer: use aucmd_prepbuf() instead of switch_to_win_for_buf() 2019-03-05 15:05:23 +01:00
Justin M. Keyes
aee29e51a6 API: nvim_create_buf: add scratch parameter
Creating a scratch buffer is a chore/ritual, and would be more
useful/common if formally exposed.
2019-02-17 06:58:03 +01:00
Björn Linse
51fc54325c ui: implement ext_messages
Co-Author: Dongdong Zhou <dzhou121@gmail.com>
2019-02-10 13:36:46 +01:00
Björn Linse
891ed14f13 api: add nvim_create_buf to create a new empty buffer.
Loading existing files into a buffer is non-trivial and requires a window.
Creating an unnamed emtpy buffer is trivial and safe though, thus worth a
special case.

Change nvim_buf_set_option to use aucmd_prepbuf. This is necessary
to allow some options to be set on a not yet displayed buffer, such
as 'buftype' option.

vim-patch:7.4.1858: Add BLN_NEW to enforce buflist_new creating new buffer
2019-02-09 11:48:45 +01:00
Björn Linse
baf93d9606 UI: always use contrete colors for default_colors_set
But add an escape hatch needed for external TUI, so it still can use
terminal emulator defaults.
2019-02-05 19:41:38 +01:00
Björn Linse
f7b174eb71 tests/lua: test for multiline error messages in lua 2019-01-23 19:34:13 +01:00
Justin M. Keyes
38b9256439 test/API: nvim_set_vvar() #9395 2019-01-14 00:50:29 +01:00
Björn Linse
1f8afe15a4 multigrid: add multigrid support to test infrastructure
make Screen explicitly tied to its session
2018-12-31 12:44:22 +01:00
Björn Linse
8b42249cdd RPC: turn errors from async calls into notifications
Previously, nvim sent a response with invalid request id (UINT64_MAX).
In functionaltests, catch unexpected error notifications in after_each().
2018-12-03 10:42:00 +01:00
Justin M. Keyes
30857030e8 doc
- develop.txt is for design/guidelines; architecture/concepts should
  live elsewhere (currently src/nvim/README.md)
- move dev-jargon to intro.txt
- replace https://neovim.io/community (deprecated) with
  https://neovim.io/#chat
- <Cmd> avoids CmdlineEnter/Leave
  https://github.com/vim/vim/issues/2889
2018-11-28 03:48:06 +01:00
Björn Linse
01dbf0951b api: implement object namespaces
Namespaces is a lightweight concept that should be used to group
objects for purposes of bulk operations and introspection. This is
initially used for highlights and virtual text in buffers, and is
planned to also be used for extended marks. There is no plan use them
for privileges or isolation, neither to introduce nanespace-level
options.
2018-11-24 11:01:37 +01:00
Jan Edmund Lazo
7ab0e8c8dd functionaltest: enable job channel test 2018-10-31 22:55:07 -04:00
Björn Linse
43823acae2 ui: rename ext_newgrid to ext_linegrid 2018-10-01 21:24:15 +02:00
Justin M. Keyes
608ff261ad test: API validation: assert exact string
expect_err() matches against a pattern. Terminate the pattern with "$"
to check against buffer overrun.

ref #8931
2018-09-05 08:04:15 +02:00
Justin M. Keyes
db17d2c0fa API: Avoid overrun when formatting error-message
msgpack_rpc_to_object (called by handle_request .. msgpack_rpc_to_array)
always NUL-terminates API Strings.
But handle_request .. msgpack_rpc_get_handler_for operates on a raw
msgpack_object, before preparation.
2018-09-05 08:04:15 +02:00
Björn Linse
1adb01c120 ui: use line-based rather than char-based updates in screen.c
Add ext_newgrid and ext_hlstate extensions. These use predefined
highlights and line-segment based updates, for efficiency and
simplicity.. The ext_hlstate extension in addition allows semantic
identification of builtin and syntax highlights.

Reimplement the old char-based updates in the remote UI layer, for
compatibility. For the moment, this is still the default. The bulitin
TUI uses the new line-based protocol.

cmdline uses curwin cursor position when ext_cmdline is active.
2018-07-21 13:21:58 +02:00
Justin M. Keyes
3abf17ae88
API: validation: mention invalid method name (#8489) 2018-06-07 10:56:44 +02:00
Björn Linse
5be3865ce7 nvim_list_uis: include channel id 2018-06-01 10:20:13 +02:00
Björn Linse
6da4548f0e api: list information about all channels/jobs.
Fire autocmd when channel opens or its info changes.
Add a way for API clients can describe themselves.
2018-05-23 18:18:16 +02:00
Justin M. Keyes
273d2cd5d5 Merge #8329 'API: Make nvim_set_option() update :verbose set …' 2018-05-11 10:08:09 +02:00
Justin M. Keyes
2326a4ac3a API: nvim_eval(): return non-generic VimL errors
Use the same pattern as nvim_call_function (_call_function).
2018-05-09 23:18:39 +02:00
Justin M. Keyes
c9f3174075 API: return non-generic VimL errors
- Return VimL errors instead of generic errors for:
  - nvim_call_function
  - nvim_call_dict_function
- Fix tests which were silently broken before this change.

This violates #6150 where we agreed not to translate API errors.  But
that can be fixed later.
2018-05-09 23:18:38 +02:00
Justin M. Keyes
cabffb0182 API: nvim_call_dict_function: expect actual function, not name 2018-05-06 14:52:21 +02:00
Justin M. Keyes
fe7ab60af7 API: nvim_call_dict_function: eliminate internal param
The `internal` param is difficult to explain, and will rarely be
anything but `true`.  To avoid it, use a hack: check if the resolved
dict value starts with "function(".
2018-05-06 14:38:26 +02:00
Justin M. Keyes
19c2ce1901 refactor: nvim_call_dict_function
- Add test coverage for errors.
- Rename, rearrange.
2018-05-06 14:38:26 +02:00
Sebastian Witte
124275dd58 API: nvim_call_dict_function #3032 2018-05-06 14:38:26 +02:00
Justin M. Keyes
f46f138fb6 test: nvim_call_function: verify "too many arguments" error 2018-05-06 14:38:26 +02:00
b-r-o-c-k
7170de1971 api: Make nvim_set_option() update :verbose set ...
Make `:verbose set ...` show when an option was last modified by an
API client or Lua script/chunk. In the case of an API client, the
channel ID is displayed.
2018-05-03 21:05:20 -05:00
Justin M. Keyes
1c3a849881
API/nvim_command_output: handle :echon capture (#8265)
ref https://github.com/neovim/python-client/pull/290
2018-04-13 00:49:37 +02:00
Björn Linse
98e7112390 msg: do not scroll entire screen (#8088) 2018-03-31 11:12:27 +02:00
geekodour
9f994bb699 api: nvim_list_uis #8004
ref #7438
closes #4842
2018-03-03 15:06:24 +01:00
Justin M. Keyes
352a51e831 test: :! print binary data, control chars
closes #5442
closes #4142
ref #6618
ref #4376
ref #7844
ref #2958
ref #4338
2018-02-07 09:25:51 +01:00
Björn Linse
4e7d85e635 shell: update execute('!cmd') test to new behavior
And similarly nvim_command_output test
2018-02-06 20:16:38 +01:00
ZyX
a2dfeb8a16
functests: Improve error reporting in _check_parsing function
May be needed for unit tests as well though.
2018-02-02 07:28:56 -05:00
Justin M. Keyes
5055d4a755 api: nvim_command_output: direct impl 2018-01-10 23:58:56 +01:00
Justin M. Keyes
c095f83116 api: change nvim_command_output behavior
Implement nvim_command_output with `execute({cmd},"silent")`.

Behavior changes:
- does not provoke any hit-enter prompt
- no longer prepends a newline char
- does not capture some noise (like the "[New File]" message, see the
  change to tabnewentered_spec.lua)

Technically ("bug-for-bug") this a breaking change.  But the previous
behavior of nvim_command_output meant that it probably wasn't used for
anything outside of tests.

Also remove the undocumented `v:command_output` variable which was
a hack introduced only for the purposes of nvim_command_output.

closes #7726
2018-01-10 23:45:44 +01:00
ZyX
5ab0f988ca *: Replace all occurrences of NVim with Nvim 2017-11-30 11:53:25 +03:00
ZyX
17077b6813 viml/parser/expressions: Make $ENV not depend on &isident 2017-11-26 16:08:53 +03:00
ZyX
ebb33eddd9 tests: Stabilize float format and %e in format_luav and format_string 2017-11-19 22:00:59 +03:00
ZyX
f20f97c936 *: Fix linter errors 2017-11-19 21:13:27 +03:00
ZyX
a94255a7ac tests: Use single test file for unit and functional parser tests 2017-11-19 20:20:06 +03:00
ZyX
ebb5977837 api/vim: Add “len” dictionary key
This allows determining where parsing ended which may be needed for e.g. parsing
`:echo` with that API function.
2017-11-06 01:17:39 +03:00
ZyX
7849070f99 tests: Add missing test cases 2017-11-06 01:17:39 +03:00
ZyX
7bc6de7526 api/vim,functests: Add tests for nvim_parse_expression, fix found bugs 2017-11-06 01:17:39 +03:00
ZyX
b9d5aea073 api/vim: Create part of nvim_parse_expression function 2017-11-06 01:17:38 +03:00
Justin M. Keyes
9d6bac3219 test: more coverage for RPC + op-pending #3732 2017-09-16 12:21:31 +02:00
Justin M. Keyes
ce852bab04 eventloop: K_EVENT does not finish mapping
The "mapping" tests added in 541dde36e3 were flawed:
- Unlike op-pending mode, RPCs are _blocked_ during map-pending. So
  a synchronous RPC like nvim_get_current_buf() waits until
  'timeoutlen', then the mapping is canceled.
- helpers.expect() also performs a blocking RPC, so again that must not
  intervene the two nvim_input() calls.

closes #6166
2017-09-04 22:51:04 +02:00