Commit Graph

2881 Commits

Author SHA1 Message Date
Björn Linse
2a2d288228 compositor: handle scrolling of blended window 2019-06-26 08:37:36 +02:00
Björn Linse
619a86cb1e eval/api: don't allow the API to be called in the sandbox.
Identifying and maintaining a "secure" subset of the API would be too
much busywork. So just disable the entire thing.
2019-06-26 08:19:57 +02:00
Björn Linse
4c4d964eeb ui: add 'winblend' to support blending of floating windows
Also add `hi blend=` attribute to override transparency of indiviual attributes.
2019-06-25 18:08:21 +02:00
Alan Wu
9fd4a0b526 getchar: Handle incomplete <Paste> in typeahead buffer #10311
<Paste> is a 3-byte sequence and the beginning one or two bytes can appear at
the very end of the typeahead buffer. When this happens, we were exiting from
`vgetorpeek()` instead of reading more characters to see the complete sequence.

I think this should fix #7994 -- at least partially. Before this change, when I
paste exactly 64 characters into a freshly booted instance, I get what I pasted
plus the literal text "<Paste>" at the end. Nvim also stays in nopaste mode.
The attached test case fails in this manner without the code change.

Fix #7994
2019-06-24 00:28:04 +02:00
oni-link
0bdeec8ef0 screen: Adjust buffer sizes for multiple sign columns #10314
* screen: Fix to draw signs with combining characters.
The buffer size for signs can be too small, because the upper length
limit of a sign can be 56 bytes. If combining characters are only two
bytes in size, this reduces to 32 bytes.

