Commit Graph

18860 Commits

Author SHA1 Message Date
Björn Linse
7a0468e7ad
Merge pull request #15569 from bfredl/end_fill
refactor(screen): let win_line() always handle fillers after last line
2021-09-05 17:45:46 +02:00
Ben Noordhuis
c9c9422af0
build: fix fpclassify -Wfloat-conversion warning #15570
Work around a glibc bug where it truncates the argument to fpclassify()
from double to float by implementing fpclassify() ourselves.

Correctness test (Note that the FP_SUBNORMAL test depends on an atof() that
knows how to parse subnormals. Glibc does, not sure about other libcs.):

    #include <math.h>
    #include <stdint.h>
    #include <string.h>

    int xfpclassify(double d)
    {
      uint64_t m;
      int e;

      memcpy(&m, &d, sizeof(m));
      e = 0x7ff & (m >> 52);
      m = 0xfffffffffffffULL & m;

      switch (e) {
        default: return FP_NORMAL;
        case 0x000: return m ? FP_SUBNORMAL : FP_ZERO;
        case 0x7ff: return m ? FP_NAN : FP_INFINITE;
      }
    }

    #include <assert.h>
    #include <stdlib.h>

    int main(void)
    {
      assert(FP_ZERO == xfpclassify(atof("0.0")));
      assert(FP_ZERO == xfpclassify(atof("-0.0")));
      assert(FP_NORMAL == xfpclassify(atof("1.0")));
      assert(FP_NORMAL == xfpclassify(atof("-1.0")));
      assert(FP_INFINITE == xfpclassify(atof("inf")));
      assert(FP_INFINITE == xfpclassify(atof("-inf")));
      assert(FP_NAN == xfpclassify(atof("nan")));
      assert(FP_NAN == xfpclassify(atof("-nan")));
      assert(FP_SUBNORMAL == xfpclassify(atof("1.8011670033376514e-308")));
      return 0;
    }
