Commit Graph

26884 Commits

Author SHA1 Message Date
zeertzjq
3e79afec54 vim-patch:8.1.2067: no tests for SafeState and SafeStateAgain
Problem:    No tests for SafeState and SafeStateAgain.
Solution:   Add tests.

cadbe1b1fb

This test is quite useless. Don't port to Lua.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-21 14:16:16 +08:00
zeertzjq
6bf5b2428b vim-patch:8.1.2066: no tests for state()
Problem:    No tests for state().
Solution:   Add tests.  Clean up some feature checks.  Make "a" flag work.

c258549032

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-21 14:16:16 +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
a0b912c6ec vim-patch:8.1.2048: not clear why SafeState and SafeStateAgain are not triggered
Problem:    Not clear why SafeState and SafeStateAgain are not triggered.
Solution:   Add log statements.

37d1807a80

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
4956f26744 vim-patch:8.1.2046: SafeState may be triggered at the wrong moment
Problem:    SafeState may be triggered at the wrong moment.
Solution:   Move it up higher to after where messages are processed.  Add a
            SafeStateAgain event to tigger there.

69198cb8c0

SafeStateAgain is N/A.
Move SafeState functions to state.c.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-21 14:16:16 +08:00
zeertzjq
ab45d5bf6d vim-patch:8.1.2044: no easy way to process postponed work
Problem:    No easy way to process postponed work. (Paul Jolly)
Solution:   Add the SafeState autocommand event.