* screen: Adjust buffer size to maximal sign column count
2019-06-24 00:01:01 +02:00
Daniel Hahler
bc10a15ea7 tests: fix "api nvim_get_proc_children returns child process ids" (#10296)
There might be an existing job already - maybe due to some other test,
but in this case there was only one failure in the test run.

```
[----------] Running tests from C:/projects/neovim/test/functional\api\proc_spec.lua
  [ RUN      ] api nvim_get_proc_children returns child process ids: ERR
  test\functional\helpers.lua:392:
  retry() attempts: 450
  C:/projects/neovim/test/functional\api\proc_spec.lua:22: Expected objects to be the same.
  Passed in:
  (number) 2
  Expected:
  (number) 1

  stack traceback:
  	test\functional\helpers.lua:392: in function 'retry'
  	C:/projects/neovim/test/functional\api\proc_spec.lua:21: in function <C:/projects/neovim/test/functional\api\proc_spec.lua:17>
```

https://ci.appveyor.com/project/neovim/neovim/builds/25461215/job/8ns204v6091iy9rs?fullLog=true#L2672
2019-06-22 15:29:39 +02:00
Björn Linse
d4938743e6 channel: refactor events, prevent recursive invocation of events 2019-06-18 10:49:38 +02:00
Björn Linse
e39d217592 messages: fix crash with msg_advance when using ext_messages 2019-06-16 11:31:35 +02:00
Björn Linse
41f31ca90d messages: support shortmess-=S in ext_messages 2019-06-16 11:07:29 +02:00
Björn Linse
64cdf9f78a api/lua: add on_detach to nvim_buf_attach 2019-06-15 13:19:12 +02:00
Daniel Hahler
93f8c2793c
ci: AppVeyor: fix cov job, remove duplicate non-cov one (#10217)
* ci: AppVeyor: set GCOV_ERROR_FILE

This prevents the warnings/errors to be spilled into test results,
causing them to fail them, e.g.:

    [  FAILED  ] C:/projects/neovim/test/functional\core\main_spec.lua @ 97: Command-line option -s errors out when trying to use nonexistent file with -s
    C:/projects/neovim/test/functional\core\main_spec.lua:98: Expected objects to be the same.
    Passed in:
    (string) 'Cannot open for reading: "Xtest-functional-core-main-s.nonexistent": no such file or directory
    profiling:C:\projects\neovim\build/src/nvim/CMakeFiles/nvim.dir/buffer.c.gcda:Data file mismatch - some data files may have been concurrently updated without locking support
    '
    Expected:
    (string) 'Cannot open for reading: "Xtest-functional-core-main-s.nonexistent": no such file or directory
    '

    stack traceback:
            C:/projects/neovim/test/functional\core\main_spec.lua:98: in function <C:/projects/neovim/test/functional\core\main_spec.lua:97>

For reference, the locking appears to have been reworked for gcc 9.1 [1].

1: https://github.com/gcc-mirror/gcc/commit/56621355b

helpers.clear: keep GCOV_ERROR_FILE in environment

* ci: AppVeyor: remove MINGW_64 config (used with cov now)

Also:

- run MINGW_64-gcov first, and with PRs, since it provides coverage.
2019-06-14 13:39:57 +02:00
Daniel Hahler
dd21cd2a4d
tests: increase timeout with "timers doesn't mess up the cmdline" (#10212)
This might be required on (slower) CI.

    [ RUN      ] timers doesn't mess up the cmdline: ERR
    test/functional/ui/screen.lua:562: expected intermediate screen state before final screen state
    stack traceback:
            test/functional/ui/screen.lua:562: in function '_wait'
            test/functional/ui/screen.lua:366: in function 'expect'
            .../build/neovim/neovim/test/functional/eval/timer_spec.lua:221: in function <.../build/neovim/neovim/test/functional/eval/timer_spec.lua:199>

Ref: https://travis-ci.org/neovim/neovim/jobs/544974506#L3861
2019-06-13 22:11:33 +02:00
Harm te Hennepe
424ddd01f5 tui: support rgba background detection (#10205)
Fixes https://github.com/neovim/neovim/issues/10159.
2019-06-13 14:14:41 +02:00
Daniel Hahler
6f27f5ef91 main: do event_init before early_init #10183
Fixes https://github.com/neovim/neovim/issues/10172

* move log_init to event_init
* move init_signs to end of early_init
2019-06-12 14:22:42 +02:00
erw7
ce90a19abd TUI: set os/input.c:global_fd to input->in_fd #10174
Problem: When we changed startup to wait for the TUI (like a remote UI),
         we forgot to set os/input.c:global_fd.  That used to be done by
         input_start().

Solution: Initialize os/input.c:global_fd before initializing libtermkey
          (termkey_new_abstract) so that tui_get_stty_erase() and
          friends can inspect the correct fd.

fixes #10134
close #10174
2019-06-10 16:43:52 +02:00
George Zhao
c83926cd0a lua: introduce vim.loop (expose libuv event-loop) #10123
Co-authored-by: Andrey Popp <8mayday@gmail.com>

closes #9546
closes #10084
2019-06-10 14:13:18 +02:00
erw7
2fbeea8326 Change to not test msg_puts_pirntf() in unix CI 2019-06-09 19:02:52 +09:00
erw7
da8f7141ce Add msg_puts_printf() test for multibyte characters 2019-06-09 13:29:51 +09:00
erw7
53551d823e Add test for #7967 2019-06-09 13:28:10 +09:00
Justin M. Keyes
bb24fec333
defaults: exclude "S" from 'shortmess' #10136
ref #6289
2019-06-07 23:11:28 +02:00
Björn Linse
b684bd05b5 lua: docs and tests for vim.schedule 2019-06-05 10:46:22 +02:00
Björn Linse
16ee24082f
Merge pull request #10117 from bfredl/ctrl-o_event
normal: Don't exit CTRL-O mode after processing K_EVENT
2019-06-04 15:23:40 +02:00
Björn Linse
3adb8a10b1
Merge pull request #9170 from bfredl/lua_cb
lua callbacks for nvim_buf_attach
2019-06-04 14:54:44 +02:00
Björn Linse
e50aa2a6c6 normal: Don't exit CTRL-O mode after processing K_EVENT 2019-06-04 13:59:43 +02:00
Björn Linse
f5c56f03bb api: allow nvim_buf_attach from lua using callbacks 2019-06-04 13:45:20 +02:00
erw7
89c2747eed Fix issue where test fails 2019-06-04 08:49:27 +09:00
Justin M. Keyes
49733df939 Merge #9338 'vim-patch:8.1.{569,571}' 2019-06-03 22:56:43 +02:00
Björn Linse
7ac3c311ee api/buffer: create new buffers in the "opened" state
Otherwise vim will think that ml_append() needs to "enter" the buffer,
which emits unexpected autocommands.

ref https://github.com/vim-airline/vim-airline/issues/1930
2019-06-03 13:54:03 +02:00
Björn Linse
3d24bb48e7 test: don't detach screen just to change the size 2019-06-03 11:23:10 +02:00
Jit Yao Yap
c96aed2ba7 Add test 2019-06-03 11:14:07 +02:00
Jan Edmund Lazo
f0078c26c2 functionaltests: fix new execute() tests 2019-06-03 00:12:01 -04:00
Sha Liu
5a4e7af77d update functional test for "places cursor correctly #6035" 2019-06-03 00:12:01 -04:00
Sha Liu
73a2922413 UI: Fix wrong msg_col after execute()
closes #6035
closes #9250
2019-06-03 00:12:01 -04:00
Justin M. Keyes
c0134660ab test: avoid some boilerplate 2019-06-03 00:08:32 +02:00
Ville Hakulinen
40218d1180 Make sure msg_clear is sent after confirm message (#10065) 2019-06-02 23:38:19 +02:00
Jit
b65a7b7f66 [RDY] Fix wildmode=list,full and display+=msgsep interaction (#10103)
* Fix wildmode=list and display+=msgsep interaction
* Add test to check ext_messages behaviour is unchanged
2019-06-02 21:38:34 +02:00
Justin M. Keyes
2e171a6fd1 test: cleanup, reduce verbosity 2019-06-01 21:59:42 +02:00
Justin M. Keyes
fb4d5a1846
UI/ext_messages: restore kind=quickfix #10067
Accidentally removed in 34f9e72af9.
ref #6201
2019-05-27 00:01:41 +02:00
Justin M. Keyes
1ca84897a0
Merge #10059 from jerdna-regeiz/vim-8.1.0614
vim-patch:8.1.0614,8.1.0632,8.1.0644,8.1.0658,8.1.0660,8.1.0669,8.1.0673,8.1.0679,8.1.0697,8.1.0701,8.1.0702,8.1.0709,8.1.0717,8.1.0750,8.1.0767,8.1.0772,8.1.0039
2019-05-26 20:59:28 +02:00
Jit
0bbaef8a99 UI/cmdline: check if redraw is needed after K_EVENT, K_COMMAND #9804
fixes #8490
2019-05-26 19:52:30 +02:00
Andrej Zieger
35fbb4e1ca vim-patch:8.1.0701: sign message not translated and inconsistent spacing
Problem:    Sign message not translated and inconsistent spacing.
Solution:   Add _() for translation.  Add a space. (Ken Takata)  Also use
            MSG_BUF_LEN instead of BUFSIZ.
d730c8e297
2019-05-26 19:32:32 +02:00
Andrej Zieger
fb9abd7d99 vim-patch:8.1.0614: placing signs can be complicated
Problem:    Placing signs can be complicated.
Solution:   Add functions for defining and placing signs.  Introduce a group
            name to avoid different plugins using the same signs. (Yegappan
            Lakshmanan, closes vim/vim#3652)
162b71479b
2019-05-26 19:32:31 +02:00
Björn Linse
aabda31d54
Merge pull request #9547 from bfredl/rpc_multiline_err
messages: use proper multiline errors for rpcrequest and API wrappers
2019-05-26 18:11:49 +02:00
Björn Linse
8ed54bbec3 messages: use proper multiline error message for rpcrequest and API wrappers 2019-05-26 15:42:16 +02:00
Jan Edmund Lazo
08aa9b0023 vim-patch:8.1.0211: expanding a file name "~" results in $HOME
Problem:    Expanding a file name "~" results in $HOME. (Aidan Shafran)
Solution:   Change "~" to "./~" before expanding. (closes vim/vim#3072)
00136dc321
2019-05-25 20:36:01 -04:00
Justin M. Keyes
a9d7ec4587 refactor: introduce XFREE_CLEAR()
Unfortunately we cannot indiscriminately replace xfree() with
XFREE_CLEAR(), because comparing pointers after freeing them is a common
pattern. Example in `tv_list_remove_items()`:

    xfree(li);
    if (li == item2) {
      break;
    }

Instead we can do it selectively/explicitly.

ref #1375
2019-05-25 10:01:17 +02:00
Justin M. Keyes
5b04a4fa09 lua/shared: share trim() impl 2019-05-20 23:46:56 +02:00
Justin M. Keyes
7cc01c704c Merge #9709 'fileio: use os_copy to create backups'
ref #8288
2019-05-20 22:33:19 +02:00
Justin M. Keyes
e4c2d85c77 lua/shared: share deepcopy() with test/*
deepcopy() was duplicated in test/helpers.lua
2019-05-19 17:58:54 +02:00
Justin M. Keyes
9d7aaf7149 lua/shared: move table util funcs to vim.shared
Use `tbl_` prefix for all table-util functions. Specify in the function
docstring if it expects a list-like or map-like table.
2019-05-18 21:07:30 +02:00
Justin M. Keyes
fd04877eb0 test: remove use of require('test.helpers')
The test.functional.helpers and test.unit.helpers modules now include
all of the public functions from test.helpers, so there is no need to
separately require('test.helpers').
2019-05-18 15:48:13 +02:00
Justin M. Keyes
7669fc1e9b test: share implementation of testdir/load.vim
Also, don't compute load factor unless load_adjust() was called, it
slows down the test suite.

ref #9292
2019-05-18 15:48:13 +02:00
Justin M. Keyes
bba75eb184 lua/stdlib: Introduce vim.shared
This is where "pure functions" can live, which can be shared by Nvim and
test logic which may not have a running Nvim instance available.

If in the future we use Nvim itself as the Lua engine for tests, then
these functions could be moved directly onto the `vim` Lua module.

closes #6580
2019-05-18 15:48:13 +02:00
Justin M. Keyes
2b87485c22 test: Extend {unit,functional}.helpers with global helpers
Automatically include all "global helper" util functions in the
unit.helpers and functional.helpers and modules.  So tests don't need to
expicitly do:

    local global_helpers = require('test.helpers')
2019-05-18 14:51:01 +02:00
Björn Linse
94f78ccf89
Merge pull request #9883 from bfredl/termredraw
make terminal state redraw like any other state
2019-05-14 13:39:00 +02:00
Björn Linse
5020daa6e5 ui/terminal: make terminal state redraw like any other state
Previously, ordinary redraws were missing from terminal mode. Instead,
there was an async callback that invoked update_screen() on terminal
data regardless of mode (as if :redraw! was invoked by a timer).

This created some issues:

- async changes to an unrelated ordinary buffer were not always redrawn in
  terminal mode
- screen cursor position was not properly updated in terminal mode (partial
  fix, will be properly fixed in a follow up PR)
- ad-hoc logic was needed for interaction with special states such as
  inccommand or horizontal wildmenu.

Instead redraw terminal mode just like any other state. This disables forced
redraws in cmdline mode, which were inconisent which async changes to
normal buffers (which are not redrawn in cmdline mode).
2019-05-14 12:54:39 +02:00
Björn Linse
9e0982a1a2
Merge pull request #9985 from bfredl/shenanigans
Fix aucmd_win issues: crashes and redrawing errors.
2019-05-13 23:24:14 +02:00
Björn Linse
74751117eb autocmd: fixes and tests for autocmd window issues
- redraw! in an invisible buffer rendered the screen unusable.
- storing the autocmd window handle and using it in API function could lead
  to crashes. Unregister the handle when the window is not active.
2019-05-13 20:32:04 +02:00
Justin M. Keyes
60aaae1c86 API/nvim_set_keymap: remove mode-shortname aliases
Reduce the API surface-area a bit. No need to have aliases for a mode.
ref #9924
2019-05-12 13:27:07 +02:00
Justin M. Keyes
f35d233e07 API/nvim_set_keymap: minor cleanup
ref #9924
2019-05-12 13:04:48 +02:00
Yilin Yang
fbf2c414ad API: nvim_set_keymap, nvim_del_keymap #9924
closes #9136

- Treat empty {rhs} like <Nop>

- getchar.c: Pull "repl. MapArg termcodes" into func
  The "preprocessing code" surrounding the replace_termcodes calls needs
  to invoke replace_termcodes, and also check if RHS is equal to "<Nop>".
  To reduce code duplication, factor this out into a helper function.

  Also add an rhs_is_noop flag to MapArguments; buf_do_map_explicit
  expects an empty {rhs} string for "<Nop>", but also needs to distinguish
  that from something like ":map lhs<cr>" where no {rhs} was provided.

- getchar.c: Use allocated buffer for rhs in MapArgs
  Since the MAXMAPLEN limit does not apply to the RHS of a mapping (or
  else an RHS that calls a really long autoload function from a plugin
  would be incorrectly rejected as being too long), use an allocated
  buffer for RHS rather than a static buffer of length MAXMAPLEN + 1.

- Mappings LHS and RHS can contain literal space characters, newlines, etc.

- getchar.c: replace_termcodes in str_to_mapargs
  It makes sense to do this; str_to_mapargs is, intuitively, supposed to
  take a "raw" command string and parse it into a totally "do_map-ready"
  struct.

- api/vim.c: Update lhs, rhs len after replace_termcodes
  Fixes a bug in which replace_termcodes changes the length of lhs or rhs,
  but the later search through the mappings/abbreviations hashtables
  still uses the old length value. This would cause the search to fail
  erroneously and throw 'E31: No such mapping' errors or 'E24: No such
  abbreviation' errors.

- getchar: Create new map_arguments struct
  So that a string of map arguments can be parsed into a more useful, more
  portable data structure.

- getchar.c: Add buf_do_map function
  Exactly the same as the old do_map, but replace the hardcoded references
  to the global `buf_T* curbuf` with a function parameter so that we can
  invoke it from nvim_buf_set_keymap.

- Remove gettext calls in do_map error handling
2019-05-12 11:44:48 +02:00
Justin M. Keyes
24f9dd73d5 test/channels_spec: cleanup
- Remove stray print()
- Use uname() instead of system('uname')
2019-05-12 00:43:28 +02:00
Justin M. Keyes
3d1ed7c959 UI/ext_messages: learn more message kinds
ref #6201
2019-05-11 23:42:55 +02:00
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
hashinclude
400ee59247 API: fix cursor position when lines are added #9961
Restore code removed in #9674.
2019-05-07 09:17:37 +02:00
Justin M. Keyes
4b65a0059a test: cleanup
Avoid hyper-granularity. Don't need subdirectories for every little
thing.
2019-05-05 23:01:35 +02:00
Marco Hinz
1eda387951
tests: adjust to latest Vim patches 2019-05-05 14:05:25 +02:00
Marco Hinz
e6c21c4bc0
vim-patch:8.0.1782: no simple way to label quickfix entries
Problem:    No simple way to label quickfix entries.
Solution:   Add the "module" item, to be used instead of the file name for
            display purposes. (Martin Szamotulski)

d76ce85266
2019-05-05 13:46:19 +02:00
Justin M. Keyes
fd0fd752c8 terminal: swap priority of terminal, editor highlights
closes #9964
2019-05-02 09:56:22 +02:00
Carlo Abelli
49c51f839b ex_getln: fix statusline redraw logic #9967
fixes #9908
2019-05-02 11:38:21 +02:00
Justin M. Keyes
8aca932aa0
clipboard: setreg("*") with clipboard=unnamed #9954
Helped-by: Björn Linse <bjorn.linse@gmail.com>
fix #5646
2019-04-28 21:06:24 +02:00
Justin M. Keyes
769f44e918 win/defaults: Use "…/nvim-data/site" in 'runtimepath'
On Windows we store non-config data in "$XDG_DATA_HOME/nvim-data". But
the "…/site" items in 'runtimepath' did not correctly point to that
location, they used "…/nvim/site".

Fix the init logic to use  "…/nvim-data/site".

closes #9910
2019-04-28 00:27:07 +02:00
Justin M. Keyes
698c4f662d test: clear(): remove opts.headless parameter
Callers can instead specify `args_rm={'--headless'}`.

TODO: should `nvim_argv` have "--headless" by default? Need to inspect
      some uses of spawn(nvim_argv) ...
2019-04-27 16:31:26 +02:00
Justin M. Keyes
17291642bd test: clear(): args_rm parameter 2019-04-27 16:19:40 +02:00
Justin M. Keyes
f0a7e3fc9a test: 'shadafile' default
ref 773bdd41ec
2019-04-27 16:19:40 +02:00
Jan Edmund Lazo
9d77a07686 vim-patch:8.0.1510: cannot assert beep #9938
Problem:    Cannot test if a command causes a beep.
Solution:   Add assert_beeps().
b48e96f61c
2019-04-25 14:31:33 +02:00
Gabriel Cruz
8c6f5b7f92 Spurious quote mark in command line when typing <C-R> (#9934)
Remove <C-R> special char after reading following chars
2019-04-24 10:41:07 +02:00
glacambre
b3fd83a0ea Reset stop_insert_mode in terminal_enter rather than terminal_check
Problem: Using `:stopinsert` while in normal mode in a terminal buffer
prevents neovim from entering insert mode.

Solution: Move `stop_insert_mode = false` from terminal_check to
terminal_enter to be consistent with edit.c, as suggested by bfredl in
 #9889.

Closes https://github.com/neovim/neovim/issues/9889.
2019-04-20 10:41:46 +02:00
Björn Linse
0be8fb47a4
Merge pull request #9898 from bfredl/floatwidth
windows: float config changes
2019-04-14 13:35:11 +02:00
Björn Linse
c8acbe3b62 windows: float config changes
- Allow floating windows of width 1. #9846
- For a new floating window the size must be specified. Later on we
  might try to calculate a reasonable size by buffer contents
- Remember the configured size of a window, just like its position.
- Make get_config and set_config more consistent. Handle relative='' properly in set_config.
  get_config doesn't return keys that don't make sense for a non-floating window.
- Don't use width=0 for non-changed width, just omit the key.
2019-04-14 10:12:09 +02:00
Justin M. Keyes
dd9554a820 inccommand: Ignore :redraw during preview
closes #9777
2019-04-14 02:22:19 +02:00
Justin M. Keyes
82d48c0dab
Merge pull request #9896 from justinmk/api-async-error
API: emit nvim_error_event on failed async request
2019-04-13 19:53:09 +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
Marco Hinz
5f996e36d1
options: properly reset directories on 'autochdir' (#9894)
Fixes https://github.com/neovim/neovim/issues/9892
2019-04-13 12:50:36 +02:00
Gabriel Cruz
3b7a4f233b vim-patch:8.0.0714: cmdline redraw during timer #9835
vim-patch:8.0.0714: when a timer causes a command line redraw " goes missing
Problem:    When a timer causes a command line redraw the " that is displayed
            for CTRL-R goes missing.
Solution:   Remember an extra character to display.
a92522fbf3

vim-patch:8.0.0720: unfinished mapping not displayed when running timer
Problem:    Unfinished mapping not displayed when running timer.
Solution:   Also use the extra_char while waiting for a mapping and digraph.
            (closes vim/vim#1844)
6a77d2667e

close #9835
2019-04-12 03:20:05 +02:00
Marco Hinz
ae88e46563
float: always change to valid windows (#9878)
Using `:wincmd j` and friends doesn't make much sense to a floating window. For
convenience though, any direction will simply change to the previous window.

Make sure the previous window is valid, not the current window, and not another
floating window. Change to the first window (which is never a floating window)
otherwise.
2019-04-11 20:20:17 +02:00
Justin M. Keyes
ddd0eb6f51
startup: -es/-Es (silent/batch mode): skip swapfile #8540
To use Nvim as a scripting engine the side-effects of swapfiles and user
config should be avoided by default.
2019-04-10 03:27:25 +02:00
Björn Linse
5a81561e7a
Merge pull request #9866 from bfredl/setbufcursor
api/window: validate cursor in nvim_win_set_buf
2019-04-08 13:41:39 +02:00
Björn Linse
344c69b66b api/window: validate cursor in nvim_win_set_buf
validate_cursor() is called regularly, but only for the current window.
When changing the buffer for a non-current window, we need to invoke it
in the context of that window.
2019-04-08 12:39:08 +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
glacambre
d928b036dc :stopinsert should leave terminal-mode #9856
Problem:  Calling :stopinsert from RPC while in terminal-mode does not
          go back to normal-mode.
Solution: Implement a check() handler for state_enter(), adapted from
          insert_check().

Fix #7807
2019-04-08 01:13:43 +02:00
Justin M. Keyes
a7a56293aa
CI/AppVeyor: per-compiler deps cache #9852
The deps cache does not work for MSVC builds because the MINGW builds
ovewrite it.  Cache saves 10+ minutes on the build.
2019-04-07 03:54:22 +02:00
Marco Hinz
d9de4c0efb
vim-patch:8.1.1072: extending sign and foldcolumn below the text is confusing (#9816)
Problem:    Extending sign and foldcolumn below the text is confusing.
Solution:   Let the sign and foldcolumn stop at the last text line, just like
            the line number column.  Also stop the command line window leader.
            (Christian Brabandt)

8ee4c01b8c

Closes https://github.com/neovim/neovim/issues/9613
2019-04-03 10:48:47 +02:00
Justin M. Keyes
8eaa452073
Merge #9516 from erw7/improve-executable-on-windows
Improve executable() and exepath() on windows
2019-04-02 12:40:36 +02:00
Justin M. Keyes
c7039fd0d3 test: "$PATHEXT=::" 2019-04-02 01:28:11 +02:00
Abdelhakeem Osama
35362495c9 jumplist: avoid extra tail entry #9805
fixes #9775
2019-04-02 00:50:28 +02:00
erw7
ece8d88b10 test/win: Remove unnecessary set shell 2019-04-01 19:47:58 +09:00
erw7
3be5aa1a34 test/win: executable(), exepath() #9516 2019-04-01 03:13:11 +02:00
Olivier G-R
d13803f64f keymap, terminal: more keycodes #9810
- input: recognize <kEqual>, <kComma>
- terminal.c: If we need to support function key, a change must be made
  in libvtermkey. Currently, it emulates strictly VT220 terminal, and
  returning numeric value in 'normal' mode is the expected behaviour.

closes #9810
2019-03-31 23:39:06 +02:00
Marco Hinz
4c4a570156
Merge #9807 from mhinz/window-local-last-cursormoved 2019-03-31 15:13:38 +02:00
Qiming zhao
9e52255de2 autocmd: rename MenuPopupChanged to CompleteChanged #9819 2019-03-31 01:15:41 +01:00
Said Al Attrach
2bf18e7843
test: move trim to global helpers 2019-03-30 18:14:20 +01:00
Marco Hinz
33d4c38131
cursormoved: add tests for CursorMoved 2019-03-29 10:58:53 +01:00
Olivier G-R
f6fb370b1b keymap: add more (keypad) keycodes #9793
- K_KORIGIN instead of K_KCENTER: This name is similar to what is used
  by xev. Alternative could be K_KBEGIN as hinted here:
  https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-PC-Style-Function-Keys
  But I find Begin and Home too similar, and it might induced some
  confusion. The naming looked related to some old keyboard
  configuration.

- keymap.c: alias KPPeriod to kDel instead of kPoint.
  This might seems weird, but this is actually the behaviour that should
  be expected. libtermkey produces "KPPeriod" when num lock is off. To
  fix this would need to change this name in termkey.

closes #9780
closes #9793
2019-03-29 01:11:57 +01:00
Justin M. Keyes
fbaee922d1 doc [ci skip]
closes #9719
2019-03-26 19:55:33 +01:00
Dan Aloni
36762a00a8 signs: support multiple columns #9295
closes #990
closes #9295

- Support for multiple auto-adjusted sign columns.
  With this change, having more than one sign on a line, and with the
  'auto' setting on 'signcolumn', extra columns will shown automatically
  to accomodate all the existing signs.

  For example, suppose we have this view:

   5147             }
   5148
   5149             return sign->typenr;
   5150         }
   5151     }
   5152     return 0;
   5153 }
   5154

  We have GitGutter installed, so it tells us about modified lines that
  are not commmited. So let's change line 5152:

     5147             }
     5148
     5149             return sign->typenr;
     5150         }
     5151     }
   ~ 5152     return 0;
     5153 }
     5154

  Now we add a mark over line 5152 using 'ma' in normal mode:

      5147             }
      5148
      5149             return sign->typenr;
      5150         }
      5151     }
  a ~ 5152     return 0;
      5153 }
      5154

  Previously, Vim/Nvim would have picked only one of the signs,
  because there was no support for having multiple signs in a line.

- Remove signs from deleted lines.
  Suppose we have highlights on a group of lines and we delete them:

   +     6 use std::ops::Deref;
   --+   7 use std::borrow::Cow;
   --+   8 use std::io::{Cursor};
         9 use proc_macro2::TokenStream;
        10 use syn::export::ToTokens;
   --+  11 use std::io::Write;
   >>   12 use std::ops::Deref;

  Without this change, these signs will momentarily accumulate in
  the sign column until the plugins wake up to refresh them.

  + --+ --+ --+ >>  6

  Discussion: It may be better to extend the API a bit and allow this
  to happen for only certain types of signs. For example, VIM marks
  and vim-gitgutter removal signs may want to be presreved, unlike
  line additions and linter highlights.

- 'signcolumn': support 'auto:NUM' and 'yes:NUM' settings
- sort signs according to id, from lowest to highest. If you have
  git-gutter, vim-signature, and ALE, it would appear in this order:
  git-gutter - vim-signature - ALE.
- recalculate size before screen update
- If no space for all signs, prefer the higher ids (while keeping the
  rendering order from low to high).
- Prevent duplicate signs. Duplicate signs were invisible to the user,
  before using our extended non-standard signcolumn settings.
- multi signcols: fix bug related to wrapped lines.
  In wrapped lines, the wrapped parts of a line did not include the extra
  columns if they existed. The result was a misdrawing of the wrapped
  parts. Fix the issue by:
    1. initializing the signcol counter to 0 when we are on a wrap boundary
    2. allowing for the draw of spaces in that case.
2019-03-25 02:17:47 +01:00
Said Al Attrach
a9df3fa5d2
test: make first attempt at some kind of test 2019-03-24 00:21:26 +01:00
Jit Yao Yap
2a618e0ad0 Update test 2019-03-23 22:14:03 +01:00
Jit Yao Yap
31fa064c68 floating-window.c: fix crash when using inccommand 2019-03-23 22:14:03 +01:00
Björn Linse
ae49e8da58 window: don't crash when closing two floats in a row
prevwin can be set to the current window. Then we can't jump to it
after closing a float.
2019-03-23 20:12:37 +01:00
Marco Hinz
3e78319ac6
help: ignore snapshotted window if invalid (#9774)
Nvim doesn't expect a window-changing command on an created-window event.

    autocmd WinNew * wincmd p
    help help

- A snapshot for window 1000 is created.
- The window is split and the cursor changes to the new window 1001.
- The autocmd kicks in and switches back to 1000.
- The help buffer is opened.
- On closing the help window 1000, it tries to go back to the snapshotted window
  which is... 1000.
- wp1000->w_buffer == NULL
- w_buffer is used by check_cursor()
- 🧨 -> 💥

Fixes https://github.com/neovim/neovim/issues/9773
2019-03-23 00:23:39 +01:00
Marco Hinz
3edf7fc64f
api: ignore floating windows for laststatus=1 (#9771)
ONE_WINDOW considers all windows whereas one_window() ignores floating windows.

Fixes https://github.com/neovim/neovim/issues/9768
2019-03-22 17:17:33 +01:00
Chris LaRose
c5631338b1 :mksession : restore tab-local working directories #9754 2019-03-21 11:53:38 +01:00
Marco Hinz
f282324e1b
test: add more debuggings tips [ci skip] (#9761)
Mention the common press-enter issue and how to visualize the screen.
2019-03-19 17:44:35 +01:00
Justin M. Keyes
6f7b81bd6d
vim-patch:8.1.{0849,1001}: 'cursorline' highlight #9757
- Lua test correctly fails when 8.1.0849 is reverted.
- 8.1.1001 bug does not manifest in Neovim.

vim-patch:8.1.0849: cursorline highlight is not always updated
Problem:    Cursorline highlight is not always updated.
Solution:   Set w_last_cursorline when redrawing.  Fix resetting cursor flags
            when using the popup menu.
c07ff5c60a

vim-patch:8.1.1001: Visual area not correct when using 'cursorline'
Problem:    Visual area not correct when using 'cursorline'.
Solution:   Update w_last_cursorline also in Visual mode. (Hirohito Higashi,
            closes vim/vim#4086)
8156ed3755
2019-03-19 12:24:41 +01:00
Justin M. Keyes
5beb3b8ee5 test: example_spec.lua 2019-03-19 01:37:48 +01:00
Marco Hinz
9ef8d0d6b0
Merge pull request #9726 from mhinz/nvim_win_get_config
Closes #9723
2019-03-17 02:34:50 +01:00
Justin M. Keyes
7c38994ff2
aucmd_prepbuf: also restore prevwin #9741
bisected to f5d5da3917

Other test steps:

    nvim -u NORC
    :terminal tree /    " Produces lots of output
    :edit somefile.txt
    :vsplit
    :vsplit
    <c-w>l
    <c-w>l
    <c-w>h
    <c-w>p
2019-03-17 02:09:06 +01:00
Marco Hinz
b557654f36 api: add tests for new code paths 2019-03-16 21:44:15 +01:00
Björn Linse
5c836d2ef8
Merge pull request #9607 from bfredl/wildpum
UI: deprecate redundant ext_wildmenu events and allow TUI popupmenu for cmdline
2019-03-16 20:41:10 +01:00
Justin M. Keyes
11a481f711 Merge #9686 'win/Lua: monkey-patch os.getenv()'
fixes #9681
2019-03-16 20:28:52 +01:00
Björn Linse
be8ebba325 Allow using internal popupmenu or ext_popupmenu for wildmenu
Deprecate ext_wildmenu. ext_popupmenu already contains more state (anchor
position), and will allow further expansion (info about items).
2019-03-16 19:53:21 +01:00
Marco Hinz
86992a7bb1
api: numerous small fixes 2019-03-16 15:02:56 +01:00
Marco Hinz
96edbe7b1d
api: add width/height to FloatConfig 2019-03-16 12:35:58 +01:00
Marco Hinz
3c88bbecb8
api: nvim_win_config() -> nvim_win_set_config() 2019-03-16 12:35:58 +01:00
Björn Linse
175398f216
Merge pull request #9616 from chemzqm/completechange
add MenuPopupChanged autocmd
2019-03-16 10:36:54 +01:00
Justin M. Keyes
b90256e6cc test: simplify TUI bg-detection test
Previous approach skipped the test if the expected value matched the
default value ("dark"). New approach always checks, but uses retry() to
ignore potentially wrong 'background' before the terminal response is
handled.
2019-03-15 05:26:41 +01:00
Justin M. Keyes
1baf4edbd9
Merge #9728 from justinmk/autocmd-once 2019-03-15 12:38:53 +01:00
chemzqm
6c375d71c3 autocmd: add MenuPopupChanged autocmd
Update src/nvim/auevents.lua

Co-Authored-By: chemzqm <chemzqm@gmail.com>
2019-03-15 04:24:41 +08:00
Björn Linse
ca5f919965 compositor: fix rendering issues with floats opened after popupmenu 2019-03-14 10:43:49 +01:00
Justin M. Keyes
b1f25ea187 autocmd: do not show empty section after ++once handlers expire
Problem: If autocmd pattern only contained `++once` handlers, and
         all of them completed, then there would be an empty group
         displayed by `:autocmd Foo`.
Solution: Delete the pattern if all of its commands were deleted.
2019-03-14 01:30:11 +01:00
Justin M. Keyes
3259e45f92 autocmd: rename: "++nested", "++once"
Based on feedback from upstream:
https://github.com/vim/vim/pull/4100
2019-03-14 01:30:11 +01:00
demiurg337
9d207fd876 dictwatcheradd(): support b:changedtick #9693
fixes #6635
closes #9693
2019-03-14 00:38:56 +01:00
Justin M. Keyes
7fcf2f926f
TextYankPost: add v:event["inclusive"] #9717 2019-03-13 03:24:09 +01:00
Justin M. Keyes
4f5e378124
test/CI: skip "throttles output" test on Travis macOS #9721
Travis macOS is not fast enough to run this test reliably. The test
depends on the system producing output faster than the Nvim TUI can
handle it.
2019-03-12 19:26:24 +01:00
Björn Linse
81e84f2aae floats: add NormalFloat highlight and 'nonumber' default 2019-03-12 17:17:54 +01:00
Justin M. Keyes
9312e2d06a
autocmd: rename "once" => "-once" #9713
- Rename "nested" to "-nested", but continue to support "nested" for
  backwards-compatibility.
- Allow any order: "-once -nested" or "-nested -once".

ref https://github.com/neovim/neovim/pull/9706#issuecomment-471295747
2019-03-11 21:01:47 +01:00
Justin M. Keyes
43184566aa TUI/background detection: hook into VimEnter event
If terminal response is received during startup, set 'background' from
a nested "one-shot" (once) VimEnter autocmd.

The previous not-so-clever "self-rescheduling" approach could cause
a long delay at startup (event-loop does not make forward progress).

fixes #9675
ref #9509
2019-03-11 08:43:27 +01:00
Justin M. Keyes
c12cf5bde7 autocmd: introduce "once" feature
Adds a new feature to :autocmd which sets the handler to be executed at
most one times.

Before:

    augroup FooGroup
      autocmd!
      autocmd FileType foo call Foo() | autocmd! FooGroup * <buffer>
    augroup END

After:

    autocmd FileType foo once call Foo()
2019-03-10 04:58:30 +01:00
Justin M. Keyes
3cb89cafe3
vim-patch:8.1.0994: fix relative cursor position #9676
Problem:    Relative cursor position is not calculated correctly.
Solution:   Always set topline, also when window is one line only.
            (Robert Webb) Add more info to getwininfo() for testing.
8fcb60f961
2019-03-09 23:12:33 +01:00
erw7
f719247118 floating-window: fix crash setting cmdheight #9685
fixes #9680
2019-03-09 14:10:56 +01:00
erw7
c9264e6d52 Fix os.getenv of lua on Windows
Change to use os_getenv instead of getenv because environment variable
set by uv_os_setenv can not be get with getenv.
2019-03-07 13:49:02 +09:00
erw7
24a56cca30 Fix environment variable on Windows
Since uv_os_setenv uses SetEnvironmentVariableW, _wenviron is no
updated. As a result, inconsistency occurs in completion of environment
variable names. Change to use GetEnvironmentStaringsW instead of
_wenviron to solve it.
2019-03-06 18:06:51 +09:00
Björn Linse
f5d5da3917 buffer: use aucmd_prepbuf() instead of switch_to_win_for_buf() 2019-03-05 15:05:23 +01:00
lePerdu
f288a64264 edit.c: Disable indent during completion
closes #8345
2019-03-03 23:08:08 +01:00
Björn Linse
bcbb96e31b
Merge pull request #9667 from bfredl/winclose
api: add nvim_win_close() to close window by id
2019-03-03 17:30:58 +01:00
Björn Linse
c8f310825c api: add nvim_win_close() to close window by id 2019-03-03 13:09:43 +01:00
Justin M. Keyes
bb8ea83d75 test: multibyte env var names #9655 2019-03-03 11:23:12 +01:00
Björn Linse
7a6da502b9
Merge pull request #6619 from bfredl/floating
Floating windows in TUI and Remote UI
2019-03-02 17:26:50 +01:00
Björn Linse
9a1675b065 floats: implement floating windows
Co-Author: Dongdong Zhou <dzhou121@gmail.com>
2019-03-02 16:29:50 +01:00
Justin M. Keyes
d44ab5fdea
search.c: remove dead code #5307
has_mbyte is always true.
2019-03-02 03:13:00 +01:00
KillTheMule
018e0d5a19 API/buffer-updates: always detach on buf-reload #9643
Independently of the 'undoreload' option and the length of the file.
closes #9642
closes #9643
2019-03-01 20:01:50 +01:00
Justin M. Keyes
403922b1b4 test: fix isCI() for Quickbuild 2019-03-01 01:48:46 +01:00
erw7
67535b5940 test/env: multibyte env var to child process
Note: the test fails on non-Windows CI (Travis linux, Quickbuild bsd):
even on master before the env.c changes in this patch-series.
Maybe the unix part of printenv-test.c needs to be revisited.

Signed-off-by: Justin M. Keyes <justinkz@gmail.com>
2019-02-28 22:40:11 +01:00
Justin M. Keyes
89515304e4 os/env: use libuv v1.12 getenv/setenv API
- Minimum required libuv is now v1.12
- Because `uv_os_getenv` requires allocating, we must manage a map
  (`envmap` in `env.c`) to maintain the old behavior of `os_getenv` .
- free() map-items after removal. khash.h does not make copies of
  anything, so even its keys must be memory-managed by the caller.

closes #8398
closes #9267
2019-02-27 23:29:07 +01:00
Justin M. Keyes
1d8e768360 os_getenv, os_setenv: revert "widechar" impl
It's reported that the Windows widechar variants do automatically
convert from the current codepage to UTF16, which is very helpful. So
the "widechar" impls are a good direction.  But libuv v1.12 does that
for us, so the next commit will use that instead.

ref #8398
ref #9267
2019-02-26 22:38:52 +01:00
Justin M. Keyes
9153062095 os_setenv: use _wputenv_s; remove vestigial code #7920
_putenv_s variant was left over from 810d31a430, should have been
removed in cd5b131575.
2019-02-25 23:47:54 +01:00
Justin M. Keyes
d3dc946155 TUI: rework background-color detection
- Like Vim, use set_option_value() followed by reset_option_was_set().
- Do not use set_string_default(), so the default is predictable.
  This affects `:set bg&`.
- Wait until end-of-startup (VimEnter) to handle the response. The
  response is racey anyways, so timing is irrelevant. This allows
  OptionSet to be triggered, unlike during startup.
2019-02-22 21:15:16 +01:00
Justin M. Keyes
6bd6927656 Merge #5027 'TUI: detect background color' 2019-02-17 14:47:40 +01:00
Justin M. Keyes
dc9dd8d664
Merge #9593 'API: nvim_create_buf: "scratch" param' 2019-02-17 08:32:25 +01:00
Justin M. Keyes
5225c1ec30
terminal: Fix potential invalid local 'scrollback' (#9605)
TermOpen autocmd may set local 'scrollback' to -1, this needs to be
adjusted as in on_scrollback_option_changed().

fixes #9588 (OOM, out of memory)
2019-02-17 08:07:30 +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
Justin M. Keyes
e50d0b6fc1 UI: change implementation of hl_rgb2cterm_color()
Replace the implementation cargo-culted from Vim's source with something
simpler which "seems to look better" with 'pumblend'.
2019-02-12 10:11:30 +01:00
Björn Linse
af51ae944e highlight: handle blending with gui=reverse and guisp attributes 2019-02-11 19:38:02 +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
37f8df8824 UI: implement 'pumblend' option for semi-transparent popupmenu
Why?

- Because we can.
- Because the TUI is just another GUI™
- Because it looks kinda nice, and provides useful context like 1 out of 100
  times

Complies with "don't pay for what you don't use".

Some crashes for resizing were unfolded, add tests for those.
2019-02-07 16:43:51 +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
Justin M. Keyes
36378c33c6
Merge #9560 from justinmk/Wmissing-prototypes 2019-02-04 19:40:14 +01:00
Justin M. Keyes
f2c6164b04 build: -Wmissing-prototypes
ref #343

Though I don't see a strong benefit, it isn't too much of a burden, and
maybe avoids confusion in some cases.
2019-02-04 04:00:20 +01:00
Marco Hinz
91688b4883 options: set 'scrollback' to -1 by default #9563
Makes the 'scrollback' option more consistent (same default for all buffers) and future-proof.

- Default to -1 for all buffers, but treat it as an implementation detail.
- Document range of 1 - 100_000.
- New terminal buffer by default sets scrollback=10_000 if the global default is -1.
- Existing terminal buffer: On entering terminal-mode or on refresh, if the user explicitly did `:set[local] scbk=-1`, the local value goes to 100_000 (max). (This is undocumented on purpose. Users should work with explicit values in the range of 1-100_000.)
2019-02-04 02:53:23 +01:00
Marco Hinz
70f6939fd4 events: add "Signal" event #9564
..which gets triggered when SIGUSR1 is sent to the nvim process.

Closes #9562
2019-02-04 02:39:05 +01:00
Björn Linse
da88278f27
Merge pull request #9579 from bfredl/pum_fix
popupmenu: fix alignment of kind and extra after #9530
2019-02-03 22:17:28 +01:00
Justin M. Keyes
08155e2b53
Merge #9578 'vim-patch:8.0.{1045,1073,1077,1114}' 2019-02-03 21:36:32 +01:00
Björn Linse
81ac8e9015 popupmenu: fix alignment of kind and extra after #9530 2019-02-03 20:43:23 +01:00
Jan Edmund Lazo
5a40abe2d5 vim-patch:8.0.1114: default for 'iminsert' is annoying
Problem:    Default for 'iminsert' is annoying.
Solution:   Make the default always zero. (Yasuhiro Matsumoto, closes vim/vim#2071)
4cf56bbc85
2019-02-03 09:52:13 -05:00
Björn Linse
79a0ea2bec
Merge pull request #9530 from bfredl/pum_float
Implement popupmenu as a floating grid internally to reduce flicker
2019-02-02 21:27:09 +01:00
Björn Linse
bfe2435459 tests/ui: add test for popupmenu redrawing in various situations
Many of these are handled by the compositor. Check that it causes
no glitches.
2019-02-02 16:31:49 +01:00
KillTheMule
f89d0d8230 inccommand: auto-disable if folding is slow #9568
Fixes #9557
2019-02-01 01:40:01 +01:00
Justin M. Keyes
a494910aa1 test: adjust timer_spec 2019-01-31 22:26:32 +01:00
Justin M. Keyes
d4750100b0 test: improve reliability of ":terminal topline" test
- Avoid using platform-specific shell, it failed in MINGW_64 env.
- tty-test.c echos our input, which is exactly what we need for this test.
- Test fails correctly if 894f6bee54 is reverted.
2019-01-31 22:26:32 +01:00
Andrew Pyatkov
894f6bee54 :terminal : set topline based on window height #8325
closes #8324
closes #8556
2019-01-29 03:00:48 +01:00
Marco Hinz
28f87c505d
Merge #9539 "options: make 'listchars' and 'fillchars' local to window" 2019-01-28 00:45:59 +01:00
Björn Linse
30bd1c1e85 terminal: handle size when switching buffers in window 2019-01-27 12:07:06 +01:00
Björn Linse
2ab70cb55c window/ui: reorganize size variables, fix terminal window size with multigrid.
wp->w_height_inner now contains the "inner" size, regardless if the
window has been drawn yet or not. It should be used instead of
wp->w_grid.Rows, for stuff that is not directly related to accessing
the allocated grid memory, such like cursor movement and terminal size
2019-01-27 12:07:06 +01:00
Justin M. Keyes
1a3d2dbfe7 menu_get(): fix query behavior
- Return the menu properties, not only its children.
- If the {path} param is given, return only the first node. The "next"
  nodes in the linked-list are irrelevant.
2019-01-27 00:51:58 +01:00
Justin M. Keyes
d760e08fac menu_get(): Do not include empty items
Caused by a typo: `dict` instead of `dic`. Renamed variable to `d` to
make it less similar.
2019-01-27 00:51:58 +01:00
Justin M. Keyes
827ed144fb fix ":menu Item.SubItem"
:menu should print sub-menu contents. E.g. this should print the
"File.Save" submenu:

    nvim -u NORC
    :source $VIMRUNTIME/menu.vim
    :menu File.Save

Regressed in dc685387a3
Blocks #8173

menu_get() also was missing some results for some cases.
2019-01-27 00:51:58 +01:00
Marco Hinz
88b0899eb4
tests: 'fcs' and 'lcs' are local to the window 2019-01-26 15:10:46 +01:00
Marco Hinz
df5534f576
tests: fix mouse tests that use lcs=eol:$
Previously the mouse tests set 'listchars', but not 'list'. Funnily enough, the
space, where the `$` would normally appear, would still use new highlight group.

Set 'list' for good and fix the tests accordingly.
2019-01-26 14:45:47 +01:00
Björn Linse
f7b174eb71 tests/lua: test for multiline error messages in lua 2019-01-23 19:34:13 +01:00
Björn Linse
a2be9c7218 ui: multigrid mouse support 2019-01-20 10:32:05 +01:00
Justin M. Keyes
8093cbd8e8
Merge #9292 from mhinz/xcode10 2019-01-17 23:24:03 +01:00
Matěj Cepl
a8a38f3465 test: Lua 5.2/5.3 compat
close #9515
ref #9280
2019-01-17 23:06:04 +01:00
Marco Hinz
f2e996b991
tests: load-adjust timer tests (functionaltest) 2019-01-17 15:59:23 +01:00
Justin M. Keyes
7e9b99d55b Merge #5027 'TUI: detect background color' 2019-01-17 13:05:51 +01:00
Björn Linse
5a836d4767 screen: don't unconditionally clear messages on window scroll
In vim, scrolling a window might mess up the cmdline. To keep it simple,
cmdline was always cleared for any window scroll. In nvim, where safe scrolling
is implemented in the TUI layer, this problem doesn't exist.

Clearing the message on scrolling, when we not do it e.g when switching tabs
is a bit weird, as the former is a much smaller context change.

A vim patch introduced the possibility to avoid the cmdlline clear for
redraws caused by async events. This case will now trivially be covered,
as the redraw is always avoided.

vim-patch:8.0.0592: if a job writes to a buffer screen is not updated
2019-01-15 19:48:49 +01:00
raffitz
95fa71c6d2 :recover : Fix crash on non-existent *.swp #9504
Reverts d2944e6a29. mf_open() _can_ fail if the file does not exist.

closes #9503
closes #9504
2019-01-15 00:47:53 +01:00
Björn Linse
3a84e5be88 lua: expose full interface of vim.inspect and add test
Implement lazy loading for vim.submodule, this would be over-engineering
for inspect only, but we expect to use this solution also for more and
larger modules.
2019-01-14 20:12:57 +01:00
Justin M. Keyes
89d7e24891 Merge #9463 'Lua stdlib' 2019-01-14 02:25:45 +01:00
Justin M. Keyes
6c02ff4747 lua/stdlib: Load runtime modules on-demand
Instead of eager-loading during plugin/* sourcing, define runtime
modules such as `vim.inspect` as lazy builtins. Otherwise non-builtin
Lua modules such as `vim.inspect` would not be available during startup
(init.vim, `-c`, `--cmd`, …).

ref #6580
ref #8677
2019-01-14 02:22:16 +01:00
KillTheMule
bb3aa824b7 lua/stdlib: vim.inspect, string functions
ref #6580
ref #8677
2019-01-14 02:14:34 +01:00
Justin M. Keyes
38b9256439 test/API: nvim_set_vvar() #9395 2019-01-14 00:50:29 +01:00
Björn Linse
9c75929e7b test: add tests for conceal cursor movement 2019-01-13 12:08:11 +01:00
Marco Hinz
db3c797c6b
provider: improve error message if provider is missing (#9487)
Move `has_eval_provider()` check to `eval_call_provider()` to make sure that
every code path calls it first.

Previously we would, when pynvim was missing, get a nice error message for
`:python3 1`, but not for `:py3file blah`.

Fixes https://github.com/neovim/neovim/issues/9485
2019-01-12 00:52:12 +01:00
Michael Vilim
bed95b37b2 vim-patch:8.1.0449: fix display of 'rnu' with folded lines #9481
Problem:    When 'rnu' is set folded lines are not displayed correctly.
            (Vitaly Yashin)
Solution:   When only redrawing line numbers do draw folded lines.
            (closes vim/vim#3484)
7701f30856

---
Explanation:
Before this patch, relative line numbers would update on a cursor
movement and overwrite fold highlighting in the line number columns.
Other operations can cause the fold highlighting to overwrite the line
number styles. Together, this causes the highlighting in the line number
columns to flicker back and forth while editing.

Test case: create `t.vim` with these contents:

    set fdm=marker rnu foldcolumn=2
    call setline(1, ["{{{1", "nline 1", "{{{1", "line 2"])

and then call `nvim -u NORC -S t.vim` and press `j`; observe that the fold
highlighting disappears.
2019-01-11 01:44:15 +01:00
Björn Linse
ae218c108f api: select items in popupmenu 2019-01-09 10:17:48 +01:00
Björn Linse
9452532036 API: don't directly call update_screen() in API functions
There is no need to call update_screen() directly in an API function,
mode input processing invokes update_screen() as needed. And if the API
call is done in a context where redraw is disabled, then redraw is
disabled for a reason. A lot of API functions are of equal semantical
strength (nvim_call_function and nvim_execute_lua can also do whatever,
nvim_command is not special), this inconsistency has no purpose.
2019-01-08 23:31:48 +01:00
Justin M. Keyes
37a499148f Visual: highlight char-at-cursor
Decide whether to highlight the visual-selected character under the
cursor, depending on 'guicursor' style:

- Highlight if cursor is blinking or non-block (vertical, horiz).
- Do NOT highlight if cursor is non-blinking block.

Traditionally Vim's visual selection does "reverse mode", which perhaps
conflicts with the non-blinking block cursor. But 'guicursor' defaults
to a vertical bar for selection=exclusive, and this confuses users who
expect to see the text highlighted.

closes #8983
2019-01-04 01:28:44 +01:00
Björn Linse
5a11e55358
Merge pull request #9434 from bfredl/multigrid_fixes
Multigrid: fix popupmenu position + some cleanup
2019-01-01 22:21:57 +01:00
James McCoy
e2e5a105c6
Merge pull request #9436 from jamessan/more-fragile-tests
Mark a few more functionaltests as fragile
2019-01-01 16:02:23 -05:00
James McCoy
2fbe28bc05
Mark "shell command :! throttles shell-command output greater than ~10KB" fragile 2019-01-01 11:27:52 -05:00
James McCoy
b5de158fdf
Mark "feeding large chunks of input with <Paste>" fragile 2019-01-01 11:27:23 -05:00
James McCoy
e53e56d5e5
Mark ":substitute with inccommand during :terminal activity" fragile 2019-01-01 11:26:56 -05:00
Björn Linse
cdfa395ad8 popupmenu: fix positioning with vsplits 2019-01-01 15:20:37 +01:00
Björn Linse
9a1c61456b multigrid: simplify tests 2018-12-31 16:24:07 +01:00
Björn Linse
44b8e58f33 multigrid: add tests for multiline messages and tabs 2018-12-31 16:24:07 +01:00
Björn Linse
ed3da23cf4 multigrid: test refactor 2018-12-31 16:24:07 +01:00
Björn Linse
db14d78e4f multigrid: rename event to win_pos, make grid first 2018-12-31 12:44:22 +01:00
Björn Linse
f6f8f0ee76 multigrid: add msg_scroll_start and msg_scroll_reset events 2018-12-31 12:44:22 +01:00
Utkarsh Maheshwari
ebe16cd9bd multigrid: add multigrid screen tests 2018-12-31 12:44:22 +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
Justin M. Keyes
4dd3fc4ca9 NVIM v0.3.2
Besides the "visible" improvements, this release features numerous
internal improvements to the UI/screen code and test infrastructure.

Numerous patches were merged from Vim, which are not mentioned below.

FEATURES:

07ad5d71ab clipboard: Support custom VimL functions #9304
725da1feeb #9401 win/TUI: Improve terminal/console support
7a8dadbedb #9077 startup: Use $XDG_CONFIG_DIRS/nvim/sysinit.vim if it exists
feec926633 #9299 support <cmd> mapping in more places
0653ed63a5 #9028 diff/highlight: Show underline for low-priority CursorLine
bddcbbb571 signs: Add "numhl" argument #9113
05f9c7c2f7 clipboard: support Wayland (#9230)
14ae394532 #9052 TUI: add support for undercurl and underline color
4fa3492a6f #9023 man.vim: soft (dynamic) wrap #9023

API:

8b39e4ec79 #6920 API: implement object namespaces
b1aaa0a881 API: Implement nvim_win_set_buf() #9100
8de87c7b1c #8180 API: virtual text annotations (nvim_buf_set_virtual_text)
2b9fc9a13f #8660 API: add nvim_buf_is_loaded()
    API: buf_get_lines, buf_line_count handle unloaded buffers
88f77c28e5 API: nvim_buf_get_offset_for_line
94841e5eae API/UI: #8221 ext_newgrid, ext_hlstate
    (use line-based rather than char-based updates)

UI

b5cfac0894 #8806 TUI: use BCE again more often, (smoother resizes/scrolling)
77b5e9ae25 #9315 screen: add missing status redraw when redraw_later(CLEAR) was used
5f15788dc3 TUI: clip invalid regions on resize (#8779), fixes #8774
c936ae0f36 #9193 TUI: improvements for scrolling and clearing
f20427451e #9143 UI: disable clearing almost everywhere
f4b2b66661 #9079 TUI: always use safe cursor movement after resize
d36afafc8d #9211 ui_options: also send when starting or from OptionSet
67f80d485c TUI: Avoid reset_cursor_color in old VTE #9191
e55ebae373 #9021 don't erase screen on `:hi Normal` during startup
c5790d9189 #8915 TUI: Hint wrapped lines to terminals.

FIXES:

231de72539 RPC: turn errors from async calls into notifications
907ad921bc TUI: Restore terminal title via "title stacking" (#9407)
cb76a8a95f genappimage: Unset $ARGV0 at invocation #9376
b48efd9ba7 #9347 TUI: FreeBSD: Improve support for BSD vt console
c16529afa5 TUI: Konsole 18.07.70 supports DECSCUSR (#9364)
aec096fc5b os/lang: use the correct LC_NUMERIC also for OS X
5fee0be915 provider: improve error message (#9344)
3c42d7a10a TUI: alacritty supports set_cursor_color #9353
7bff9a5de8 TUI: Alacritty supports DECSCUSR (#9048)
57acfceabe macOS: infer primary language if $LANG is empty #9345
bc132ae123 runtime/syntax: Fix highlighting of augroup contents (#9328)
715fdfee1e #9297 VimL/confirm(): Show dialog even if :silent
799d9c3215 clipboard: Prefer xclip (#9302)
6dae7776ed provider/nodejs: fix npm,yarn detection
16bc1e9c17 #9218 channel: avoid buffering output when only terminal and no callbacks are active
72fecad1ff #8804 Fix crash in lang_init() on macOS if lang_region = NULL
d581398779 ruby: detect rbenv shims for other versions (#8733)
e568ac7a68 #9123 third-party/unibilium: Fix parsing of extended capability entries
c4c74c3883 jobstart(): Fix hang on non-executable cwd #9204
1cf50cbfd9 provider/nodejs: Simultaneously query npm and yarn #9054
6c496db4b7 undo: Fix infinite loop if undo_read_byte returns EOF #2880
f8f83579ff #9034 'swapfile: always show dialog'

CHANGES:

c236e80cf3 #9024 --embed: wait for UI unless --headless
180b50dddc #9248 python: 'neovim' module was renamed to 'pynvim'
2000b6a64a #8589 VimL: Remove legacy aliases "v:errmsg", "v:shell_error", "v:this_session"
deb18a050e defaults: background=dark #2894 (#9205)
c1187d4af0 defaults: win: 'shellpipe' for cmd.exe (#8827)
2018-12-31 01:06:17 +01:00
Justin M. Keyes
725da1feeb
Merge #9401 from justinmk/pr-win-erw7 2018-12-30 23:54:23 +01:00
Justin M. Keyes
4ba8266ab1 doc
- CMake features
2018-12-30 21:09:39 +01:00
James McCoy
bebbf08c8c
vim-patch:8.1.0354: packadd test fails on MS-Windows
Problem:    Packadd test fails on MS-Windows.
Solution:   Ignore difference between forward and backward slashes.
53c8a478cc
2018-12-29 16:53:09 -05:00
James McCoy
ce4199e8b0
vim-patch:8.1.0353: an "after" directory of a package is appended to 'rtp'
Problem:    An "after" directory of a package is appended to 'rtp', which
            will be after the user's "after" directory. ()
Solution:   Insert the package "after" directory before any other "after"
            directory in 'rtp'. (closes vim/vim#3409)
99396d4cbf
2018-12-29 16:52:25 -05:00
James McCoy
91f40ff284
vim-patch:8.0.1734: package directory not added to 'rtp' if prefix matches
Problem:    Package directory not added to 'rtp' if prefix matches.
Solution:   Check the match is a full match. (Ozaki Kiichi, closes vim/vim#2817)
            Also handle different ways of spelling a path.
f98a39ca57
2018-12-29 12:57:16 -05:00
James McCoy
e09fb6ee53
vim-patch:8.0.1469: when package path is a symlink 'runtimepath' is wrong
Problem:    When package path is a symlink adding it to 'runtimepath' happens
            at the end.
Solution:   Do not resolve symlinks before locating the position in
            'runtimepath'. (Ozaki Kiichi, closes vim/vim#2604)
2374faae11
2018-12-29 11:46:21 -05:00
Justin M. Keyes
e85b911f02 test: win/TUI builtin terminfos 2018-12-28 01:46:25 +01:00
Björn Linse
357e59982d strings: make vim_snprintf handle %d correctly again
This was broken in #9369 (4680ca2)
2018-12-24 10:58:48 +01:00
Björn Linse
8b41f429bb test/api: verify that UI options from stable metadata are preserved 2018-12-21 10:52:25 +01:00
Justin M. Keyes
221f6fffad runtime/lua/vim/compat.lua
ref #9280
Introduce the `vim.compat` module, to help environments with system Lua
5.2+ run the build/tests. Include the module implicitly in all tests.

ref #8677
legacy `vim` module:
    beep
    buffer
    command
    dict
    eval
    firstline
    lastline
    line
    list
    open
    type
    window
2018-12-20 11:57:30 +01:00
Matěj Cepl
e6d0dea42b test: Lua 5.2/5.3 compat #9280
Make the code run both on Lua 5.1 (which is the default for Neovim, and
is what LuaJIT provides) and Lua 5.2+.
2018-12-20 11:57:30 +01:00
James McCoy
314f6ea367
startup: Use $XDG_CONFIG_DIRS/nvim/sysinit.vim if it exists
Closes #8994
2018-12-16 12:05:47 -05:00
Björn Linse
7ba52c0b2b os/lang: use the correct LC_NUMERIC also for OS X 2018-12-13 17:07:12 +01:00
Marco Hinz
315769ae6d
test: :ruby reports E319 if provider is missing 2018-12-12 22:11:00 +01:00
Björn Linse
5f82889be7 cmdline: support v:event in CmdlineChanged 2018-12-12 15:31:52 +01:00
Justin M. Keyes
61d0dfee32 provider: repurpose E319
In Vim (and some vestigial parts of Nvim) E319 was a placeholder for
ex_ni commands, i.e. commands that are only available in certain builds
of Vim.  That is obviously counter to Nvim's goals: all Nvim commands
are available on all platforms and build types (the remaining ex_ni
commands are actually just missing providers).

We need an error id for "missing provider", so it makes sense to use
E319 for that purpose.

ref #9344
ref #3577
2018-12-12 01:26:21 +01:00
Anatolii Sakhnik
4e29810817 vim-patch:8.1.0562: parsing of 'diffopt' is slightly wrong
Problem:    Parsing of 'diffopt' is slightly wrong.
Solution:   Fix the parsing and add a test. (Jason Franklin, Christian
            Brabandt)

b6fc72851c
2018-12-09 22:19:41 +02:00
Anatolii Sakhnik
972ad11195 vim-patch:8.1.0393: not all white space difference options available
Problem:    Not all white space difference options available.
Solution:   Add "iblank", "iwhiteall" and "iwhiteeol" to 'diffopt'.

785fc6567f
2018-12-09 19:45:56 +02:00
Anatolii Sakhnik
cf1ffa9166 vim-patch:8.1.0360: using an external diff program is slow and inflexible
Problem:    Using an external diff program is slow and inflexible.
Solution:   Include the xdiff library. (Christian Brabandt)
            Use it by default.

e828b7621c

vim-patch:8.1.0360
vim-patch:8.1.0364
vim-patch:8.1.0366
vim-patch:8.1.0370
vim-patch:8.1.0377
vim-patch:8.1.0378
vim-patch:8.1.0381
vim-patch:8.1.0396
vim-patch:8.1.0432
2018-12-09 19:45:56 +02:00
Justin M. Keyes
857a7312d0
doc (#9288)
- misc
- doc: `:help config`. closes #9329
- cleanup test/README.md
2018-12-09 01:31:34 +01:00
Björn Linse
b4a04fd80c api: make nvim_buf_set_virtual_text use correct namespace counter 2018-12-07 17:31:05 +01:00
Björn Linse
f1ce9b3be2 screen: add missing status redraw when redraw_later(CLEAR) was used 2018-12-05 10:57:43 +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
Rui Abreu Ferreira
07ad5d71ab clipboard: Support custom VimL functions #9304
Up to now g:clipboard["copy"] only supported string values invoked as
system commands.

This commit enables the use of VimL functions instead. The function
signatures are the same as in provider/clipboard.vim. A clipboard
provider is expected to store and return a list of lines (i.e. the text)
and a register type (as seen in setreg()).

cache_enabled is ignored if "copy" is provided by a VimL function.
2018-12-03 00:07:08 +01:00
Justin M. Keyes
b19403e73e
Merge #9291 'vim-patch:8.1.{550,551}' 2018-12-02 23:10:26 +01:00
Justin M. Keyes
0f00f31cbd VimL/confirm(): Show dialog even if :silent
closes #8788
related #9034
2018-12-01 16:06:01 +01:00
Björn Linse
2271b10a8e insert: make <cmd> mapping work in completion (CTRL-X) mode 2018-12-01 10:37:46 +01:00