Commit Graph

6156 Commits

Author SHA1 Message Date
bfredl
50a03c0e99 fix(treesitter): fix another TSNode:tree() double free
Unfortunately the gc=false objects can refer to a dangling tree if the
gc=true tree was freed first. This reuses the same tree object as the
node itself is keeping alive via the uservalue of the node userdata.
(wrapped in a table due to lua 5.1 restrictions)
2023-08-29 11:35:46 +02:00
nwounkn
6e45567b49
fix(treesitter): fix TSNode:tree() double free (#24796)
Problem: `push_tree`, every time its called for the same TSTree with
`do_copy=false` argument, creates a new userdata for it. Each userdata,
when garbage collected, frees the same TSTree C object.

Solution: Add flag to userdata, which indicates, should C object,
which userdata points to, be freed, when userdata is garbage collected.
2023-08-29 10:48:23 +02:00
bfredl
0a81ec14a4 fix(api): better topline adjustments in nvim_buf_set_lines
Some more reasonable defaults for topline:
  - if topline was replaced with another line, that now becomes topline
  - if line was inserted just before topline, display it. This is more
    similar to the previous API behavior.
2023-08-29 09:26:15 +02:00
zeertzjq
794981d9be
vim-patch:9.0.1813: linebreak incorrect drawn with breakindent (#24917)
Problem: 'linebreak' is incorrectly drawn after 'breakindent'.
Solution: Don't include 'breakindent' size when already after it.

closes: vim/vim#12937
closes: vim/vim#12940

1d3e0e8f31
2023-08-29 09:36:55 +08:00
bfredl
132bbd1cbd fix(api): handle clearing out last line of non-current buffer
fixes #24911
2023-08-28 12:39:02 +02:00
zeertzjq
656be8a591
vim-patch:9.0.1810: camel-case spelling has issues with digits (#24909)
Problem:  camel-case spelling has issues with digits
Solution: Improve the camCase spell checking by taking digits
          and caps into account

Rewrite the conditions to check for word boundaries by taking into
account the presence of digits and all-caps sequences such as acronyms.

closes: vim/vim#12644
closes: vim/vim#12933

d08745040b

Co-authored-by: LemonBoy <thatlemon@gmail.com>
2023-08-28 07:16:15 +08:00
zeertzjq
6b12eda220
vim-patch:9.0.1798: The 'syntax' option has no completion. (#24908)
Problem:  The 'syntax' option has no completion.
Solution: Add syntax option completion.

closes: vim/vim#12900

6dfdff3f27

N/A patches:
vim-patch:9.0.1795: Indentation issues

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2023-08-28 07:07:50 +08:00
zeertzjq
062db5c136 vim-patch:9.0.1802: Multiline regex with Visual selection fails with virtual text
Problem:  Multiline regex with Visual selection fails when Visual
          selection contains virtual text after last char.
Solution: Only include virtual text after last char when getting full
          line length.

closes: vim/vim#12908

e3daa06be1
2023-08-28 06:10:36 +08:00
zeertzjq
c70aa84b2a vim-patch:9.0.1800: Cursor position still wrong with 'showbreak' and virtual text
Problem:  Cursor position still wrong with 'showbreak' and virtual text
          after last character or 'listchars' "eol".
Solution: Remove unnecessary w_wcol adjustment in curs_columns(). Also
          fix first char of virtual text not shown at the start of a screen
          line.

closes: vim/vim#12478
closes: vim/vim#12532
closes: vim/vim#12904

6a3897232a
2023-08-28 06:02:01 +08:00
zeertzjq
128091a256 fix(ui): wrong cursor position with left gravity inline virt text at eol 2023-08-28 05:51:01 +08:00
Lewis Russell
abb8c2c453 fix(editorconfig): do not set 'endofline'
Problem:
  'endofline' can be used to detect if a file ends of <EOL>, however
  editorconfig can break this.

Solution:
  Set 'endofline' during BufWritePre

Fixes: #24869
2023-08-27 19:27:25 +01:00
zeertzjq
1f49c98036
vim-patch:9.0.1792: problem with gj/gk/gM and virtual text (#24898)
Problem:  Normal mode "gM", "gj", "gk" commands behave incorrectly with
          virtual text.
Solution: Use linetabsize() instead of linetabsize_str().

closes: vim/vim#12909

d809c0a903
2023-08-27 20:04:44 +08:00
bfredl
840749d6c9 fix(undo): fix crash caused by checking undolevels in wrong buffer
fixes #24894
2023-08-27 12:08:11 +02:00
bfredl
9b9030ff2c fix(api): fix inconsistent behavior of topline touched in recent refactor
The change in #24824 0081549 was not a regression, however it was an
incomplete change. Unfortunately some common plugins come to depend on
this exising self-inconsistent behavior. These plugins are going to need
to update for 0.10

nvim_buf_set_lines used to NOT adjust the topline correctly if a buffer
was displayed in just one window. However, if displayed in multiple
windows, it was correctly adjusted for any window not deemed the
current window for the buffer (which could be an arbitrary choice if the
buffer was not already current, as noted in the last rafactor)

This fixes so that all windows have their topline adjusted. The added
tests show this behavior, which should be the reasonable one.
2023-08-27 12:07:46 +02: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
luukvbaal
afd0c648a8
fix(statuscolumn): force full redraw when signcolumn is invalid (#24859)
Fix #24655
2023-08-26 21:10:04 +08:00
Ibby
362df0f793
fix(extmarks): wrong display when changing text with virt_lines (#24879) 2023-08-26 19:39:05 +08:00
bfredl
0081549547 refactor(change): do API changes to buffer without curbuf switch
Most of the messy things when changing a non-current buffer is
not about the buffer, it is about windows. In particular, it is about
`curwin`.

When editing a non-current buffer which is displayed in some other
window in the current tabpage, one such window will be "borrowed" as the
curwin. But this means if two or more non-current windows displayed the buffers,
one of them will be treated differenty. this is not desirable.

In particular, with nvim_buf_set_text, cursor _column_ position was only
corrected for one single window. Two new tests are added: the test
with just one non-current window passes, but the one with two didn't.

Two corresponding such tests were also added for nvim_buf_set_lines.
This already worked correctly on master, but make sure this is
well-tested for future refactors.

Also, nvim_create_buf no longer invokes autocmds just because you happened
to use `scratch=true`. No option value was changed, therefore OptionSet
must not be fired.
2023-08-26 12:02:05 +02:00
zeertzjq
a9418ef8cf
fix(ui): wrong display with 0-width inline virt_text at eol (#24854) 2023-08-24 11:28:10 +08:00
Amaan Qureshi
c6ec7fa8d7 feat(treesitter): add 'injection.self' and 'injection.parent'
Co-authored-by: ObserverOfTime <chronobserver@disroot.org>
2023-08-24 09:05:44 +09:00
zeertzjq
466c18b818
vim-patch:9.0.1785: wrong cursor position with 'showbreak' and lcs-eol (#24852)
Problem:  wrong cursor position with 'showbreak' and lcs-eol
Solution: Add size of 'showbreak' before when 'listchars' "eol" is used.
          Also fix wrong cursor position with wrapping virtual text on
          empty line and 'showbreak'.

closes: vim/vim#12891

1193951beb
2023-08-24 07:19:18 +08:00
zeertzjq
08fa71fd27
vim-patch:9.0.1773: cannot distinguish Forth and Fortran *.f files (#24841)
Problem:  cannot distinguish Forth and Fortran *.f files
Solution: Add Filetype detection Code

Also add *.4th as a Forth filetype

closes: vim/vim#12251

19a3bc3add

Don't remove filetype files from Vim patches:
- filetype.vim, script.vim, ft.vim usually contain useful changes
- script.vim and ft.vim don't even have their paths spelled correctly

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2023-08-23 19:32:11 +08:00
zeertzjq
3f32cb88c2 vim-patch:9.0.1781: Problems when setting bin/paste option
Problem:  Problems when setting bin/paste option
Solution: When setting binary/paste, remember that this also affects
          depending options, so that :verbose set returns the right
          location.

Mention if depending options for 'binary' or 'paste' have been reset
indirectly. Add a test to verify it works.

Also noticed as small bug, that the global option value for expandtab
was not reset when paste option is set, so fix that while at it.

closes: vim/vim#12837
closes: vim/vim#12879

757593c07a

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-08-23 18:24:14 +08:00
zeertzjq
0ba27bb51d vim-patch:9.0.1710: scrolloff options work slightly different
Problem: sidescrolloff and scrolloff options work slightly
         different than other global-local options
Solution: Make it behave consistent for all global-local options

It was noticed, that sidescrolloff and scrolloff options behave
differently in comparison to other global-local window options like
'listchars'

So make those two behave like other global-local options. Also add some
extra documentation for a few special local-window options.

Add a few tests to make sure all global-local window options behave
similar

closes: vim/vim#12956
closes: vim/vim#12643

4a8eb6e7a9

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-08-23 18:24:14 +08:00
zeertzjq
908f247c22 fix(plines): count 'showbreak' for virtual text at eol 2023-08-23 13:17:17 +08:00
zeertzjq
a1d71ad55e vim-patch:9.0.1783: Display issues with virt text smoothscroll and showbreak
Problem:  Wrong display with wrapping virtual text or unprintable chars,
          'showbreak' and 'smoothscroll'.
Solution: Don't skip cells taken by 'showbreak' in screen lines before
          "w_skipcol". Combined "n_skip" and "skip_cells".

closes: vim/vim#12597

b557f48982
2023-08-23 13:17:17 +08:00
zeertzjq
6462ee1c10
vim-patch:9.0.1779: Need more state() tests (#24840)
Problem:  Need more state() tests
Solution: Add a few more tests for operater pending mode and register
          yank command

closes: vim/vim#12883

8dabccd295
2023-08-23 06:42:10 +08:00
zeertzjq
20f76ebf2b
test: fix state() test flakiness (#24839) 2023-08-23 00:00:57 +08:00
zeertzjq
b84a67f50e
vim-patch:9.0.0579: using freed memory when 'tagfunc' wipes out buffer (#24838)
Problem:    Using freed memory when 'tagfunc' wipes out buffer that holds
            'complete'.
Solution:   Make a copy of the option.  Make sure cursor position is valid.

0ff01835a4

Cherry-pick a cmdwin change from patch 9.0.0500.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-22 22:48:55 +08:00
zeertzjq
e34eb4ccf9
test(old): reorder test_edit.vim to match upstream (#24837) 2023-08-22 20:57:10 +08:00
zeertzjq
63094e0013
vim-patch:8.0.0571: negative line number when using :z^ in an empty buffer (#24836)
Problem:    The cursor line number becomes negative when using :z^ in an empty
            buffer. (neovim vim/vim#6557)
Solution:   Correct the line number.  Also reset the column.

a364cdb648

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-22 20:56:14 +08:00
zeertzjq
3f1a12b8cc
test(old): remove workaround for TSAN CI (#24834)
Now that TSAN CI no longer runs oldtests, match upstream better.
2023-08-22 20:03:03 +08:00
zeertzjq
94f2da09e1
vim-patch:8.2.4611: typos in tests; one lua line not covered by test (#24835)
Problem:    Typos in tests; one lua line not covered by test.
Solution:   Fix typos. Add test case. (Dominique Pellé, closes vim/vim#9994)

81b573d7e5

Cherry-pick test_menu.vim change from patch 9.0.1453.

N/A patch:
vim-patch:8.2.3045: minor typos

Co-authored-by: Dominique Pelle <dominique.pelle@gmail.com>
2023-08-22 20:02:50 +08: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
48722ec400 vim-patch:9.0.0428: autocmd test uses common file name
Problem:    Autocmd test uses common file name.
Solution:   Use unique name to reduce flakiness.

be9fc5b60c

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-22 18:56:43 +08:00
zeertzjq
1da705c433 vim-patch:9.0.0425: autocmd test is a bit flaky on MS-Windows
Problem:    Autocmd test is a bit flaky on MS-Windows.
Solution:   Add a bit more sleeping. (Ken Takata, closes vim/vim#11095)

ae04a6049b

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-22 18:56:43 +08:00
zeertzjq
10990eace2 vim-patch:9.0.0415: on MS-Windows some tests are flaky
Problem:    On MS-Windows some tests are flaky.
Solution:   Add sleeps, disable swapfile, mark test as flaky. (Ken Takata,
            closes vim/vim#11082)

0500e87eba

Co-authored-by: K.Takata <kentkt@csc.jp>
2023-08-22 18:56:43 +08:00
zeertzjq
c170708023 vim-patch:9.0.0391: using separate delete() call instead of writefile() 'D' flag
Problem:    Using separate delete() call instead of writefile() 'D' flag.
Solution:   Use the writefile 'D' flag.

3411265a36

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-22 18:56:43 +08:00
zeertzjq
50b069a8b9 vim-patch:9.0.0380: deleting files in tests is a hassle
Problem:    Deleting files in tests is a hassle.
Solution:   Use the new 'D' flag of writefile().

e1f3ab73bc

vim-patch:e1f3ab73bc7c

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-22 18:56:43 +08:00
zeertzjq
d401b33314
fix(terminal): handle horizontal scrolling in another window (#24828) 2023-08-21 23:19:12 +08:00
Gregory Anders
d0717a7c4e
vim-patch:9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy (#24825)
Problem:    "for" and "while" not recognized after :vim9cmd and :legacy.
            (Emanuele Torre)
Solution:   Recognize all the command modifiers. (closes vim/vim#11087)
            Add a test to check the list of modifiers.

9132426334

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-21 09:06:21 -05:00
zeertzjq
28c2e83fb4 vim-patch:9.0.0313: using common name in tests leads to flaky tests
Problem:    Using common name in tests leads to flaky tests.
Solution:   Rename files and directories to be more specific.

e7cda97b6b

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-21 16:31:31 +08:00
zeertzjq
00ad0c81b6 vim-patch:9.0.0077: wrong restored cursor position when switching window in autocmd
Problem:    When switching window in autocmd the restored cursor position may
            be wrong.
Solution:   Do not restore the cursor if it was not set. (closes vim/vim#10775)

b03950fafa

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-21 16:25:48 +08:00
zeertzjq
bd9a9e63bc vim-patch:8.2.4212: window title test still fails in some configurations
Problem:    Window title test still fails in some configurations.
Solution:   Explicitly set the 'title' option.

1450112eef

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-21 16:17:01 +08:00
zeertzjq
67edc0a772 vim-patch:8.2.4211: window title test still fails in some configurations
Problem:    Window title test still fails in some configurations.
Solution:   Use WaitForAssert().

3a8ad5918b

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-21 16:16:53 +08:00
zeertzjq
7fab06cb0c vim-patch:8.2.4210: window title test fails in some configurations
Problem:    Window title test fails in some configurations.
Solution:   Only run the test if the title can be obtained.

a6c09a7c20

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-21 16:16:43 +08:00
zeertzjq
893437512c vim-patch:8.2.4208: using setbufvar() may change the window title
Problem:    Using setbufvar() may change the window title.
Solution:   Do not redraw when creating the autocommand window. (closes vim/vim#9613)

dff97e65eb

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-21 16:16:22 +08:00
zeertzjq
02ca31979b vim-patch:8.2.4339: CTRL-A does not work properly with the cmdline popup menu
Problem:    CTRL-A does not work properly with the cmdline popup menu.
Solution:   Fix issues with CTRL-A.  Add more tests for the cmdline popup
            menu.  Remove TermWait() before VeriryScreenDump().  Refactor the
            cmdline popup code. (Yegappan Lakshmanan, closes vim/vim#9735)

560dff49c0

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-08-21 15:43:39 +08:00
zeertzjq
00f92f086e vim-patch:8.2.3518: Test_xrestore sometimes fails
Problem:    Test_xrestore sometimes fails.
Solution:   Mark the test as flayky.  Move marking test as flaky to the test
            instead of listing them in runtest.

f08b0eb869

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-21 15:35:08 +08:00
zeertzjq
7aa3f825cd vim-patch:8.2.2910: test for cmdline window and terminal fails on MS-Windows
Problem:    Test for cmdline window and terminal fails on MS-Windows.
Solution:   Skip the test on MS-Windows.

0b49648486

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-21 15:31:21 +08:00