Commit Graph

19723 Commits

Author SHA1 Message Date
glacambre
a4069a3eed feat(--headless): add on_print callback to stdioopen
This commit adds an on_print callback to stdioopen's dictionary
argument which lets the caller specify a function called each time
neovim will try to output something to stdout (e.g. on "echo" or
"echoerr" in --headless mode).
2022-01-24 13:59:16 +01:00
Michael Lingelbach
326e74571b
Merge pull request #16666 from mjlbach/fix/bad-cast 2021-12-15 13:56:41 -08:00
Hitarth Thummar
4218b7079e
docs(options): mention how to disable inccommand preview (#16534)
Co-authored-by: Hitarth Thumma
2021-12-15 22:41:24 +01:00
Michael Lingelbach
fcbffcd92a chore: improve naming consistency in str_utf_start 2021-12-15 09:07:23 -08:00
Michael Lingelbach
1a887293ef fix: do not cast offset to char_u
* str_utf_start/end both cast the offset into the utf string
to a char_u, a pointer + long is well-defined and the cast is
unnecessary. This previously resulted in issues for offsets greater than
256.
2021-12-15 09:07:23 -08:00
github-actions[bot]
4393360796
docs: regenerate (#16468)
Co-authored-by: marvim <marvim@users.noreply.github.com>
2021-12-15 08:19:54 -07:00
Sean Dewar
0a1391fdd7
fix(terminal): fix resize crash with pending scrollback (#14891)
refresh_scrollback assumes pending scrollback rows exist only if the
terminal window height decreased (or the screen was full).

However, after accumulating scrollback, it's possible in some cases for
the terminal height to increase before refresh_scrollback is called via
invalidation (especially when the terminal buffer isn't initially
displayed in a window before nvim_open_term), which may crash.

As we'll have enough room for some scrollback rows, just append them to
the top of the buffer until it fills the window, then continue with the
previous logic for any remaining scrollback rows if necessary.
2021-12-15 08:18:06 -07:00
Christian Clason
cf65071e2e
vim-patch:8.2.3814: .csx files and .sln files are not recognized (#16662)
Problem:    .csx files and .sln files are not recognized.
Solution:   Add filetype patterns. (Doug Kearns)
cfabad9bcf
2021-12-15 16:10:03 +01:00
ii14
576408ddde
fix(ui): close floating window on BufLeave event (#16557)
When buffer is visible in two splits simultaneously, BufHidden event is
not triggered, causing the floating window to remain on screen after
switching to another buffer.

Remove BufHidden event from close_events defaults, and close the window
if we changed the buffer to something other than the buffer that spawned
the floating window or the floating window buffer itself.
2021-12-15 07:53:09 -07:00
Nicolas Hillegeer
5ba45a7cd6
fix(quickfix): avoid O(N^2) when filling from string typval (#16654)
When filling a quickfix/loclist from a string-typed VimL variable, the
complexity is O(N^2) in the number of lines in the variable.

The problem is caused by using `xstrlcpy(3)` to copy the characters from
the current position up to the next newline into the quickfix/loclist
buffer in a loop.

strlcpy(3) returns the length of `src`, so by necessity it has to
compute `strlen(src)`. This means scanning the full rest of the typval
on every iteration while only copying a small fraction (up to the next
'\n').

This is not a problem whenever the srclen-to-copylen ratio is close to
1, which it usually is. But not in this case. Since we already
calculated exactly how many bytes we want to copy, we should be using
memcpy(3).

This problem is not present in Vim, as it uses `vim_strncpy`, a
`strncpy(3)`-alike, which stops at either `\0` or `n`, whichever comes
first.

The quickfix/loclist window can be filled using a:

  1. File (used by commands like :grep/:make/... to source directly
     from their errorfile)
  2. Buffer (used by :cbuffer and its variants)
  3. Typval
   a. String (used by :cexpr and its variants)
   b. List of strings (used by setqflist(), setloclist(), :cepxr and its
   variants)

This commit optimizes case (3a), especially when the typval is a long
string.

The pathological path is triggered by (e.g.) :grep enhancements as found
in https://gist.github.com/romainl/56f0c28ef953ffc157f36cc495947ab3:

    function! Grep(...)
        return system(join([&grepprg] + a:000), ' '))
    endfunction
    :cgetexpr Grep('foo')

It would've been better for Neovim to use `systemlist` here, before this
commit.
2021-12-15 07:47:11 -07:00
zeertzjq
14ffcd190d
test: expect the correct screen in TUI paste: big burst of input (#16656) 2021-12-15 07:35:22 -07:00
Thomas Vigouroux
bdfea9d9ae
Merge pull request #16606 from clason/bump-treesitter
build(deps): bump tree-sitter commit
2021-12-14 15:19:21 +01:00
Christian Clason
cc4c8e7af6
vim-patch:8.2.3805: i3config files are not recognized (#16645)
Problem:    i3config files are not recognized.
Solution:   Add patterns to match i3config files. (Quentin Hibon,
            closes vim/vim#7969)
8176be1598
2021-12-14 14:01:37 +01:00
James McCoy
f37c5f180a
Merge pull request #16602 from zeertzjq/tui-end-streamed-paste 2021-12-13 09:36:02 -05:00
Thomas Vigouroux
9a0196d245
Merge pull request #16348 from lewis6991/query
feat(treesitter): Support match queries on multiline nodes
2021-12-13 09:39:34 +01:00
Lewis Russell
6e6c36ca5b feat(treesitter): multiline match predicates 2021-12-12 12:16:42 +00:00
Mathias Fußenegger
1f3c0593eb
feat(ts): add support for multiline nodes in get_node_text (#14999)
Based on https://github.com/neovim/neovim/pull/14445

This extends `vim.treesitter.query.get_node_text` to return the text
that spans a node's range even if start_row ~= end_row.
2021-12-12 12:05:39 +01:00
Mathias Fußenegger
3aff3d6349
fix(docs): add bufnr and user_data to diagnostic-structure (#16619) 2021-12-11 16:59:16 +01:00
Björn Linse
e93b26eb0e
Merge pull request #16613 from bfredl/vim-patch-8.2.3777
vim-patch:8.2.3777: spell file write error not checked
2021-12-11 09:25:09 +01:00
Björn Linse
a415a7e672
Merge pull request #16614 from zeertzjq/test-remove-misc1
test: remove references to misc1.c
2021-12-11 09:20:50 +01:00
zeertzjq
5b153f5d3d test: remove references to misc1.c 2021-12-11 07:10:01 +08:00
Björn Linse
3f8703093d
Merge pull request #16607 from bfredl/no2misc1
refactor: get rid of misc1.c ("functions that didn't seem to fit elsewhere")
2021-12-10 23:38:00 +01:00
Björn Linse
d23a5da890 vim-patch:8.2.3777: spell file write error not checked
Problem:    Spell file write error not checked.
Solution:   Check writing the prefix conditions. (Björn Linse, closes vim/vim#9323)
2021-12-10 23:30:01 +01:00
zeertzjq
53c95ccd1b
docs(vim_diff.txt): document SearchWrapped (#16612) 2021-12-10 15:04:11 -07:00
dundargoc
2a9aadd09b
refactor: replace deprecated lua functions with their new versions (#16603)
Calling vim.lsp.buf.definition() sometimes gives a deprecation warning.
This will likely solve that.

Co-authored-by: Christian Clason <christian.clason@uni-due.de>
2021-12-10 13:20:30 -07:00
Koichi Shiraishi
63528f4686
runtime: support once on s:GetAutocmdPrefix (#16457)
Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
2021-12-10 12:28:55 -07:00
Alejandro Exojo
8ad6015409
feat: add autocommand event when search wraps around (#8487) 2021-12-10 12:28:25 -07:00
Björn Linse
df54d82b7c refactor(misc1): move out high-level input functions to a new file: input.c
Possibly dialog code is messages.c could be moved here as well.
misc1.c is now empty, so delete it.
2021-12-10 18:15:33 +01:00
Björn Linse
dc37beed75 refactor(misc1): move shell related functions to os/shell.c 2021-12-10 18:08:04 +01:00
Björn Linse
29517d95b7 refactor(misc1): move insertmode related function to edit.c 2021-12-10 17:35:06 +01:00
Björn Linse
c88555418a refactor(misc1): move way beep functions elsewhere 2021-12-10 17:11:45 +01:00
Björn Linse
6dbd4f3787 refactor(misc1): move msgmore function to messages.c 2021-12-10 17:03:22 +01:00
Björn Linse
608f74a0de refactor(misc1): move comment related functions to change.c
These are used in various places, but were grouped with open_line()
which has a lot of comment prefix logic originally.
2021-12-10 16:50:09 +01:00
Christian Clason
aad2437fc0 build(deps): bump tree-sitter commit
bump tree-sitter to 25f64e1eb6
to fix query performance regression in 0.20.1
2021-12-10 16:07:03 +01:00
Björn Linse
8b316b18d2 refactor(misc1): move user related code to os/users.c 2021-12-10 15:52:38 +01:00
Rishikesh Vaishnav
22d7dd2aec
fix(lsp): create lsp requests with position offsets considering client encoding (#16382)
Co-authored-by: black-desk <clx814727823@gmail.com>
Co-authored-by: Mathias Fußenegger <mfussenegger@users.noreply.github.com>
2021-12-10 15:17:50 +01:00
zeertzjq
40ed2b51cb fix(tui): end streamed paste correctly when key buffer is empty 2021-12-10 18:09:55 +08:00
Björn Linse
26eb605152
Merge pull request #16597 from bfredl/nomisc1
refactor: move out some long-hanging fruit from misc1.c
2021-12-10 10:56:17 +01:00
James McCoy
ac2d140a33
Merge pull request #16541 from jamessan/vim-8.2.3664
vim-patch:8.2.3664,8.2.3743,8.2.3747,8.2.3748,8.2.3757
2021-12-09 21:29:15 -05:00
James McCoy
238da85126
Merge pull request #16524 from dundargoc/ci/optimize-brew
ci: remove "brew upgrade" from macos jobs
2021-12-09 21:15:07 -05:00
James McCoy
b20871526e
Merge pull request #16414 from zeertzjq/terminal-no-invalid-rows
fix(terminal): return early if there are no invalid rows
2021-12-09 21:13:16 -05:00
James McCoy
0cf546508d
Merge pull request #16547 from pekdon/sunos
Portability improvements, first steps at getting neovim on x86_64 SunOS
2021-12-09 21:09:22 -05:00
James McCoy
27648ee218
Merge pull request #16564 from glacambre/improve_test_harness_perf
test(helpers): optimize read_file_list
2021-12-09 21:06:45 -05:00
Björn Linse
a59589ca01 refactor(misc1): move preserve_exit() to related functions in main.c 2021-12-09 23:46:37 +01:00
Björn Linse
d9c1669a54 refactor(misc1): move out misc functions which obviously belong elsewhere
Also make some function names more descriptive/regular.
2021-12-09 23:17:29 +01:00
Christian Clason
8e64b21fed
vim-patch:8.2.3769: zig files are not recognized (#16598)
Problem:    Zig files are not recognized.
Solution:   Add *.zig. (Gregory Anders, closes vim/vim#9313)
4c8c634365
2021-12-09 22:03:25 +01:00
Björn Linse
51822f0655 refactor(misc1): move out autocmd related functions 2021-12-09 21:10:58 +01:00
Björn Linse
2ec0e0a868 refactor(misc1): move line_breakcheck family of functions to os/input.c 2021-12-09 21:00:04 +01:00
James McCoy
2fe60905f6
Merge pull request #16582 from dundargoc/docs/remove-redundant-help-files
docs: remove redundant help files
2021-12-09 09:23:18 -05:00
Gregory Anders
6063e07a0f
fix(diagnostic): set effective buffer number in autocmd (again) (#16589)
Follow up to #16474.
2021-12-08 21:13:47 -07:00