8aeec40207

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-21 14:16:15 +08:00
zeertzjq
91d8f2ac53
vim-patch:9.0.1767: '.-' no allowed in highlight group names (#24814)
Problem:  '.-' no allowed in highlight group names
Solution: Allow dot and hyphen characters in highlight group names

Allow dots and hyphens in group names. There does not seem
to be any reason for these to be disallowed.

closes: vim/vim#12807

d4376dc3eb

Co-authored-by: Gregory Anders <greg@gpanders.com>
Co-authored-by: Sean Dewar <seandewar@users.noreply.github.com>
2023-08-21 10:25:41 +08:00
Christian Clason
eaad2f7806 vim-patch:9.0.1768: Runtime: no support for bicep files
Problem:  Runtime: no support for bicep files
Solution: Add filetype support for bicepparam

closes: vim/vim#12784

2d0988ef93

Co-authored-by: Scott McKendry <scott.c.mckendry@gmail.com>
2023-08-21 10:13:44 +09:00
Christian Clason
a5b6468e9b vim-patch:9.0.1766: Runtime: Missing QML support
Problem:  Runtime: Missing QML support
Solution: Add QML support to Vim

closes: vim/vim#12810

bedc69f9d6

Co-authored-by: ChaseKnowlden <haroldknowlden@gmail.com>
2023-08-21 10:13:44 +09:00
zeertzjq
a2a226170d
vim-patch:9.0.1772: Cursor may be adjusted in 'splitkeep'ed windows (#24811)
Problem:    Cursor is adjusted in window that did not change in size by
            'splitkeep'.
Solution:   Only check that cursor position is valid in a window that
            has changed in size.

closes: vim/vim#12509

16af913eee

Co-authored-by: Luuk van Baal <luukvbaal@gmail.com>
2023-08-21 08:58:18 +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
ac99e63d73
vim-patch:9.0.1763: crash when passing invalid buffer to undotree() (#24807)
Problem:  crash when passing invalid buffer to undotree()
Solution: Use get_buf_arg() instead of tv_get_buf_from_arg().

closes: vim/vim#12862
closes: vim/vim#12830

ab9f2ecfd4
2023-08-21 07:20:26 +08:00
zeertzjq
d21e6285e9
vim-patch:9.0.1759: Visual highlight not working with cursor at end of screen line (#24806)
Problem:  Visual highlight not working with cursor at end of screen line
          and 'showbreak'.
Solution: Only update "vcol_prev" when drawing buffer text.

closes: vim/vim#12865

8fc6a1dae0
2023-08-21 07:18:39 +08:00
zeertzjq
10459e1ed0
Merge pull request #24805 from zeertzjq/vim-9.0.1753
vim-patch:9.0.{1753,1761}: g<End>
2023-08-21 06:41:44 +08:00
zeertzjq
0c91cb4f03 vim-patch:9.0.1761: g<kEnd> behaves different from g<end>
Problem:  g<kEnd> behaves different from g<end>
Solution: Make g<kEnd> behave like g<End>

closes: vim/vim#12861

654bdbbd32
2023-08-21 06:12:03 +08:00
zeertzjq
7485fd0518 vim-patch:9.0.1753: can't move to last non-blank char
Problem: can't move to last non-blank char
Solution: Make g<end> behave like that

Make it possible to move to last non-blank char on a line

We can distinguish between g0 and g^ to move to the very first character
and the first non-blank char.

And while we can move to the last screen char, we cannot go to the last
non-blank screen char.

Since I think g$ is the more widely used and known movement command (and
g<end> is synonymous to it) change the behaviour of g<end> to move to
last non-screen char instead and don't have this be the same command as
the g$ command anymore.

If you want to keep the old behaviour, you can use:

```
nnoremap g<end> g$
```

Add a test to verify the behaviour.

closes: vim/vim#12593

b5f6fe9ca2

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-08-21 06:11:16 +08:00
Christian Clason
18062f70d8 vim-patch:56bafd7a6a79
Runtime: add new sed ftplugin (vim/vim#12843)

56bafd7a6a

Co-authored-by: dkearns <dougkearns@gmail.com>
2023-08-20 17:31:27 +09:00
zeertzjq
b263c73b08
vim-patch:9.0.1747: screenpos() may cause unnecessary redraw (#24792)
Problem:  screenpos() may cause unnecessary redraw.
Solution: Don't unnecessarily reset VALID_WROW flag.

VALID_WROW flag is only used by two functions: validate_cursor() and
cursor_valid(), and cursor_valid() is only used once in ex_sleep().
When adjust_plines_for_skipcol() was first added in patch 9.0.0640, it
was called in two functions: comp_botline() and curs_rows().
- comp_botline() is called in two places:
  - onepage(), which resets VALID_WROW flag immediately afterwards.
  - validate_botline_win(), where resetting a VALID_ flag is strange.
- curs_rows() is called in two places:
  - curs_columns(), which sets VALID_WROW flag afterwards.
  - validate_cline_row(), which is only used by GUI mouse focus.

Therefore resetting VALID_WROW there doesn't seem to do anything useful.
Also, a w_skipcol check (which resets VALID_WROW flag) was added to
check_cursor_moved() in patch 9.0.0734, which seems to make more sense
than resetting that flag in the middle of a computation.

While at it make adjust_plines_for_skipcol() and textpos2screenpos() a
bit less confusing:
- Make adjust_plines_for_skipcol() return "off" instead of "n - off".
- Use 0-based "row" in textpos2screenpos() until W_WINROW is added.

closes: vim/vim#12832

6235a109c4
2023-08-19 20:54:55 +08:00
zeertzjq
421713523e
vim-patch:9.0.1745: Missing test coverage for blockwise Visual highlight (#24790)
Problem:  Missing test coverage for blockwise Visual highlight with
          virtual that starts with a double-width char.
Solution: Add a new virtual text to the test. Some other small fixes.

closes: vim/vim#12835

fc3058495d
2023-08-19 20:34:58 +08:00
zeertzjq
c8e58bf09c
vim-patch:9.0.1742: wrong curswant when clicking on second cell of double-width char (#24789)
Problem:  Wrong curswant when clicking and the second cell of a
          double-width char.
Solution: Don't copy virtcol of the first char to the second one.

closes: vim/vim#12842

9994160bfe
2023-08-19 19:40:26 +08:00
zeertzjq
d9b0946609
Merge pull request #24787 from zeertzjq/vim-9.0.1515
vim-patch:9.0.{1515,1540,1738}
2023-08-19 18:33:44 +08:00
zeertzjq
fcd729f22c vim-patch:9.0.1540: reverse() on string doesn't work in compiled function
Problem:    reverse() on string doesn't work in compiled function.
Solution:   Accept string in argument type check. (Yegappan Lakshmanan,
            closes vim/vim#12377)

f9dc278946

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-08-19 18:05:46 +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
Christian Clason
d7ae9ae3e5 build(deps): bump tree-sitter to HEAD - ab09ae20d 2023-08-19 03:16:14 +02:00
Thomas Vigouroux
7a3fef9e34
refactor(tui): check for out of bound access after snprintf (#24751)
Counterintuitively, snprintf returns the number of characters it _should
have written_ if it had not encoutered the length bound, thus leading to
a potential buffer overflow.

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2023-08-19 08:19:36 +08:00
zeertzjq
5a6c7c805b
fix(extmarks): make empty "conceal" respect &conceallevel = 1 (#24785)
This treats extmark conceal more like matchadd() conceal.
2023-08-19 03:55:11 +08:00
zeertzjq
f0e6e2ae46
refactor(grid.c): remove duplicate assignments
They were removed from Vim in patch 9.0.0638.
2023-08-18 21:00:58 +08:00
zeertzjq
b9e75e5751
Merge pull request #24780 from zeertzjq/vim-9.0.0048
vim-patch:9.0.{0048,0177,1705,1725}: mouse click after concealed text
2023-08-18 20:02:40 +08:00
zeertzjq
1d3d50e8f0 test(ui/mouse_spec): mouse click with matchadd() concealed text 2023-08-18 19:34:25 +08:00
zeertzjq
551998b7ee vim-patch:9.0.1725: cursor pos wrong after concealed text with 'virtualedit'
Problem:    Wrong cursor position when clicking after concealed text
            with 'virtualedit'.
Solution:   Store virtual columns in ScreenCols[] instead of text
            columns, and always use coladvance() when clicking.

This also fixes incorrect curswant when clicking on a TAB, so now
Test_normal_click_on_ctrl_char() asserts the same results as the ones
before patch 9.0.0048.

closes: vim/vim#12808

e500ae8e29

Remove the mouse_adjust_click() function.

There is a difference in behavior with the old mouse_adjust_click()
approach: when clicking on the character immediately after concealed
text that is completely hidden, cursor is put on the clicked character
rather than at the start of the concealed text. The new behavior is
better, but it causes unnecessary scrolling in a functional test (which
is an existing issue unrelated to these patches), so adjust the test.

Now fully merged:
vim-patch:9.0.0177: cursor position wrong with 'virtualedit' and mouse click
2023-08-18 19:34:16 +08:00
zeertzjq
b0dda500e9 vim-patch:9.0.1705: cursor position wrong when clicking on an unprintable char
Problem:  cursor position wrong when clicking on an unprintable char
Solution: Don't update prev_ptr when wlv.n_extra is not zero.

closes: vim/vim#12664

b25dbb3f9b

Tests only. Code superseded by patch 9.0.1725.
2023-08-18 19:34:16 +08:00
zeertzjq
5ff725fa94 vim-patch:9.0.0048: cursor in wrong column with mouse click after concealed text
Problem:    Cursor in wrong column with mouse click after concealed text.
Solution:   Store the text column when drawing text.

b90818867c

Tests only. Code changes moved to the port of patch 9.0.1725.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-18 19:34:07 +08:00
zeertzjq
81d5550d77
vim-patch:9.0.1731: blockwise Visual highlight not working with virtual text (#24779)
Problem: blockwise Visual highlight not working with virtual text
Solution: Reset the correct variable at the end of virtual selection and
          Check for double-width char inside virtual text.

closes: vim/vim#12606

6e940d9a1d

Need to remove area_active and use wlv.fromcol and wlv.tocol directly.
2023-08-18 14:00:12 +08:00
Christian Clason
8d7a2a1aea vim-patch:442d1746f4c6
bindzone runtime: add new DNS record types (vim/vim#7351)

Recognize some newer DNS record types - CAA (RFC8659, certificate authority authorization), OPENPGPKEY (RFC7929), SMIMEA (RFC8162). Sort SSHFP alphabetically while there.

442d1746f4

Co-authored-by: Stuart Henderson <sthen@users.noreply.github.com>
2023-08-18 07:48:42 +02:00
Christian Clason
f65be8c5f5 vim-patch:817db406bb12
Add TODO, FIXME to Haskell syntax file (vim/vim#8055)

Adding TODO, XXX, FIXME to Haskell syntax file vim/vim#8054

817db406bb

Co-authored-by: Bruno-366 <81762173+Bruno-366@users.noreply.github.com>
2023-08-18 07:48:42 +02:00
Christian Clason
f0b3defecb vim-patch:a5988f582e48
Keywords 'of' and 'yield' for Javascript. (vim/vim#7873)

* Keyword 'of' in for...of statement.

* Keyword 'yield' for generator function.

a5988f582e

Co-authored-by: Yuri Klimov <yuri@klimov.net>
2023-08-18 07:48:42 +02:00
zeertzjq
71ad771ea4
fix(ui_compositor): only reset skipstart at first column (#24776)
Problem:    A double-width char in a floating window causes an extra
            space to be drawn to the left of its boundary.
Solution:   Only reset skipstart at the first column.

Fix #24775
2023-08-18 12:08:18 +08:00
zeertzjq
c54682f75a
vim-patch:9.0.1729: screenpos() wrong when w_skipcol and cpoptions+=n (#24773)
Problem:    screenpos() wrong result with w_skipcol and cpoptions+=n
Solution:   Use adjust_plines_for_skipcol() instead of subtracting
            w_skipcol.

closes: vim/vim#12625

bfe377b8f2
2023-08-18 09:01:50 +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
zeertzjq
46163ddf5d
vim-patch:9.0.1730: passing multiple patterns to runtime not working (#24771)
Problem: passing multiple patterns to runtime not working
Solution: prepend prefix to each argument separately

closes: vim/vim#12617

008c91537b
2023-08-18 08:24:49 +08:00
zeertzjq
1d6c4ad073
vim-patch:9.0.1735: Rename completion specific findex var (#24769)
Problem: Rename completion specific findex var
Solution: Move "findex" static variable to xp_selected in expand_T

closes: vim/vim#12548

e9ef347c13
2023-08-18 07:23:43 +08:00
zeertzjq
19d7fb8efe
vim-patch:9.0.1734: :runtime completion fails for multiple args (#24767)
Problem: :runtime completion fails for multiple args
Solution: Make it work

closes: vim/vim#12616

be5cdd1d63
2023-08-18 06:20:06 +08:00
Sean Dewar
9f7e7455c0
vim-patch:9.0.1726: incorrect heights in win_size_restore() (#24765)
Problem: incorrect heights in win_size_restore()
Solution: avoid restoring incorrect heights in win_size_restore()

876f5fb570

I already merged this prior, so just replace the new test with the old one,
but add a test case for the global statusline.
2023-08-17 23:16:19 +01:00
zeertzjq
7dcbe74234
Merge pull request #24766 from zeertzjq/vim-9.0.1722
vim-patch:9.0.{1722,1723}
2023-08-18 06:13:37 +08:00
zeertzjq
bb29ef4008 vim-patch:9.0.1723: Fix regression in {func} argument of reduce()
Problem: Fix regression in {func} argument of reduce()
Solution: pass function name as string again

Before patch 9.0.0548, passing a string as {func} argument of reduce()
is treated as a function name, but after patch 9.0.0548 it is treated as
an expression instead, which is useless as reduce() doesn't set any v:
variables. This PR restores the behavior of {func} before that patch.

Also correct an emsg() call, as e_string_list_or_blob_required doesn't
contain format specifiers.

closes: vim/vim#12824

ad0c442f1f
2023-08-18 05:29:05 +08:00
zeertzjq
ffb87f4dd9 vim-patch:9.0.1722: wrong error messages when passing wrong types to count()
Problem: wrong error messages when passing wrong types to count()
Solution: fix it

This fixes two problems:
1. When passing wrong type to {ic} argument of count(), two error
   messages are given, the second of which is misleading.
2. When passing wrong type to {comp} argument of count(), the error
   message doesn't mention that {comp} may be a String.

closes: vim/vim#12825

4f389e7c0f
2023-08-18 05:28:42 +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
de6b58f659
vim-patch:8.2.3867: implementation of some list functions too complicated (#24757)
Problem:    Implementation of some list functions too complicated.
Solution:   Refactor do_sort_uniq(), f_count() and extend() (Yegappan
            Lakshmanan, closes vim/vim#9378)

d92813a598

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-08-17 21:56:03 +08:00
zeertzjq
5a564bf242
refactor: cast to int earlier when using 'so' and 'siso' (#24756) 2023-08-17 20:35:51 +08:00