Commit Graph

47 Commits

Author SHA1 Message Date
zeertzjq
f15947866c
vim-patch:9.0.1243: :setglobal cannot use script-local function for "expr" option (#21997)
Problem:    :setglobal cannot use script-local function for "expr" option.
Solution:   Use the pointer to the option value properly. (closes vim/vim#11883)

01d4efe2e8
2023-01-26 07:46:51 +08:00
zeertzjq
0133fbb37a
vim-patch:9.0.1213: adding a line below the last one does not expand fold (#21869)
Problem:    Adding a line below the last one does not expand fold.
Solution:   Do not skip mark_adjust() when adding lines below the last one.
            (Brandon Simmons, closes vim/vim#11832, closes vim/vim#10698)

da3dd7d857

Co-authored-by: Brandon Simmons <simmsbra@gmail.com>
2023-01-18 07:33:18 +08:00
zeertzjq
b884d0b370
vim-patch:9.0.1189: invalid memory access with folding and using "L" (#21787)
Problem:    Invalid memory access with folding and using "L".
Solution:   Prevent the cursor from moving to line zero.

232bdaaca9

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-01-14 07:02:45 +08:00
zeertzjq
b201cbfc61 vim-patch:9.0.1078: with the +vartabs feature indent folding may use wrong 'ts'
Problem:    With the +vartabs feature indent folding may use wrong 'tabstop'.
Solution:   Use the "buf" argument instead of "curbuf".

07146ad1d3
2022-12-20 05:26:49 +08:00
zeertzjq
5e97984188 vim-patch:partial:8.2.3908: cannot use a script-local function for 'foldtext'
Problem:    Cannot use a script-local function for 'foldtext'.
Solution:   Expand "s:" and "<SID>". (Yegappan Lakshmanan, closes vim/vim#9411)

27708e6c7b

Only port the changes actually related to 'foldtext'.

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2022-12-03 08:39:57 +08:00
zeertzjq
9671908c68 vim-patch:8.2.3900: it is not easy to use a script-local function for an option
Problem:    It is not easy to use a script-local function for an option.
Solution:   recognize s: and <SID> at the start of the expression. (Yegappan
            Lakshmanan, closes vim/vim#9401)

8bb65f230d

Omit duplicate docs in fold.txt: removed in a later runtime update.
Cherry-pick test_diffmode.vim changes from patch 8.2.1432.

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2022-12-03 08:35:13 +08:00
dundargoc
9dfbbde240
docs: fix typos (#21168) 2022-11-26 07:52:30 +08:00
zeertzjq
84646b80f3 vim-patch:8.2.2713: folding code not sufficiently tested
Problem:    Folding code not sufficiently tested.
Solution:   Add a few more test cases. (Yegappan Lakshmanan, closes vim/vim#8064)

68ffe8cade
2022-11-25 15:55:43 +08:00
zeertzjq
ba360a26a2 vim-patch:8.2.2684: not enough folding code is tested
Problem:    Not enough folding code is tested.
Solution:   Add more test cases. (Yegappan Lakshmanan, closes vim/vim#8046)

5c504f680e

Reorder test_fold.vim to match upstream.
Cherry-pick Test_fold_expr_error() from patch 8.2.0633.
Cherry-pick syntax feature check from patch 8.2.1432.
Cherry-pick a delete() call from patch 8.2.2112.
2022-11-25 15:50:34 +08:00
zeertzjq
eee9560516
vim-patch:9.0.0861: solution for "!!sort" in closed fold is not optimal (#21027)
Problem:    Solution for "!!sort" in closed fold is not optimal.
Solution:   Use a different range instead of the subtle difference in handling
            a range with an offset. (issue vim/vim#11487)

9954dc39ea

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2022-11-12 07:43:36 +08:00
zeertzjq
ae67706535
vim-patch:9.0.0858: "!!sort" in a closed fold sorts too many lines (#21022)
Problem:    "!!sort" in a closed fold sorts too many lines.
Solution:   Round to end of fold after adding the line count. (closes vim/vim#11487)

f00112d558

N/A patches for version.c:

vim-patch:9.0.0855: comment not located above the code it refers to

Problem:    Comment not located above the code it refers to.
Solution:   Move the comment. (closes vim/vim#11527)

09a93e3e66

vim-patch:9.0.0859: compiler warning for unused variable

Problem:    Compiler warning for unused variable.
Solution:   Add #ifdef.

fd3084b6e2

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2022-11-11 10:16:26 +08:00
zeertzjq
a6f972cb6a vim-patch:8.2.2060: check for features implemented with "if"
Problem:    Check for features implemented with "if".
Solution:   Use the Check commands. (Ken Takata, closes vim/vim#7383)

aeb313f355

Cherry-pick test_compiler.vim changes from patch 8.1.2373.
2022-11-07 19:46:44 +08:00
zeertzjq
157baef026 vim-patch:8.1.1826: tests use hand coded feature and option checks
Problem:    Tests use hand coded feature and option checks.
Solution:   Use the commands from check.vim in more tests.

8c5a278fc5

Omit Test_wincolor(): there are later patches that touch that function.
Omit test_memory_usage.vim: a Lua test is used for that file.
Cherry-pick Test_issue_3969() from patch 8.1.0969.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2022-10-26 22:16:58 +08:00
Brandon Simmons
37ee800b51
vim-patch:8.2.5009: fold may not be closeable after appending (#18722)
Problem:    Fold may not be closeable after appending.
Solution:   Set the fd_small flag to MAYBE. (Brandon Simmons, closes vim/vim#10471)
e8c4a64bff
2022-05-23 20:13:22 +01:00
zeertzjq
566ee48f05
vim-patch:8.2.4935: with 'foldmethod' "indent" some lines not included in fold (#18694)
Problem:    With 'foldmethod' "indent" some lines are not included in the
            fold. (Oleg Koshovetc)
Solution:   Fix it. (Brandon Simmons, closes vim/vim#10399, closes vim/vim#3214)
d98e75e236
2022-05-22 21:37:25 +08:00
Brandon Simmons
0c4086faa1
vim-patch:8.2.4987: after deletion a small fold may be closable (#18683)
Problem:    After deletion a small fold may be closable.
Solution:   Check for a reverse range. (Brandon Simmons, closes vim/vim#10457)
3fcccf94e8
2022-05-22 07:27:54 +08:00
zeertzjq
c3568b31f4 vim-patch:8.2.4991: no test for hwat patch 8.1.0535 fixes
Problem:    No test for hwat patch 8.1.0535 fixes.
Solution:   Add a test. (closes vim/vim#10462)
93c1573dd2
2022-05-22 06:41:31 +08:00
zeertzjq
2511f3e76d vim-patch:8.2.4813: pasting text while indent folding may mess up folds
Problem:    Pasting text while indent folding may mess up folds.
Solution:   Adjust the way folds are split. (Brandon Simmons, closes vim/vim#10254)
2c40707baa
2022-04-24 21:49:47 +08:00
Sean Dewar
6e3e8c51c0
test(oldtest): uncomment method call syntax uses
We should now be equal with Vim in regards to method call support of already ported built-ins.

Enable all relevant commented-out uses of the syntax in tests that I could grep.
2021-11-26 18:53:12 +00:00
Sean Dewar
6110480c29
feat(eval/method): partially port v8.1.1921
Adds method call support for all functions in the patch, but it cannot
be fully ported due to missing tests for:

- filereadable(): requires v8.1.1378 for Test_delete_rf(), but there
                  appears to have been some trouble porting it. (#12784)

- confirm(): requires v8.1.0832 for Test_confirm() and v8.1.0815 for
             feedkeys()'s "L" flag.

             (I did attempt to port the test using nvim_input() instead,
             but seems that input handling for confirm() doesn't work in
             --headless mode?)

             Note that confirm() was actually added as a method in
             v8.1.1915.

Uncomment use of method call syntax in Test_Executable() previously
included instead from v8.2.2259.
2021-10-03 20:06:31 +01:00
Jan Edmund Lazo
cb368e1bff
vim-patch:8.2.1702: crash when using undo after deleting folded lines
Problem:    Crash when using undo after deleting folded lines.
Solution:   Check for NULL pointer. (closes vim/vim#6968)
da697645d5
2021-06-10 19:20:33 -04:00
Jan Edmund Lazo
62a3312b88
vim-patch:8.2.2711: "gj" in a closed fold does not move out of the fold
Problem:    "gj" in a closed fold does not move out of the fold. (Marco Hinz)
Solution:   Add a check for being in a closed fold. (closes vim/vim#8062)
3c49e74e18

N/A patches for version.c:

vim-patch:8.2.2709: the GTK GUI has a gap next to the scrollbar

Problem:    The GTK GUI has a gap next to the scrollbar.
Solution:   Calculate the scrollbar padding for GTK. (closes vim/vim#8027)
26af8e54ff

vim-patch:8.2.2717: GTK menu items don't show a tooltip

Problem:    GTK menu items don't show a tooltip.
Solution:   Add a callback to show the tooltip. (Leonid V. Fedorenchik,
            closes vim/vim#8067, closes vim/vim#7810)
ce5b06a6a9
2021-04-05 11:29:35 -04:00
Jan Edmund Lazo
69d1094271
vim-patch:8.2.2399: fold test fails in wide terminal
Problem:    Fold test fails in wide terminal.
Solution:   Adjust the test. (Dominique Pelle, closes vim/vim#7731, closes vim/vim#7739)
7cf0c114d6
2021-01-24 14:19:54 -05:00
Jan Edmund Lazo
30ef922f39
vim-patch:8.2.2385: "gj" and "gk" do not work correctly when inside a fold
Problem:    "gj" and "gk" do not work correctly when inside a fold.
Solution:   Move check for folding. (closes vim/vim#7724, closes vim/vim#4095)
e71996bd08
2021-01-22 09:03:44 -05:00
Jan Edmund Lazo
5e80b90ef4
vim-patch:8.2.2176: crash with a sequence of fold commands
Problem:    Crash with a sequence of fold commands.
Solution:   Bail out when there are no folds at all.  Add a test (Dominique
            Pellé) (closes vim/vim#7515)
6a78f32844

N/A patches for version.c:

vim-patch:8.2.2174: Mac version doesn't specify the CPU architecture

Problem:    Mac version doesn't specify the CPU architecture.
Solution:   Add "arm64" or "x86_64". (Yee Cheng Chin, closes vim/vim#7519)
8c9d98a8af

vim-patch:8.2.2175: github actions: clang-11 handling suboptimal

Problem:    Github actions: clang-11 handling suboptimal.
Solution:   Separate step of installing clang-11. Get ubuntu release name
            dynamically. (Ozaki Kiichi, closes vim/vim#7514)
9aff970204
2020-12-21 19:10:43 -05:00
Jan Edmund Lazo
3013d0edfc
vim-patch:8.2.1972: crash when recreating nested fold
Problem:    Crash when recreating nested fold.
Solution:   Check for empty growarray. (closes vim/vim#7278)
5e1f22ff61

N/A patches for version.c:

vim-patch:8.2.1974: Vim9: test for has('gui_running') fails with VIMDLL

Problem:    Vim9: test for has('gui_running') fails with VIMDLL.
Solution:   Adjust the #ifdef. (Ken Takata, closes vim/vim#7276)
29b281ba8d
2020-11-11 14:17:03 -05:00
Sean Dewar
aaaad0f593
vim-patch:8.2.1947: crash when using "zj" without folds (#13222)
Problem:    Crash when using "zj" without folds. (Sean Dewar)
Solution:   Check for at least one fold. (closes vim/vim#7245)
c136a3528b
2020-11-03 22:44:08 -05:00
Jan Edmund Lazo
5058b07122
vim-patch:8.1.1581: shared functions for testing are disorganised
Problem:    Shared functions for testing are disorganised.
Solution:   Group finctions in script files. (Ozaki Kiichi, closes vim/vim#4573)
7a39dd7f00
2020-05-03 13:16:37 -04:00
Jan Edmund Lazo
63cd5dd0ae
vim-patch:8.2.0002: "dj" only deletes first line of closed fold
Problem:    "dj" only deletes first line of closed fold.
Solution:   Adjust last line of operator for linewise motion. (closes vim/vim#5354)
3b68123cd2
2019-12-16 19:38:28 -05:00
Jurica Bradaric
c84b39150f vim-patch:8.1.1362: code and data in tests can be hard to read
Problem:    Code and data in tests can be hard to read.
Solution:   Use the new heredoc style. (Yegappan Lakshmanan, closes vim/vim#4400)
c79745a82f
2019-10-07 14:14:13 +02:00
Daniel Hahler
97b82553e0 vim-patch:8.1.2052: using "x" before a closed fold may delete that fold
Problem:    Using "x" before a closed fold may delete that fold.
Solution:   Do not translate 'x' do "dl". (Christian Brabandt, closes vim/vim#4927)
7a9bd7c1e0
2019-09-22 20:11:04 +02:00
Daniel Hahler
9e24bbb52f vim-patch:8.1.1483: skipped tests are not properly listed
Problem:    Skipped tests are not properly listed.
Solution:   Throw a "Skipped" exception instead of using ":finish" or ":return".
5d30ff1964

Skips quite some (N/A) tests.

vim-patch:8.1.0503: missing change to diff test (included in cf1ffa916)
2019-08-22 05:06:30 +02:00
Jan Edmund Lazo
ec9b57cb6e
vim-patch:8.1.1890: ml_get error when deleting fold marker
Problem:    Ml_get error when deleting fold marker.
Solution:   Check that the line number is not below the last line.  Adjust the
            fold when deleting the empty line.  (Christian Brabandt,
            closes vim/vim#4834)
9a4a8c4d59
2019-08-19 21:32:24 -04:00
Michael Vilim
bed95b37b2 vim-patch:8.1.0449: fix display of 'rnu' with folded lines #9481
Problem:    When 'rnu' is set folded lines are not displayed correctly.
            (Vitaly Yashin)
Solution:   When only redrawing line numbers do draw folded lines.
            (closes vim/vim#3484)
7701f30856

---
Explanation:
Before this patch, relative line numbers would update on a cursor
movement and overwrite fold highlighting in the line number columns.
Other operations can cause the fold highlighting to overwrite the line
number styles. Together, this causes the highlighting in the line number
columns to flicker back and forth while editing.

Test case: create `t.vim` with these contents:

    set fdm=marker rnu foldcolumn=2
    call setline(1, ["{{{1", "nline 1", "{{{1", "line 2"])

and then call `nvim -u NORC -S t.vim` and press `j`; observe that the fold
highlighting disappears.
2019-01-11 01:44:15 +01:00
Jan Edmund Lazo
55c5185884 vim-patch:8.1.0574: 'commentstring', fold marker in C (#9339)
Problem:    'commentstring' not used when adding fold marker in C.
Solution:   Require white space before middle comment part. (mostly by
            Hirohito Higashi)
4af7259b2b
2018-12-10 03:11:56 +01:00
Jan Edmund Lazo
f1eb25f0c4 vim-patch:8.1.0570: 'commentstring' not used when adding fold marker (#9331)
Problem:    'commentstring' not used when adding fold marker. (Maxim Kim)
Solution:   Only use empty 'comments' middle when leader is empty. (Christian
            Brabandt, closes vim/vim#3670)
539328197c
2018-12-08 14:21:49 +01:00
Jan Edmund Lazo
e1fa242a6c vim-patch:8.1.0174: after paging up and down fold line is wrong
Problem:    After paging up and down fold line is wrong.
Solution:   Correct the computation of w_topline and w_botline. (Hirohito
            Higashi)
907dad72ef
2018-09-10 20:34:34 -04:00
Jan Edmund Lazo
dd0dd4d78d vim-patch:8.0.1115: crash when using foldtextresult() recursively (#8972)
Problem:    Crash when using foldtextresult() recursively.
Solution:   Avoid recursive calls. (Yasuhiro Matsumoto, closes vim/vim#2098)
495b7dd213
2018-09-09 19:22:10 +02:00
Jan Edmund Lazo
37757b4f09 vim-patch:8.0.1253: still too many old style tests
Problem:    Still too many old style tests.
Solution:   Convert a few more tests to new style. (Yegappan Lakshmanan,
            closes vim/vim#2272)
430dc5d360

Skip Test_tag_file_encoding.
083_tag_search_with_file_encoding_spec.lua handles the same test case.
2018-07-06 23:51:46 -04:00
Jan Edmund Lazo
8794a551bd vim-patch:8.0.0{469,581,583} (#8601)
vim-patch:8.0.0469: compiler warnings on MS-Windows
Problem:    Compiler warnings on MS-Windows.
Solution:   Add type casts. (Christian Brabandt)
0c0d4eca4d

vim-patch:8.0.0581: moving folded text is sometimes not correct
Problem:    Moving folded text is sometimes not correct.
Solution:   Bail out when "move_end" is zero. (Matthew Malcomson)
94be619e30

vim-patch:8.0.0583: fold test hangs on MS-Windows
Problem:    Fold test hangs on MS-Windows.
Solution:   Avoid overflow in compare.
b11c826ddc
2018-06-20 10:29:09 +02:00
KunMing Xie
47fa9de580 vim-patch:8.0.0496: insufficient testing for folding (#8438)
Problem:    Insufficient testing for folding.
Solution:   Add a couple more fold tests. (Dominique Pelle, closes vim/vim#1579)
518c9b133b
2018-05-26 11:26:01 +02:00
Justin M. Keyes
c68d89521f vim-patch:8.0.1271: still too many old style tests
Problem:    Still too many old style tests.
Solution:   Convert a few more tests to new style. (Yegappan Lakshmanan,
            closes vim/vim#2290)

fb094e14c1
2018-02-12 00:48:30 +01:00
Matthew Malcomson
3a9dd13f9e fold.c: more edge-cases when updating (#6207)
When foldUpdateIEMSRecurse() re-uses an existing fold, it misses the
case where the existing fold spans from before startlnum to after
firstlnum, the new fold does not span this range, and there is no
"forced start" of a fold. We add a case for this in.

Ensure that if there was no forced break in folds, we merge folds that
now touch each other.

Include testing for a tricky foldmethod=expr case that has never been a
bug. This case works at the moment because of some effects that are not
obvious when reading the code.
A test for this could be useful to ensure a regression doesn't happen.

vim-patch:8.0.0408
2017-03-31 01:21:26 +02:00
Matthew Malcomson
a6c9c91841 vim-patch:8.0.0407 : filtering folds with marker method not tested
Problem:    Filtering folds with marker method not tested.
Solution:   Also set 'foldmethod' to "marker".
2017-03-23 15:55:57 +00:00
Matthew Malcomson
b2b88423aa Robustly handle folds during a :move command
In order to re-order marks according to the :move command, do_move()
uses mark_adjust() in a non-standard manner. The non-standard action is
that it moves some marks *past* other marks. This doesn't matter for
marks, but mark_adjust() calls foldMarkAdjust() which simply changes
fold starts and lengths and doesn't have enough information to know that
other folds have to be checked and reordered.

The array of folds for each window are assumed to be in order of
increasing line number, and if this gets broken some folds can get
"lost".

There has been a previous patch to avoid this problem by deleting and
recalculating all folds in the window, but this comes at the cost of
closing all folds when executing :move, and doesn't cover the case of
manual folds.
This patch adds a new function foldMoveRange() specifically for the
:move command that handles reordering folds as well as simply moving
them. Additionally, we allow calling mark_adjust_nofold() that does the
same as mark_adjust() but doesn't affect any fold array.

Calling mark_adjust_nofold() should be done in the same manner as
calling mark_adjust(), but according changes to the fold arrays must be
done seperately by the calling function.

vim-patch:8.0.0457
vim-patch:8.0.0459
vim-patch:8.0.0461
vim-patch:8.0.0465
2017-03-23 14:37:47 +00:00
Matthieu Coudron
71d4b81b4c vim-patch:8.0.0453 (#6266)
Problem:    Adding fold marker creates new comment.
Solution:   Use an existing comment if possible. (LemonBoy, closes vim/vim#1549)

025a6b708a
2017-03-13 01:54:35 +01:00
Justin M. Keyes
3c740f7424 vim-patch:8.0.0135
Problem:    An address relative to the current line, ":.,+3y", does not work
            properly on a closed fold. (Efraim Yawitz)
Solution:   Correct for including the closed fold. (Christian Brabandt)

ded2782783
2017-03-02 00:08:51 +01:00