2021-09-05 07:37:25 -07:00
Björn Linse
274248c354 refactor(screen): let win_line() always handle fillers after last line 2021-09-05 11:22:45 +02:00
Izhak Jakov
dce50312e1
vim-patch:90df4b9 (#15494)
Add JSONC runtime files

Co-authored-by: Izhak Jakov <izhakjakov>
2021-09-04 19:49:17 +02:00
Björn Linse
6117877823
Merge pull request #15563 from dundargoc/refactor/uncrustify
refactor: update uncrustify config and format screen.c
2021-09-04 09:39:30 +02:00
Dundar Göc
15af08ad17 refactor: update uncrustify config and format screen.c
Also set new option cmt_trailing_single_line_c_to_cpp to true. It
converts trailing, single-line c-comments (/**/) into cpp-comments (//).
2021-09-03 21:23:23 +02:00
Jason Cox
d3c6f1ebbb vim-patch:8.2.3393: escaping for fish shell is skipping some characters
Problem:    Escaping for fish shell is skipping some characters.
Solution:   Escape character after backslash if needed. (Jason Cox,
            closes vim/vim#8827)
6631597452
2021-09-02 13:07:29 -06:00
Jason Cox
85ba41a4b3 vim-patch:8.2.3385: escaping for fish shell does not work properly
Problem:    Escaping for fish shell does not work properly.
Solution:   Insert a backslash before a backslash. (Jason Cox, closes vim/vim#8810)
6e82351130
2021-09-02 13:07:29 -06:00
Justin M. Keyes
5f8518b3f0
fix(defaults): "syntax sync maxlines=1" on CmdwinEnter #15552
I mistakenly suggested maxlines=&cmdwinheight, forgetting that it is
calculated from topline, not cursor. maxlines=1 makes the most sense in
cmdwin.

ref #15401 622a36b1f1
2021-09-02 10:29:59 -07:00
Gregory Anders
622a36b1f1
feat(defaults): limit syntax cost on CmdwinEnter #15401
Add a new default autocommand to limit syntax highlighting
synchronization in the command window. This refactors the nvim_terminal
autocommand out of main() and into a new init_default_autocmds()
function, which is now part of the startup process and can be further
extended with more default autocommands down the road.

ref #6289 #6399
2021-09-02 04:17:04 -07:00
Justin M. Keyes
6751d6254b
refactor(tests): use assert_alive() #15546 2021-09-01 09:42:53 -07:00
Justin M. Keyes
0603eba6e7
feat(api): nvim_get_chan_info: include "argv" for jobs #15537
ref #15440
2021-09-01 07:29:38 -07:00
Mathias Fußenegger
5c643dee7b
docs(lsp): remove private lsp.diagnostic functions from docs (#15541)
Both `apply_to_diagnostic_items` and `show_diagnostics` are local
functions and cannot be called by users.
2021-09-01 14:28:15 +02:00
Mathias Fußenegger
684550ff38
docs(lsp): document codelens.get bufnr parameter (#15540)
Alternative to https://github.com/neovim/neovim/pull/15224
2021-09-01 13:29:11 +02:00
Justin M. Keyes
284199bc4b
Merge #15402 fix(terminal): close without ! if the job is stopped 2021-08-31 07:24:25 -07:00
Gregory Anders
3c081d0280 fix(jobwait): always drain process event queues #15402
Problem:
jobwait() returns early if the job was stopped, but the job might have
pending callbacks on its event queue which are required to complete its
teardown. State such as term->closed might not be updated yet (by the
pending callbacks), so codepaths such as :bdelete think the job is still
running.

Solution:
Always flush the job's event queue before returning from jobwait().

ref #15349
2021-08-31 06:53:06 -07:00
Gregory Anders
55defa1a41 fix(terminal): close without ! if the job is stopped
- If the terminal job is still running then ! is still required.

Closes #4683
2021-08-31 06:46:56 -07:00
Björn Linse
9695691ee4
Merge pull request #15526 from bfredl/f_meta
fix(lua): make core vim module not dependent on $VIMRUNTIME modules
2021-08-30 18:09:53 +02:00
Björn Linse
6f2d0ea311 fix(lua): make core vim module not dependent on $VIMRUNTIME functions
fixes #15524

Note: this is obviously a quickfix. A scalabe solution will
involve being able to specify a _list_ of modules to be
put into packages.preload, without needing to manually copypasta
a blurb of C code. Perhaps even involving bytecode for
static builds (to speedup initialization)
2021-08-30 17:31:44 +02:00
Oliver Marriott
c52ec8f9eb
fix(tutor): formatting, layout #15098
* fix(tutor): adjust over-80ch lines and corresponding expect file
* fix(tutor): standardise indentation and formatting, add nowrap modeline

- unifies the formatting/layout, which was a bit inconsistent,
- adds a nowrap modeline

Since the tutor uses a lot of conceals, which are included in the character
count when calculating line wrapping, lines were breaking at what looked like
odd spots, which gives a poor first impression and lowered readability.

I have adjusted some lines to be over 80ch in the source, but once they're
rendered out with conceals, they're actually under 80, so even with nowrap we
don't visually extend past 80.

fix #15088
2021-08-30 05:27:35 -07:00
Jose Alvarez
325fad8983
fix(lsp): resolve bufnr in buf_is_attached (#15523) 2021-08-30 07:46:00 -04:00
Matthieu Coudron
3ab73ff81f
chore(flake): fix for recent nixpkgs (#15520)
https://github.com/NixOS/nixpkgs/pull/134463 made keepDebugInfo obsolete
for generic packages.
This copies what keepDebugInfo used to do.
2021-08-30 11:55:02 +02:00
Thomas Vigouroux
215c9b5792
Merge pull request #15498 from neovim/marvim/api-doc-update/master
docs: regenerate
2021-08-30 09:47:39 +02:00
Xiao
b35de6c525
vim-patch:8.2.2938: after using motion force from feedkeys() it sticks (#15240)
Problem:    After using motion force from feedkeys() it may not be reset.
Solution:   Clear motion_force in clearop(). (closes vim/vim#8323)
21492743e8
2021-08-29 17:08:39 -04:00
marvim
119b4daced docs: regenerate 2021-08-29 15:34:51 +00:00
Björn Linse
4e66e74fd7
Merge pull request #15304 from bfredl/quantumtheory
fix(lua): preserve argument list ... which has not the same length as #{...}
2021-08-29 17:34:00 +02:00
Björn Linse
6896d22b63 fix(lua): preserve argument lists which are not lists 2021-08-29 16:04:50 +02:00
Justin M. Keyes
81f4de08bd
docs: .git-blame-ignore-revs #15510 2021-08-28 14:00:54 -07:00
Björn Linse
636ecd0c3b
Merge pull request #15509 from bfredl/miniperf
perf(api): avoid spurious allocations when converting small objects
2021-08-28 18:38:31 +02:00
Björn Linse
6fe670878b
Merge pull request #15465 from dundargoc/refactor/uncrustify
refactor(codebase): Update uncrustify config and apply it on one file screen.c

The plan is to go through the codebase in batches, and remove the most egregious "make lint"
backlog failures, by applying this config.
2021-08-28 16:59:08 +02:00
Björn Linse
705e8f10ac perf(api): avoid spurious allocations when converting small objects
Converter functions use a heap-allocated stack to handle complex
nested objects. However, these are often called with simple,
primitive values like integers or bools wrapped in an Object.
Avoid the memory allocation in this case using kvec_withinit_t
2021-08-28 16:52:01 +02:00
Björn Linse
469652d0d5 refactor(lua): rename nlua_msgpack_ => nlua_api_
These functions do not involve msgpack. Initially the nvim api was
sometimes called the "msgpack API", but entry points from vim script
and lua are equally valid (and don't need to reference "msgpack")
2021-08-28 16:50:59 +02:00
Dundar Göc
2d240024ac refactor: format screen.c with uncrustify 2021-08-28 16:18:36 +02:00
Dundar Göc
5a66205944 refactor: update uncrustify config file to better fit neovim style guide 2021-08-28 16:17:53 +02:00
Jose Alvarez
04938eed3e
fix(lsp): check if buffer is valid in changetracking (#15505) 2021-08-28 11:57:06 +02:00
Gregory Anders
8af13ed946
fix(process_wait): drain proc.events directly #15501
After a process's refcnt is decremented to zero, it enqueues a
`process_close_event` on its own event queue. In `process_wait`, this
event should be processed immediately so that any process close
callbacks are executed before `process_wait` returns.

Update `process_wait` to always process the process's event queue after
the process is freed, rather than the event queue passed in as an
argument.
2021-08-27 19:17:11 -07:00
Justin M. Keyes
ff7f7dd26b
Merge #15433 defaults: auto-create backup dir 2021-08-27 18:08:20 -07:00
Gregory Anders
e5d464d8e0 docs: update 'backupdir' and 'undodir' descriptions 2021-08-27 10:45:25 -06:00
Gregory Anders
4e516e53bf fix: remove trailing slashes before making directory
Remove the trailing slashes from 'undofile' and 'backupdir' before
creating directories. They cause problems on Windows which doesn't
recognize these slashes as proper path separators.
2021-08-27 10:45:25 -06:00
Gregory Anders
460019366e feat: defaults: auto-create backup dir
Copy the behavior of 'undodir' and create the last specified directory
in the 'backupdir' option if it doesn't exist.

Use trailing slashes for 'backupdir' as well as 'viewdir' and 'undodir'
by default. Note that 'undodir' always behaves as though it has the
trailing slashes, regardless of whether or not they are present. They
are added to the default option value to minimize surprise.

The '.' value in 'backupdir' is kept because the default behavior for
backups is solely to have a backup if the save of the main file to disk
fails. As soon as that save is completed the backup file is removed, so
generally there is no need to put them in a central location.

Co-authored by: murphy66 <murphy66@gmail.com>
2021-08-27 10:34:44 -06:00
zeertzjq
32024787b6
vim-patch:8.1.2229: color number column above/below cursor #15409
Problem:    Cannot color number column above/below cursor differently.
Solution:   Add LineNrAbove and LineNrBelow. (Shaun Brady, closes vim/vim#624)
efae76ab1a
2021-08-27 05:50:37 -07:00
notomo
08e223cebb
tests(lua/on_yank): assert conditions that fail correctly #15495
The test added in 274a3504a7
does not fail if the code changes are reverted.
2021-08-27 04:54:01 -07:00
zeertzjq
f6e662bbe9
feat(lsp): get_border_size(): support repeating border char list #15474 2021-08-27 04:19:17 -07:00
notomo
274a3504a7
fix(lua): verify buffer in highlight.on_yank (#15482)
Resolve an issue with deferred clearing of highlight failing if the 
buffer is deleted before the timeout by checking whether the
buffer is valid first.
2021-08-26 16:37:36 +02:00
zeertzjq
6ff1e3fa1f
fix(man.vim): use -addr=other instead of -range=-1 #15172
-range=-1 requires the current file to have at least <count> lines, whereas -addr=other doesn't.

-addr=other also sets <count> to -1 by default when it is not specified, though this feature seems undocumented.
2021-08-26 04:36:31 -07:00
zeertzjq
d8ddd1e425
fix(man.vim): reduce false positives for manReference #14242
Co-authored-by: Anmol Sethi <hi@nhooyr.io>
2021-08-26 04:31:37 -07:00
Justin M. Keyes
4c499899b2
Merge #15293 Vimscript "method" syntax
Port VimL's method call syntax - vim-patch:8.1.{1638,1800,1803,1807,1809,1816,1820,1821,1828,1834,1835,1861,1863,1878,1879,1888,1909,1911,1912}
2021-08-26 04:26:32 -07:00
Justin M. Keyes
2548a9e180
fix(man.vim): filetype=man is too eager #15488
Problem:
"set filetype=man" assumes the user wants :Man features, this does extra
stuff like renaming the buffer as "man://".

Solution:
- old entrypoint was ":set filetype=man", but this is too presumptuous #15487
- make the entrypoints more explicit:
  1. when the ":Man" command is run
  2. when a "man://" buffer is opened
- remove the tricky b:man_sect checks in ftplugin/man.vim and syntax/man.vim
- MANPAGER is supported via ":Man!", as documented.

fixes #15487
2021-08-26 02:19:52 -07:00
Gregory Anders
8d62f5fd58
vim-patch:8.2.3362: buffer overflow when completing long tag name (#15449)
Problem:    Buffer overflow when completing long tag name.
Solution:   Allocate the buffer dynamically. (Gregory Anders, closes vim/vim#8769)
489d60996d
2021-08-25 21:57:18 -04:00
Björn Linse
10d7d73b2d
Merge pull request #15475 from vigoux/bufupdates-paste
Send correct byte updates on visual paste
2021-08-25 20:56:15 +02:00