Commit Graph
65 Commits
Author SHA1 Message Date
f094db0e5c vim-patch:9.0.1921: not possible to use the jumplist like a stack (#25278)
Problem:  not possible to use the jumplist like a stack
Solution: Add the 'jumpoptions' setting to make the jumplist
          a stack.

Add an option for using jumplist like tag stack

related: vim/vim#7738
closes: vim/vim#13134

ported from NeoVim:

- https://neovim.io/doc/user/motion.html#jumplist-stack
- neovim/neovim@39094b3
- https://vi.stackexchange.com/questions/18344/how-to-change-jumplist-behavior

Based on the feedback in the previous PR, it looks like many people like
this option.

https://github.com/vim/vim/commit/87018255e3ad0f4dfa03e20318836d24af721caf

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Co-authored-by: butwerenotthereyet <58348703+butwerenotthereyet@users.noreply.github.com>
2023-09-21 07:37:03 +08:00
Justin M. Keyes 1b55f51d0d docs: misc #24561
fix #24699
fix #25253
2023-09-20 04:15:23 -07:00
bfredl 1db45a9c1f Merge pull request #25214 from bfredl/glyphcache
refactor(grid): change schar_T representation to be more compact
2023-09-19 12:32:41 +02:00
bfredl 2de5cddeb1 Merge pull request #25148 from glepnir/fixed_opt
fix(float): add fixed option
2023-09-19 11:49:59 +02:00
bfredl 8da986ea87 refactor(grid): change schar_T representation to be more compact
Previously, a screen cell would occupy 28+4=32 bytes per cell
as we always made space for up to MAX_MCO+1 codepoints in a cell.

As an example, even a pretty modest 50*80 screen would consume

50*80*2*32 = 256000, i e a quarter megabyte

With the factor of two due to the TUI side buffer, and even more when
using msg_grid and/or ext_multigrid.

This instead stores a 4-byte union of either:
- a valid UTF-8 sequence up to 4 bytes
- an escape char which is invalid UTF-8 (0xFF) plus a 24-bit index to a
  glyph cache

This avoids allocating space for huge composed glyphs _upfront_, while
still keeping rendering such glyphs reasonably fast (1 hash table lookup
+ one plain index lookup). If the same large glyphs are using repeatedly
on the screen, this is still a net reduction of memory/cache
consumption. The only case which really gets worse is if you blast
the screen full with crazy emojis and zalgo text and even this case
only leads to 4 extra bytes per char.

When only <= 4-byte glyphs are used, plus the 4-byte attribute code,
i e 8 bytes in total there is a factor of four reduction of memory use.
Memory which will be quite hot in cache as the screen buffer is scanned
over in win_line() buffer text drawing

A slight complication is that the representation depends on host byte
order. I've tested this manually by compling and running this
in qemu-s390x and it works fine. We might add a qemu based solution
to CI at some point.
2023-09-19 11:25:31 +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
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 JungandLewis Russell 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
zeertzjqandChrist van Willegen 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.

https://github.com/vim/vim/commit/aa90d4f031f73a34aaef5746931ea746849a2231

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
zeertzjqandBram Moolenaar 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)

https://github.com/vim/vim/commit/cd9c8d400c1eb9cbb4ff6a33be02f91a30ab13b2

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

https://github.com/vim/vim/commit/e46a4405056276b4cbdacee76b11f85c8ea1830b

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

https://github.com/vim/vim/commit/589edb340454e7f1b19358f129287a636d53d0e1

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-21 17:16:10 +08:00
zeertzjqandBram Moolenaar 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().

https://github.com/vim/vim/commit/d103ee78432f9036d243b18dd5aac1263d3b7dc9

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
zeertzjqandBram Moolenaar 64ccfdaafe vim-patch:8.1.2047: cannot check the current state
Problem:    Cannot check the current state.
Solution:   Add the state() function.

https://github.com/vim/vim/commit/0e57dd859ecb1e8a3b91509d2f4343e839340eb8

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-21 14:16:16 +08:00
zeertzjqandShougo Matsushita 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

https://github.com/vim/vim/commit/92997dda789ad8061841128cbc99b15ec0374411

Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
2023-08-21 07:29:49 +08:00
zeertzjqandYegappan Lakshmanan 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)

https://github.com/vim/vim/commit/03ff1c2dde7f15eca5c9baa6dafbda9b49bedc3b

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

https://github.com/vim/vim/commit/4dd266cb66d901cf5324f09405cfea3f004bd29f

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

https://github.com/vim/vim/commit/825cf813fa0fddf085fcbd3194781e875320ff63
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
zeertzjqandBram Moolenaar 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.

https://github.com/vim/vim/commit/2007dd49f5cb36f944cab1cfbceb0f864e625f74

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-17 16:11:17 +08:00
zeertzjqandYegappan Lakshmanan 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)

https://github.com/vim/vim/commit/389b72196e6aaeafe3f907c73d271f2c6b931140

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
zeertzjqandrbtnn 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)

https://github.com/vim/vim/commit/0ccb5842f5fb103763d106c7aa364d758343c35a

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
zeertzjqandrbtnn 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)

https://github.com/vim/vim/commit/c479ce032f5d4d14bab9e479acbf42d758879893

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

https://github.com/vim/vim/commit/1b884a0053982335f644eec6c71027706bf3c522

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-17 11:21:10 +08:00
zeertzjqandBram Moolenaar 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().

https://github.com/vim/vim/commit/ea696852e7abcdebaf7f17a7f23dc90df1f5e2ed

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-17 11:21:10 +08:00
zeertzjqandYegappan Lakshmanan 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

https://github.com/vim/vim/commit/b209b86e6636a16088ccacdac98213416c065bf2

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-08-16 06:28:52 +08:00
zeertzjqandChrist van Willegen 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

https://github.com/vim/vim/commit/0c6181fec4c362eb9682d5af583341eb20cb1af5

Co-authored-by: Christ van Willegen <cvwillegen@gmail.com>
2023-08-15 19:16:19 +08:00
zeertzjqandTom Praschan 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

https://github.com/vim/vim/commit/ca6ac99077d2e6d020a34267aa5e0fbc4d23dc38

Co-authored-by: Tom Praschan <13141438+tom-anders@users.noreply.github.com>
2023-08-12 08:19:06 +08:00
zeertzjqandDevin J. Pohly 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

https://github.com/vim/vim/commit/5fee11114975b7405b7ccd3ee8758e54bf559760

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 ClasonandDaniel Steinberg 164370a4cb vim-patch:c2bd205254c8
Change "the" to "then" under ':help bufload()' (vim/vim#12662)

https://github.com/vim/vim/commit/c2bd205254c89ecf46e08965f53d7991315d9c98

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