Commit Graph

27126 Commits

Author SHA1 Message Date
Ibby
23c21e7630
fix(extmarks): account for rightleft when drawing virt text (#25262)
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2023-09-20 22:39:54 +08:00
zeertzjq
818d7f6daf
fix(extmarks): fix win_col virt_text drawn on wrong screen line (#25264) 2023-09-20 21:48:12 +08:00
Lewis Russell
877d04d0fb feat(lua): add vim.func._memoize
Memoizes a function, using a custom function to hash the arguments.

Private for now until:

- There are other places in the codebase that could benefit from this
  (e.g. LSP), but might require other changes to accommodate.
- Invalidation of the cache needs to be controllable. Using weak tables
  is an acceptable invalidation policy, but it shouldn't be the only
  one.
- I don't think the story around `hash_fn` is completely thought out. We
  may be able to have a good default hash_fn by hashing each argument,
  so basically a better 'concat'.
2023-09-20 13:42:41 +01:00
Lewis Russell
11865dbe39 fix(build): better deps for doc 2023-09-20 13:42:41 +01:00
Justin M. Keyes
1b55f51d0d
docs: misc #24561
fix #24699
fix #25253
2023-09-20 04:15:23 -07:00
bfredl
50d5fcc0bc
Merge pull request #25261 from bfredl/nolinewrap
refactor(grid): unused grid->line_wraps delenda est
2023-09-20 12:17:10 +02:00
bfredl
351dda5e26
Merge pull request #25244 from jedrzejboczar/fix-cursor-jump-win-separators
fix: avoid ui_grid_cursor_goto when drawing window separators
2023-09-20 11:11:52 +02:00
Eduardo Rittner Coelho
b6ef938c66
docs: document $XDG environment variables #25227 2023-09-20 02:04:30 -07:00
bfredl
ee20e9e669 refactor(grid): unused grid->line_wraps delenda est
This is not used as part of the logic to actually implement TUI line wrapping
In vim (especially gvim) it is used to emulate terminal-style text
selection. But in nvim we don't do that, and have no plans to reintroduce it.
2023-09-20 10:24:07 +02:00
bfredl
acde86d436
Merge pull request #25096 from glepnir/float_winnew
fix(float): trigger winnew event when float window create
2023-09-20 09:25:59 +02:00
bfredl
c6cc56d69c
Merge pull request #25155 from glepnir/fix_winhl
fix(highlight): winhl receive wrong argument
2023-09-20 09:18:59 +02:00
Maria José Solano
b2265bb72c test(lsp): add normalize_markdown tests 2023-09-20 07:00:52 +01:00
zeertzjq
c4f4c7a356
vim-patch:9.0.1915: r_CTRL-C works differently in visual mode (#25248)
Problem:  r_CTRL-C works differently in visual mode
Solution: Make r_CTRL-C behave consistent in visual mode
          in terminal and Windows GUI

in visual mode, r CTRL-C behaves strange in Unix like environments. It
seems to end visual mode, but still is waiting for few more chars,
however it never seems to replace it by any characters and eventually
just returns back into normal mode.

In contrast in Windows GUI mode, r_CTRL-C replaces in the selected area
all characters by a literal CTRL-C.

Not sure why it behaves like this. It seems in the Windows GUI, got_int
is not set and therefore behaves as if any other normal character has
been pressed.

So remove the special casing of what happens when got_int is set and
make it always behave like in Windows GUI mode. Add a test to verify it
always behaves like replacing in the selected area each selected
character by a literal CTRL-C.

closes: vim/vim#13091
closes: vim/vim#13112

476733f3d0

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-09-20 06:37:29 +08:00
Maria José Solano
5a363ccac8 fix(lsp)!: deprecate trim_empty_lines 2023-09-19 14:47:37 +01:00
Maria José Solano
cfd4a9dfaf feat(lsp): use treesitter for stylize markdown 2023-09-19 14:47:37 +01:00
Jędrzej Boczar
592bc831ce fix: avoid ui_grid_cursor_goto when drawing window separators 2023-09-19 14:35:03 +02:00
zeertzjq
c5abf487f1
fix(float): make "fixed" work with relative=win (#25243) 2023-09-19 18:45:11 +08:00
glepnir
437ed3cee2 fix(float): trigger winnew event when float window create 2023-09-19 18:44:48 +08: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
glepnir
ab92575753 fix(highlight): winhl receive wrong argument 2023-09-19 18:05:59 +08: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
zeertzjq
6405fa4b11
vim-patch:346ac1429c5a (#25239)
runtime(doc): add help tag describing object-selection

closes: vim/vim#13114

346ac1429c

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-09-19 07:07:24 +08:00
zeertzjq
bbde37fd64
vim-patch:9.0.1908: undefined behaviour upper/lower function ptrs (#25238)
Problem:  undefined behaviour upper/lower function ptrs
Solution: Fix UBSAN error in regexp and simplify upper/lowercase
          modifier code

The implementation of \u / \U / \l / \L modifiers in the substitute
command relies on remembering the state by setting function pointers on
func_all/func_one in the code. The code signature of `fptr_T` is
supposed to return void* (due to C function signatures not being able to
return itself due to type recursion), and the definition of the
functions (e.g. to_Upper) didn't follow this rule, and so the code tries
to cast functions of different signatures, resulting in undefined
behavior error under UBSAN in Clang 17. See vim/vim#12745.

We could just fix `do_Upper`/etc to just return void*, which would fix
the problem. However, these functions actually do not need to return
anything at all. It used to be the case that there was only one pointer
"func" to store the pointer, which is why the function needs to either
return itself or NULL to indicate whether it's a one time or ongoing
modification. However, c2c355df6f094cdb9e599fd395a78c14486ec697
(7.3.873) already made that obsolete by introducing `func_one` and
`func_all` to store one-time and ongoing operations separately, so these
functions don't actually need to return anything anymore because it's
implicit whether it's a one-time or ongoing operation. Simplify the code
to reflect that.

closes: vim/vim#13117

d25021cf03

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-09-19 06:41:59 +08:00
Sergey Slipchenko
46402c16c0
docs(test): add more info on debugging with gdb #25230 2023-09-18 05:24:18 -07:00
glepnir
fd08fd3de3 fix(float): add fixd option 2023-09-18 18:21:14 +08:00
zeertzjq
9cadbf1d36
test(tui_spec): update cursor_address test for wrap flag (#25228) 2023-09-18 12:16:32 +08:00
zeertzjq
508dda0e6c
test(ui/fold_spec): more testing for clicking on 'foldcolumn' (#25225) 2023-09-18 07:07:54 +08:00
sid-6581
57ccd82417
fix(job-control): fix use after free (#25223) 2023-09-18 07:07:08 +08:00
Christian Clason
9de5cb0b32 vim-patch:d8b86c937a41
runtime(netrw): fix filetype detection for remote editing files

closes: vim/vim#12990
closes: vim/vim#12992

this partially reverses commit 71badf9 by commenting out the line that
intentionally sets the filetype to an empty string.

d8b86c937a

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-09-17 22:52:56 +02:00
Christian Clason
1b74d2bf0a vim-patch:e30d8e4ce01d
runtime(kotlin): Add Kotlin runtime files (vim/vim#13110)

Closes udalov/kotlin-vimvim/vim#39

e30d8e4ce0

Co-authored-by: dkearns <dougkearns@gmail.com>
2023-09-17 22:52:56 +02:00
Christian Clason
ed45aa835c vim-patch:9.0.1907: No support for liquidsoap filetypes
Problem:  No support for liquidsoap filetypes
Solution: Add liquidsoap filetype detection code

closes: vim/vim#13111

6b5efcdd8e

Co-authored-by: Romain Beauxis <toots@rastageeks.org>
2023-09-17 22:26:10 +02:00
Jaehwang Jung
71d9b7d15c fix(treesitter): _trees may not be list-like
Problem:
With incremental injection parsing, injected languages' parsers parse
only the relevant regions and stores the result in _trees with the index
of the corresponding region. Therefore, there can be holes in _trees.

Solution:
* Use generic table functions where appropriate.
* Fix type annotations and docs.
2023-09-17 19:52:35 +01:00
zeertzjq
f54677132b
test(ui/fold_spec): click on multibyte "foldclosed" (#25216) 2023-09-17 21:31:51 +08:00
zeertzjq
211edceb4f
vim-patch:8.2.4173: cannot use an import in 'foldexpr' (#25215)
Problem:    Cannot use an import in 'foldexpr'.
Solution:   Set the script context to where 'foldexpr' was set. (closes vim/vim#9584)
            Fix that the script context was not set for all buffers.

e70dd11ef4

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-09-17 21:01:19 +08:00
zeertzjq
71530cc972
feat(folds): support virtual text format for 'foldtext' (#25209)
Co-authored-by: Lewis Russell <lewis6991@gmail.com>
2023-09-17 20:29:18 +08:00
dundargoc
677df72e40 docs: remove joke from pronounce
N-Jim does not sounds like "Ninja", and the joke doesn't really land.
2023-09-17 12:33:01 +02:00
Christian Clason
767b968647 build(deps): bump luajit to HEAD - e897c5743 2023-09-17 12:27:08 +02:00
bfredl
a0c99755b8
Merge pull request #25190 from glepnir/echo_hl
fix(highlight): correct hi command output
2023-09-17 12:23:22 +02:00
glepnir
5183651773 fix(highlight): correct hi command output 2023-09-17 17:47:51 +08:00
zeertzjq
d70667a1c1
Merge pull request #25208 from zeertzjq/vim-8.2.2356 2023-09-17 11:40:31 +08:00
zeertzjq
a1f0f0b2bc vim-patch:9.0.1633: duplicate code for converting float to string
Problem:    Duplicate code for converting float to string.
Solution:   Use tv_get_string(). (closes vim/vim#12521)

19dfa276c3
2023-09-17 11:07:35 +08:00
zeertzjq
ac0fda2e46 vim-patch:8.2.2356: Vim9: ":put =expr" does not handle a list properly
Problem:    Vim9: ":put =expr" does not handle a list properly.
Solution:   Use the same logic as eval_to_string_eap(). (closes vim/vim#7684)

883cf97f10

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-09-17 11:07:32 +08:00
zeertzjq
aac85b8d6b
docs(tutor): clarify the meaning of ✗ and ✓ (#25204)
Also reformat tutor.tutor.json to use 2-space indent while at it.
2023-09-17 08:48:13 +08:00
Phelipe Teles
4ab9c5fa46
fix(lua): not using global value in vim.opt_global (#25196) 2023-09-17 06:35:12 +08:00
zeertzjq
054839437e
test(plugin/man_spec): use pesc() on actual_file in pattern (#25199) 2023-09-17 06:07:53 +08:00
Maria José Solano
28f54a7878
feat(treesitter): add lang parameter to the query editor (#25181) 2023-09-16 19:05:59 +02:00
Jaehwang Jung
7e5ce42977 fix(treesitter): properly combine injection.combined regions
Problem:
It doesn't make much sense to flatten each region (= list of ranges).
This coincidentally worked for region with a single range.

Solution:
Custom function for combining regions.
2023-09-16 17:02:26 +01:00
Lewis Russell
f40a109716 fix(treesitter): fix trim predicate 2023-09-16 14:24:55 +01:00
Lewis Russell
b3342171d5 fix(typing): vim.fn.execute 2023-09-16 14:24:24 +01:00