Problem: screenpos() may crash with neg. column
Solution: validate and correct column
closes: vim/vim#13669ec54af4e26
(cherry picked from commit 6052fac625)
runtime(syntax): unlet b:filetype_in_cpp_family for cpp & squirrel
Update runtime/syntax/cpp.vim and runtime/syntax/squirrel.vim to unlet
b:filetype_in_cpp_family as it remains set even after updating the ft of
a file manually or through a modeline, not allowing c specific keywords
to be highlighted.
Since the variable b:filetype_in_cpp_family is only used by the c.vim
syntax script, unlet it directly after sourcing the c.vim runtime file
instead of at the end of the script.
Also update the last Change Header for both files.
closes: vim/vim#13650ff0baca865
Co-authored-by: laburnumT <laburnumtec@gmail.com>
(cherry picked from commit 6333be96ca)
fix(log): increase size of buffer for nvim instance name
16 bytes is not enough room for existing usage of the buffer by the
tests, so the name may get truncated and cause log_spec test to fail:
FAILED test/functional/core/log_spec.lua @ 30: log messages are formatted with name or test id
test/helpers.lua:146: retry() attempts: 51
test/helpers.lua:155: Pattern "%.%d+%.%d/c +server_init:%d+: test log message" not found in log (last 100 lines): Xtest_logging:
ERR 2023-11-24T23:36:34.252 T1274.2445945.0 server_init:57: test log message
ERR 2023-11-24T23:36:34.275 T1274.2445945.0 server_init:57: test log message
(cherry picked from commit ec80e4cb4d)
Co-authored-by: James McCoy <jamessan@jamessan.com>
Problem: 'breakindent' is not drawn after diff filler lines.
Solution: Correct check for whether 'breakindent' should be drawn.
closes: vim/vim#13624588f20dece
Problem:
With vim.treesitter.foldexpr, `o`-ing two lines above a folded region
opens the fold. This does not happen with legacy foldexprs. For example,
make a markdown file with the following text (without indentation),
enable treesitter fold, and follow the instruction in the text.
put cursor on this line and type zoo<Esc>
initially folded, revealed by zo
# then this fold will be opened
initially folded, revealed by o<Esc>
Analysis:
* `o` updates folds first (done in `changed_lines`), evaluating
foldexpr, and then invokes `on_bytes` (done in `extmark_splice`).
* Treesitter fold allocates the foldinfo for added lines (`add_range`)
on `on_bytes`.
* Therefore, when treesitter foldexpr is invoked while running `o`, it
sees outdated foldinfo.
Solution:
`extmark_splice`, and then `changed_lines`. This seems to be the
standard order in other places, e.g., `nvim_buf_set_lines`.
Problem:
`LanguageTree:for_each_tree` calls itself for child nodes, so when we
calls `for_each_tree` inside `for_each_tree`, this quickly leads to
exponential tree calls.
Solution:
Use `pairs(child:trees())` directly in this case, as we don't need the
extra callback for each children, this is already handled from the outer
`for_each_tree` call
(cherry picked from commit 0712a4c085)
Co-authored-by: Pham Huy Hoang <hoangtun0810@gmail.com>
Checking if it's non-empty and not a directory gets us quite far, but
not all the way. While a working symlink would trigger the earlier
checks, a broken symlink does not.
This commit fixes the special case where ~/.local/share/nvim already
exists but is a broken symlink. Thus, it fixes the following error on
startup:
E739: Cannot create directory /home/samuel/.local/share/nvim: file
already exists
(cherry picked from commit a6051e68a3)
09d4133 changed blocknr_T from long to int64_t, so pe_bnum is now always 64-bit. This was an incompatible change in the swapfile format for 32-bit systems, but there have been no complaints in the past 9 years so just adjust the test.
(cherry picked from commit a1ded1b113)
skipwhite was iterating over the input twice and scanning for the null
byte character with strlen. this is redundant, because it's already
covered by ascii_iswhite that accepts only space or tab character.
(cherry picked from commit b4743dfefa)
Problem: Using negative array index with negative width window.
Solution: Make sure the window width does not become negative.
8279af514c
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Using freed memory with cmdwin and BufEnter autocmd.
Solution: Make sure pointer to b_p_iminsert is still valid.
1c3dd8ddcb
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Reading before the start of the line.
Solution: When displaying "$" check the column is not negative.
e98c88c44c
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Confusing error when using "q:" in command line window.
Solution: Check for the situation and give a better error message.
(closesvim/vim#10756)
c963ec31a0
Co-authored-by: Bram Moolenaar <Bram@vim.org>
backport #26034
Problem:
'nofsync' may lose data if the system has a hard shutdown. #9888
Solution:
Change default to 'fsync'. This may be revisited in the future when
'nofsync' can be made safer.
Co-authored-by: Ploum <1233155+ploum@users.noreply.github.com>