Commit Graph

24336 Commits

Author SHA1 Message Date
zeertzjq
f445096cc6
vim-patch:9.0.1043: macro has confusing name and is duplicated (#21801)
Problem:    Macro has confusing name and is duplicated.
Solution:   Use one macro with an understandable name. (closes vim/vim#11686)

c51a376265
2023-01-15 05:27:55 +08:00
zeertzjq
7af2c52ef0
docs: builtin TUI is no longer channel 0 (#21794) 2023-01-15 05:24:19 +08:00
zeertzjq
8b86cb8f5b
vim-patch:8.2.4406: expand functions use confusing argument names (#21800)
Problem:    Expand functions use confusing argument names.
Solution:   Rename "file" to "match".  Refactor some completion code.  Add a
            few more tests. (Yegappan Lakshmanan, closes vim/vim#9790)

2438430863

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-01-14 23:44:38 +08:00
dundargoc
c1fffc42fb
build: enable iwyu with target properties instead of variables (#21797)
IWYU stopped working after 438b4361cc,
likely due to the code being moved from CMakeLists.txt to
src/nvim/CMakelists.txt. Using the IWYU target property instead of the
variable ensures that the information to use IWYU isn't lost.
2023-01-14 15:37:31 +01:00
zeertzjq
686168c648
vim-patch:8.2.4398: some command completion functions are too long (#21799)
Problem:    Some command completion functions are too long.
Solution:   Refactor code into separate functions.  Add a few more tests.
            (Yegappan Lakshmanan, closes vim/vim#9785)

b31aec3b93

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-01-14 22:28:21 +08:00
zeertzjq
2065ce877e
vim-patch:partial:9.0.1196: code is indented more than necessary (#21796)
Problem:    Code is indented more than necessary.
Solution:   Use an early return where it makes sense. (Yegappan Lakshmanan,
            closes vim/vim#11813)

e857598896

Partial port as this depends on some previous eval and 'smoothscroll'
patches.

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-01-14 21:36:15 +08:00
zeertzjq
d549734fb4
Merge pull request #21795 from zeertzjq/vim-8.2.4346
vim-patch:8.2.{4346,4382,4391},9.0.1195

N/A patches for version.c:

vim-patch:9.0.1197: dump file missing from patch

Problem:    Dump file missing from patch.
Solution:   Add missing dump file.

034c350207
2023-01-14 20:50:53 +08:00
zeertzjq
d98e4e4b2e vim-patch:9.0.1195: restoring KeyTyped when building statusline not tested
Problem:    Restoring KeyTyped when building statusline not tested.
Solution:   Add a test.  Clean up and fix other tests. (closes vim/vim#11815)

378e6c03f9
2023-01-14 20:27:40 +08:00
zeertzjq
f95ad61a89 vim-patch:8.2.4391: command line executed when typing Esc in the GUI
Problem:    Command line executed when typing Esc in the GUI.
Solution:   Move saving/restoring KeyTyped to build_stl_str_hl().
            (closes vim/vim#9783)

0e1f36fc59

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-01-14 20:09:56 +08:00
zeertzjq
81473c8ab2 vim-patch:8.2.4382: a custom 'tabline' may cause Esc to work like Enter
Problem:    A custom 'tabline' may cause Esc to work like Enter on the
            command line when the popup menu is displayed.
Solution:   Save and restore KeyTyped. (closes vim/vim#9776)

e4835bf340

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-01-14 20:09:56 +08:00
zeertzjq
ef77598bfb vim-patch:8.2.4346: a custom statusline may cause Esc to work like Enter
Problem:    A custom statusline may cause Esc to work like Enter on the
            command line when the popup menu is displayed.
Solution:   Save and restore KeyTyped. (closes vim/vim#9749)

481acb1141

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-01-14 20:09:56 +08:00
bfredl
bf08390442
Merge pull request #21793 from bfredl/noringbuf
fix(rbuffer): handle edge case where write_ptr has wrapped around too early
2023-01-14 13:06:22 +01:00
bfredl
8ebdb97ea7 fix(rbuffer): handle edge case where write_ptr has wrapped around
when using the rbuffer as a linear buffer, exactly filling the buffer
will case write_ptr to wrap around too early. For now detect this
special case.

Of course, the rbuffer should refactored to a proper ring buffer where
write_pos >= read_pos always and there is no special case for full
buffers. This will be a follow up change.
2023-01-14 11:53:47 +01:00
zeertzjq
d1183b48ad
vim-patch:8.2.4341: command line not redrawn when finishing popup menu (#21792)
Problem:    Command line not redrawn when finishing popup menu and the screen
            has scrolled up.
Solution:   Redraw the command line after updating the screen. (closes vim/vim#9722)

414acd342f

Code change is N/A as Nvim doesn't call update_screen() here.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-01-14 18:36:59 +08:00
zeertzjq
22e3b155f4
vim-patch:partial:8.2.4339: CTRL-A does not work properly with the cmdline popup menu (#21791)
Problem:    CTRL-A does not work properly with the cmdline popup menu.
Solution:   Fix issues with CTRL-A.  Add more tests for the cmdline popup
            menu.  Remove TermWait() before VeriryScreenDump().  Refactor the
            cmdline popup code. (Yegappan Lakshmanan, closes vim/vim#9735)

560dff49c0

Only port cmdexpand.c and test_cmdline.vim changes.

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-01-14 17:23:24 +08:00
dundargoc
e89c39d6f0
refactor: replace char_u with char 21 (#21779)
refactor: replace char_u with char

Work on https://github.com/neovim/neovim/issues/459
2023-01-14 15:58:28 +08:00
dundargoc
9220755302
build: remove clint error suppression #21782
Fix remaining clint errors and remove error suppression completely.

Rename the lint targets to align with the established naming convention:

- lintc-clint lints with clint.py.
- lintc-uncrustify lints with uncrustify.
- lintc runs both targets.

lintc is also provided as a make target for convenience.

After this change we can remove these files:
https://github.com/neovim/doc/tree/gh-pages/reports/clint
https://github.com/neovim/doc/blob/main/ci/clint-errors.sh
2023-01-13 15:48:10 -08:00
zeertzjq
b884d0b370
vim-patch:9.0.1189: invalid memory access with folding and using "L" (#21787)
Problem:    Invalid memory access with folding and using "L".
Solution:   Prevent the cursor from moving to line zero.

232bdaaca9

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-01-14 07:02:45 +08:00
Christian Clason
fd3d30a22c
vim-patch:9.0.1191: some Bazel files are not recognized (#21784)
Problem:    Some Bazel files are not recognized.
Solution:   Add an extra Bazel pattern. (Keith Smily, closes vim/vim#11807)

3213952966

Co-authored-by: Keith Smiley <keithbsmiley@gmail.com>
2023-01-13 17:27:35 +01:00
luukvbaal
4a12372ccf
fix(statuscolumn): make %l/%r respect 'number'/'relativenumber' (#21747)
Resolve https://github.com/neovim/neovim/issues/21745.
2023-01-13 09:41:19 +00:00
zeertzjq
449c0762d3
test: avoid consecutive mouse input at different positions (#21781)
The seconds call's position may override the first call if the first
call isn't processed yet, defeating the purpose of the first call.
2023-01-13 12:25:19 +08:00
luukvbaal
1097d239c3
fix(ui): command line issues with external messages (#21709)
* fix: don't truncate external messages
* fix: avoid resizing command line with external messages
2023-01-13 11:47:55 +08:00
luukvbaal
4876654d4c
fix(mouse): statusline click registered as statuscolumn (#21748)
fix(statuscolumn): statusline click registered as statuscolumn

Problem:  Status line click is registered as status status column click.
Solution: Check that mouse is not on the status line.

Resolve https://github.com/luukvbaal/statuscol.nvim/issues/4.
2023-01-13 07:36:59 +08:00
dundargoc
f2141de9e4
refactor: replace char_u with char 20 (#21714)
refactor: replace char_u with char

Work on https://github.com/neovim/neovim/issues/459
2023-01-13 07:35:39 +08:00
Enan Ajmain
2f1fd15554
fix(powershell): wrong length allocation for ":%w !" #20530
Problem:
The calculation of `len` in `make_filter_cmd` for powershell falls short
by one character for the following ex command:
  :%w !sort
This command satisfies these conditions:
  - `itmp` is not null
  - `otmp` is null
__NOTE__ that other shells circumvent this bug only because of `len`
allocation for six extra characters: a pair of curly braces and four
spaces:
  cfdb4cbada/src/nvim/ex_cmds.c (L1551-L1554)
If allocation for these six characters are removed, then bash also faces
the same bug.

Solution:
Add allocation for 6 extra bytes. 1 would do, but let's keep powershell
in sync with other shells as much as possible.
2023-01-12 09:25:29 -08:00
Raphael
572cd8031d
feat(diagnostic): vim.diagnostic.is_disabled() #21527 2023-01-12 08:57:39 -08:00
dundargoc
a0b2c124a3
build: include our libraries before system libraries (#21746)
Including our libraries as system libraries is helpful to suppress any
warnings, but the default behavior is to include it after existing
libraries. This can become a problem with some package managers such as
macports, as CMake automatically adds /opt/local to the include path,
which is where they store all includes. This means that the wrong header
might be chosen if it has the same name as the one from our
dependencies.

Adding the BEFORE keyword when including will ensure that our
dependency headers are chosen first.

Also remove old Darwin workarounds that shouldn't be necessary anymore.

Closes: https://github.com/neovim/neovim/issues/21742
2023-01-12 16:49:17 +01:00
ii14
921e634119
fix(api): nvim_create_autocmd crash on invalid types inside pattern array
Co-authored-by: ii14 <ii14@users.noreply.github.com>
2023-01-12 15:25:44 +00:00
luukvbaal
0fd59f0121
fix(statuscolumn): foldcolumn buffer is too small (#21761)
Resolve https://github.com/neovim/neovim/issues/21759.
2023-01-12 23:04:43 +08:00
Chris Kipp
443bbfd59e
docs(lsp): fix type annotation on convert_input_to_markdown_lines (#21772)
This small changes just ensures that if you're using `convert_input_to_markdown_lines`
without `contents` you don't get a warning (when using something like neodev) that
there is an expected second param, since it can be nil.
2023-01-12 15:51:19 +01:00
zeertzjq
a5f4ba7447
vim-patch:9.0.1183: code is indented more than necessary (#21773)
Problem:    Code is indented more than necessary.
Solution:   Use an early return where it makes sense. (Yegappan Lakshmanan,
            closes vim/vim#11805)

0233bdfa2b

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-01-12 21:33:38 +08:00
Christian Clason
2aabe9b858
vim-patch:9.0.1182: go checksum files are not recognized (#21758)
Problem:    go checksum files are not recognized.
Solution:   Add the name of go checksum files. (Amaan Qureshi, closes vim/vim#11803)

043d7b2c84

Co-authored-by: Amaan Q <amaanq12@gmail.com>
2023-01-12 09:21:58 +01:00
jdrouhard
143d3f1f32
fix(lsp): revert semantic token gravity change from #21574 (#21763) 2023-01-12 07:13:52 +01:00
Chris Kipp
a37c686d21
docs(lsp): update buf_notify and rpc.notify params types (#21753)
Small, but I was getting warnings about my usage of
`vim.lsp.buf_notify(bufnr, method, {example = example})` since the docs
say that `params` must be a string, however this can really be anything
when it's passed to `rpc.notify` since we just end up calling
`vim.json.encode(payload)` on it. This fixes the docs in those two
places and regenerates them.
2023-01-11 20:17:10 +01:00
Christian Clason
8c5c2136fe
vim-patch:9.0.1176: smithy files are not recognized (#21751)
Problem:    smithy files are not recognized.
Solution:   Add a pattern for Smithy files. (Chris Kipp, closes vim/vim#11804)

f68cddabff

Co-authored-by: Chris Kipp <ckipp@pm.me>
2023-01-11 17:15:54 +01:00
zeertzjq
3d49d39cd8
ci(tsan): run functionaltests instead of oldtests (#21744)
With TUI as an external process oldtests no longer involve threads, so
TSAN isn't useful. Meanwhile functionaltests may involve threads.
2023-01-11 14:36:26 +01:00
bfredl
80a02d1cef
Merge pull request #21706 from bfredl/notermios
refactor(pty): remove old logic for inheriting termios from host terminal
2023-01-11 13:19:01 +01:00
dundargoc
ddecf5e27f
ci: remove ci/snap (#21743)
Context: https://github.com/neovim/neovim/pull/21166#issuecomment-1377623160
2023-01-11 10:31:03 +01:00
luukvbaal
93d99aefd3
fix(statuscolumn): fix sign column highlights (#21727)
Resolve #21726.
2023-01-11 09:52:11 +08:00
zeertzjq
08d5b4275e
vim-patch:9.0.1172: when 'selection' is "exclusive" then "1v" is one char short (#21735)
Problem:    When 'selection' is "exclusive" then "1v" is one char short.
Solution:   Add one character when 'selection' is "exclusive. (closes vim/vim#11791)

79c11e399b

Cherry-pick update_curswant_force() refactor from patch 9.0.0482.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-01-11 06:39:20 +08:00
zeertzjq
15ee93c0b4
vim-patch:9.0.1171: screen is not redrawn after using setcellwidths() (#21730)
Problem:    Screen is not redrawn after using setcellwidths().
Solution:   Redraw the screen when the cell widths have changed. (Yasuhiro
            Matsumoto, closes vim/vim#11800)

2bc849ff81
2023-01-11 05:42:33 +08:00
Amaan Qureshi
ea2658e1f7
vim-patch:9.0.1174: smali files are not recognized (#21734)
Problem: Smali files are not recognized.
Solution: Add a pattern for Smali files. (Amaan Qureshi, closes vim/vim#11801)
2023-01-10 22:29:25 +01:00
dundargoc
438b4361cc
build: use modern cmake (#21589)
Replace old-school cmake with the so-called "Modern CMake", meaning
preferring using targets and properties over directory settings and
variables. This allows greater flexibility, robustness and clarity over
how the code works.

The following deprecated commands will be replaced with their modern
alternatives that operates on a specific target, rather than all targets
in the current directory:

- add_compile_options -> target_compile_options
- include_directories -> target_include_directories
- link_libraries -> target_link_libraries
- add_definitions -> target_compile_definitions

There are mainly four main targets that we currently use: nvim, libnvim,
nvim-test (used by unittests) and ${texe} (used by
check-single-includes). The goal is to explicitly define the
dependencies of each target fully, rather than having everything be
dependent on everything else.
2023-01-10 18:49:57 +01:00
zeertzjq
9b1112cf48
fix(statuscolumn): fix crashes and clang/PVS warnings (#21725) 2023-01-10 21:18:12 +08:00
bfredl
38140a63fb refactor(pty): remove old logic for inheriting termios from host terminal 2023-01-10 14:04:58 +01:00
Sebastian Lyng Johansen
870ca1de52
feat(float): open float relative to mouse #21531
Problem:
No easy way to position a LSP hover window relative to mouse.

Solution:
Introduce another option to the `relative` key in `nvim_open_win()`.

With this PR it should be possible to override the handler and do something
similar to this https://github.com/neovim/neovim/pull/19481#issuecomment-1193248674
to have hover information displayed from the mouse.

Test case:

    ```lua
    local util = require('vim.lsp.util')

    local function make_position_param(window, offset_encoding)
        window = window or 0
        local buf = vim.api.nvim_win_get_buf(window)
        local row, col

        local mouse = vim.fn.getmousepos()
        row = mouse.line
        col = mouse.column

        offset_encoding = offset_encoding or util._get_offset_encoding(buf)
        row = row - 1
        local line = vim.api.nvim_buf_get_lines(buf, row, row + 1, true)[1]
        if not line then
            return { line = 0, character = 0 }
        end
        if #line < col then
            return { line = 0, character = 0 }
        end

        col = util._str_utfindex_enc(line, col, offset_encoding)

        return { line = row, character = col }
    end

    local make_params = function(window, offset_encoding)
        window = window or 0
        local buf = vim.api.nvim_win_get_buf(window)
        offset_encoding = offset_encoding or util._get_offset_encoding(buf)
        return {
            textDocument = util.make_text_document_params(buf),
            position = make_position_param(window, offset_encoding),
        }
    end

    local hover_timer = nil
    vim.o.mousemoveevent = true

    vim.keymap.set({ '', 'i' }, '<MouseMove>', function()
        if hover_timer then
            hover_timer:close()
        end
        hover_timer = vim.defer_fn(function()
            hover_timer = nil
            local params = make_params()
            vim.lsp.buf_request(
                0,
                'textDocument/hover',
                params,
                vim.lsp.with(vim.lsp.handlers.hover, {
                    silent = true,
                    focusable = false,
                    relative = 'mouse',
                })
            )
        end, 500)
        return '<MouseMove>'
    end, { expr = true })
    ```
2023-01-10 02:22:41 -08:00
Christian Clason
d6cb3328f7
vim-patch:1b5f03ec9c55 (#21715)
Update runtime files

1b5f03ec9c

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-01-10 11:02:00 +01:00
Raphael
87cfe50944
fix(ui): set stc to empty in floatwin with minimal style (#21720)
fix(ui): set stc to emtpy in floatwin with minimal style
2023-01-10 10:36:48 +01:00
zeertzjq
1df2db0bc4
test(statuscolumn): add more tests for wrapped lines (#21718)
test(statuscolumn): add more tests more wrapped lines

Also initialize a "relnum" variable to suppress a Coverity warning.
The uninitialized value wasn't actually used by build_statuscol_str().
2023-01-10 11:30:45 +08:00
dundargoc
ef67503320
refactor: replace char_u with char 19 (#21241)
* refactor: replace char_u with char

Work on https://github.com/neovim/neovim/issues/459
2023-01-10 10:28:01 +08:00