Commit Graph

61 Commits

Author SHA1 Message Date
bfredl
2de5cddeb1
Merge pull request #25148 from glepnir/fixed_opt
fix(float): add fixed option
2023-09-19 11:49:59 +02:00
glepnir
fd08fd3de3 fix(float): add fixd option 2023-09-18 18:21:14 +08:00
Lewis Russell
b3342171d5 fix(typing): vim.fn.execute 2023-09-16 14:24:24 +01:00
Gregory Anders
2e92065686
docs: replace <pre> with ``` (#25136) 2023-09-14 08:23:01 -05:00
dundargoc
a6e74c1f0a
docs: fix typos and other small fixes (#25005)
Co-authored-by: nuid64 <lvkuzvesov@proton.me>
Co-authored-by: Mike Smith <10135646+mikesmithgh@users.noreply.github.com>
Co-authored-by: XTY <xty@xty.io>
Co-authored-by: Empa <emanuel@empa.xyz>
Co-authored-by: kyu08 <49891479+kyu08@users.noreply.github.com>
2023-09-14 12:05:27 +08:00
bfredl
b04286a187 feat(extmark): support proper multiline ranges
The removes the previous restriction that nvim_buf_set_extmark()
could not be used to highlight arbitrary multi-line regions

The problem can be summarized as follows: let's assume an extmark with a
hl_group is placed covering the region (5,0) to (50,0) Now, consider
what happens if nvim needs to redraw a window covering the lines 20-30.
It needs to be able to ask the marktree what extmarks cover this region,
even if they don't begin or end here.

Therefore the marktree needs to be augmented with the information covers
a point, not just what marks begin or end there. To do this, we augment
each node with a field "intersect" which is a set the ids of the
marks which overlap this node, but only if it is not part of the set of
any parent. This ensures the number of nodes that need to be explicitly
marked grows only logarithmically with the total number of explicitly
nodes (and thus the number of of overlapping marks).

Thus we can quickly iterate all marks which overlaps any query position
by looking up what leaf node contains that position. Then we only need
to consider all "start" marks within that leaf node, and the "intersect"
set of that node and all its parents.

Now, and the major source of complexity is that the tree restructuring
operations (to ensure that each node has T-1 <= size <= 2*T-1) also need
to update these sets. If a full inner node is split in two, one of the
new parents might start to completely overlap some ranges and its ids
will need to be moved from its children's sets to its own set.
Similarly, if two undersized nodes gets joined into one, it might no
longer completely overlap some ranges, and now the children which do
needs to have the have the ids in its set instead. And then there are
the pivots! Yes the pivot operations when a child gets moved from one
parent to another.
2023-09-12 10:38:23 +02:00
Jaehwang Jung
65738202f8
fix(decorations): better approximation of botline #24794
Problem:
* The guessed botline might be smaller than the actual botline e.g. when
  there are folds and the user is typing in insert mode. This may result
  in incorrect treesitter highlights for injections.
* botline can be larger than the last line number of the buffer, which
  results in errors when placing extmarks.

Solution:
* Take a more conservative approximation. I am not sure if it is
  sufficient to guarantee correctness, but it seems to be good enough
  for the case mentioned above.
* Clamp it to the last line number.

Co-authored-by: Lewis Russell <me@lewisr.dev>
2023-09-11 12:29:39 -07:00
Sergey Slipchenko
d22172f36b
fix(api): more intuitive cursor updates in nvim_buf_set_text
Fixes #22526
2023-09-11 08:16:03 +04:00
glepnir
8afb3a49c0 fix(highlight): add create param in nvim_get_hl 2023-09-09 17:15:58 +08:00
zeertzjq
c431d820e7
vim-patch:9.0.1856: issues with formatting positional arguments (#25013)
Problem:  issues with formatting positional arguments
Solution: fix them, add tests and documentation

closes: vim/vim#12140
closes: vim/vim#12985

Tentatively fix message_test. Check NULL ptr.

aa90d4f031

Co-authored-by: Christ van Willegen <cvwillegen@gmail.com>
2023-09-04 08:49:50 +08:00
Jongwook Choi
da7178cbbf fix(builtin): fix incorrect optional fields for fn.sign_define
The field `icon` is not a mandatory field.
2023-08-30 07:51:26 +01:00
Lewis Russell
d3d7d763f3 feat(builtin): improve types 2023-08-27 13:07:04 +01:00
Maria José Solano
b7d5b55f74
fix(types): add some return/parameter type annotations (#24867)
* fix(types): add some return/parameter type annotations

* fix(types): narrow stdpath parameter further
2023-08-27 09:41:32 +01:00
Evgeni Chasnovski
986bf7e78d
feat(highlight): add FloatFooter highlight group
Problem: No clear separation of floating title and footer highlighting.

Solution: Add new `FloatFooter` highlight group.
2023-08-26 19:37:43 +03:00
Evgeni Chasnovski
35570e4a11
feat(float): implement footer
Problem: Now way to show text at the bottom part of floating window
  border (a.k.a. "footer").

Solution: Allows `footer` and `footer_pos` config fields similar to
  `title` and `title_pos`.
2023-08-26 19:37:43 +03:00
Alisue
b46e93c5fd
docs(msgpack_rpc): add "msgpack-rpc" client type 2023-08-26 19:14:07 +09:00
zeertzjq
b1cfb299df
docs: various clarifications (#24876) 2023-08-26 08:35:05 +08:00
Sean Dewar
daf7abbc42
docs(builtin): small fixes (#24861)
Also make gen_eval_files.lua render vimdoc helpExamples properly if the line
begins with the `>` marker.
2023-08-24 13:29:40 +01:00
Lewis Russell
21152f7905 fix(types): add more annotations to eval.lua 2023-08-23 12:16:04 +01:00
zeertzjq
09910d5b35 vim-patch:9.0.0837: append() reports failure when not appending anything
Problem:    append() reports failure when not appending anything.
Solution:   Only report failure when appending something. (closes vim/vim#11498)

cd9c8d400c

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-22 18:56:43 +08:00
zeertzjq
6bdfb890fd vim-patch:e46a44050562
Runtime file updates

e46a440505

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-21 17:24:54 +08:00
zeertzjq
0f48173ab5 vim-patch:589edb340454
Updte runtime files

589edb3404

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-21 17:16:10 +08:00
zeertzjq
7ce2acd59b vim-patch:8.1.2053: SafeStateAgain not triggered if callback uses feedkeys()
Problem:    SafeStateAgain not triggered if callback uses feedkeys().
Solution:   Check for safe state in the input loop.  Make log messages easier
            to find. Add 'S' flag to state().

d103ee7843

Include misc1.c change from patch 8.1.2062.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-21 14:16:16 +08:00
zeertzjq
64ccfdaafe vim-patch:8.1.2047: cannot check the current state
Problem:    Cannot check the current state.
Solution:   Add the state() function.

0e57dd859e

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-21 14:16:16 +08:00
zeertzjq
694814cdd5
vim-patch:9.0.1774: no support for custom cmdline completion (#24808)
Problem:  no support for custom cmdline completion
Solution: Add new vimscript functions

Add the following two functions:
- getcmdcompltype() returns custom and customlist functions

- getcompletion() supports both custom and customlist

closes: vim/vim#12228

92997dda78

Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
2023-08-21 07:29:49 +08:00
zeertzjq
4c7df98e4e vim-patch:9.0.1515: reverse() does not work for a String
Problem:    reverse() does not work for a String.
Solution:   Implement reverse() for a String. (Yegappan Lakshmanan,
            closes vim/vim#12179)

03ff1c2dde

vim-patch:9.0.1738: Duplicate code to reverse a string

Problem:  Duplicate code to reverse a string
Solution: Move reverse_text() to strings.c and remove string_reverse().

closes: vim/vim#12847

4dd266cb66

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-08-19 18:05:46 +08:00
zeertzjq
f8afa8023e
vim-patch:9.0.1728: missing winid argument for virtcol() (#24770)
Problem: missing winid argument for virtcol()
Solution: Add a {winid} argument to virtcol()

Other functions col(), charcol() and virtcol2col() support a {winid}
argument, so it makes sense for virtcol() to also support than.

Also add test for virtcol2col() with 'showbreak' and {winid}.

closes: vim/vim#12633

825cf813fa
2023-08-18 08:42:45 +08:00
Sean Dewar
88887a7be7
docs(builtin): fix some missing lines (#24759)
Some things got chopped off in the PR that removed method syntax examples.
These were all that I found.
2023-08-17 16:38:56 +01:00
zeertzjq
6267996f13 vim-patch:8.2.4455: accepting one and zero for second sort() argument is strange
Problem:    Accepting one and zero for the second sort() argument is strange.
Solution:   Disallow using one and zero in Vim9 script.

2007dd49f5

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-17 16:11:17 +08:00
zeertzjq
b193674b4a vim-patch:partial:8.2.3849: functions implementing reduce and map are too long
Problem:    Functions implementing reduce and map are too long.
Solution:   Use a function for each type of value.  Add a few more test cases
            and add to the help. (Yegappan Lakshmanan, closes vim/vim#9370)

389b72196e

Partial port as this doesn't include handling for non-materialized List.

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-08-17 15:37:32 +08:00
zeertzjq
c5576fcc80 vim-patch:8.2.3848: cannot use reduce() for a string
Problem:    Cannot use reduce() for a string.
Solution:   Make reduce() work with a string. (Naruhiko Nishino, closes vim/vim#9366)

0ccb5842f5

Omit tv_get_first_char() as it doesn't really save much code.

Co-authored-by: rbtnn <naru123456789@gmail.com>
2023-08-17 15:20:47 +08:00
zeertzjq
d9e7dad139 vim-patch:8.2.3818: cannot filter or map characters in a string
Problem:    Cannot filter or map characters in a string.
Solution:   Make filter() and map() work on a string. (Naruhiko Nishino,
            closes vim/vim#9327)

c479ce032f

Co-authored-by: rbtnn <naru123456789@gmail.com>
2023-08-17 13:14:32 +08:00
zeertzjq
3117dc70f1 vim-patch:1b884a005398
Update runtime files.

1b884a0053

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-17 11:21:10 +08:00
zeertzjq
8cbb2477cf vim-patch:8.2.1969: Vim9: map() may change the list or dict item type
Problem:    Vim9: map() may change the list or dict item type.
Solution:   Add mapnew().

ea696852e7

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-17 11:21:10 +08:00
zeertzjq
a245dd79a2
vim-patch:9.0.1717: virtcol2col returns last byte of a multi-byte char (#24729)
Problem: virtcol2col returns last byte of a multi-byte char
Solution: Make it return the first byte for a multi-byte char

closes: vim/vim#12786
closes: vim/vim#12799

b209b86e66

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-08-16 06:28:52 +08:00
zeertzjq
842a47d6a4
vim-patch:9.0.1704: Cannot use positional arguments for printf() (#24719)
Problem: Cannot use positional arguments for printf()
Solution: Support positional arguments in string formatting

closes: vim/vim#12140

0c6181fec4

Co-authored-by: Christ van Willegen <cvwillegen@gmail.com>
2023-08-15 19:16:19 +08:00
zeertzjq
6c07a189f2
vim-patch:9.0.1688: cannot store custom data in quickfix list (#24673)
Problem: cannot store custom data in quickfix list
Solution: add `user_data` field for the quickfix list

closes: vim/vim#11818

ca6ac99077

Co-authored-by: Tom Praschan <13141438+tom-anders@users.noreply.github.com>
2023-08-12 08:19:06 +08:00
zeertzjq
6e0c36ba0e
vim-patch:9.0.1686: undotree() only works for the current buffer (#24665)
Problem:    undotree() only works for the current buffer
Solution:   Add an optional "buffer number" parameter to undotree().  If
            omitted, use the current buffer for backwards compatibility.

closes: vim/vim#4001
closes: vim/vim#12292

5fee111149

Co-authored-by: Devin J. Pohly <djpohly@gmail.com>
2023-08-12 05:51:49 +08:00
Justin M. Keyes
1d81d7a268
feat(defaults): treat "•" as a list item prefix #24623
Problem:
Nvim docs use "•" as a list item prefix but `gw{motion}` doesn't format
such lists by default.

Solution:
Change the 'comments' option to include "fb:•" by default.
2023-08-09 15:33:53 -07:00
Christian Clason
164370a4cb vim-patch:c2bd205254c8
Change "the" to "then" under ':help bufload()' (vim/vim#12662)

c2bd205254

N/A commits:
vim-patch:64dea84bb05a (we have our own manpager at home)
vim-patch:958e15bb1c7d (we have our own editorconfig syntax file)
vim-patch:c41b3c9f95ac (we don't have defaults.vim)

Co-authored-by: Daniel Steinberg <dstein64@users.noreply.github.com>
2023-08-09 20:43:45 +02:00
Sean Dewar
4134cebb17
docs(builtin): fix some missing lines (#24615)
These two functions seem to have previously had their docs start on the same
line as the signature, which I guess contributed to the lines being lost (though
I checked all other such functions from before again and these were the only
two).
2023-08-08 21:25:22 +01:00
bfredl
628763fbd8 docs(lua): the keyset nilocalypse
This is needed to give recent LuaLS the right idea about optional fields.
2023-08-08 10:42:59 +02:00
bfredl
3a21c3afe6
Merge pull request #24524 from bfredl/typed_keys
refactor(api): use typed keysets
2023-08-07 14:42:25 +02:00
bfredl
51c754b62e feat(lua): use keyset type information 2023-08-07 13:18:12 +02:00
Lewis Russell
6fa17da39b
docs(options): take ownership of options.txt (#24528)
* docs(options): take ownership of options.txt

- `src/nvim/options.lua` is now the source of truth
- generate runtime/lua/vim/_meta/options.lua

* fixup! zeer comments

* fixup! zeer comments (2)

* fixup! re-enable luacheck

* fixup! regen
2023-08-04 21:26:53 +01:00
Justin M. Keyes
b034378cf5
docs: luaref cleanup #24541
- drop "luaref-" prefix in favor of "lua-" or nothing, where possible.
- remove redundant "luaref--lang…" and "luaref-api…" tags.
2023-08-03 08:35:10 -07:00
Justin M. Keyes
d2f8133024 docs: misc
Co-authored-by: Kevin Pham <keevan.pham@gmail.com>
2023-08-03 14:01:53 +02:00
Marc Jakobi
4a06de40e7
docs(lua): fix generated fname param annotations #24533 2023-08-02 11:22:44 -07:00
zeertzjq
1ee905a63a
docs(builtin): fix alignment of comments in code blocks (#24529) 2023-08-02 22:14:32 +08:00
Justin M. Keyes
d086bc1e85
docs: drop "Can also be used as a method" #24508
Now that we "own" builtin.txt, we cant remove the repetitive mention of
Vimscript's UFCS syntax. It's noisy to mention this for each function,
and it's also not a Vimscript feature that should be encouraged.

Also change the builtin.txt heading to "NVIM REFERENCE MANUAL", which
indicates when a help file is Nvim-owned.
2023-08-01 16:17:26 -07:00