Commit Graph

2517 Commits

Author SHA1 Message Date
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
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