Commit Graph

2131 Commits

Author SHA1 Message Date
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
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
9a1675b065 floats: implement floating windows
Co-Author: Dongdong Zhou <dzhou121@gmail.com>
2019-03-02 16:29:50 +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
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
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