Problem: Code is indented more than necessary.
Solution: Use an early return where it makes sense. (Yegappan Lakshmanan,
closesvim/vim#11792)
1cfb14aa97
Partial port as some highlight.c changes depend on previous patches.
Cherry-pick fname_match() change from patch 8.2.4959.
Omit internal_func_check_arg_types(): only used for Vim9 script.
N/A patches for version.c:
vim-patch:9.0.1167: EditorConfig files do not have their own filetype
Problem: EditorConfig files do not have their own filetype.
Solution: Add the "editorconfig" filetype. (Gregory Anders, closesvim/vim#11779)
d41262ed06
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Problem: Code is indented more than needed.
Solution: Use an early return to reduce indentation. (Yegappan Lakshmanan,
closesvim/vim#11769)
dc4daa3a39
Omit expand_autoload_callback(): only applies to Vim9 script.
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Duplicating get_option_value() logic for an obscure future refactor
isn't really worthwhile, and findoption() isn't used anywhere else
outside the options code.
Problem: `chansend()` on Windows sends lines in reverse order.
Cause: Using \n instead of \r\n for newlines on Windows.
Solution: on Windows, use CRLF newline characters.
Fixes#18501
Problem: Without /dev/urandom srand() seed is too predictable.
Solution: Use micro seconds and XOR with process ID. (Yasuhiro Matsumoto,
closesvim/vim#11656)
f0a9c00482
Co-authored-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Problem: Some source files are too big.
Solution: Move buffer and window related functions to evalbuffer.c and
evalwindow.c. (Yegappan Lakshmanan, closesvim/vim#4898)
261f346f81
Problem: Use of strftime() is not safe.
Solution: Check the return value of strftime(). Use a larger buffer and
correctly pass the available space. (Dominique Pellé, closes
vim/vim#11348)
84d14ccdb5
Co-authored-by: Dominique Pelle <dominique.pelle@gmail.com>
Problem: Max() and min() can give many error messages.
Solution: Bail out at the first error. (closesvim/vim#1039, closesvim/vim#7778)
ab65fc77c5
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: getbufline() is inefficient for getting a single line.
Solution: Add getbufoneline().
ce30ccc06a
Cherry-pick part of usr_41.txt from patch 8.1.1628.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: get(Fn, 'name') on funcref returns special byte code.
Solution: Use the printable name.
1ae8c262df
Cherry-pick printable_func_name() from patch 8.2.0149.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Allow Include What You Use to remove unnecessary includes and only
include what is necessary. This helps with reducing compilation times
and makes it easier to visualise which dependencies are actually
required.
Work on https://github.com/neovim/neovim/issues/549, but doesn't close
it since this only works fully for .c files and not headers.
Problem: col() and charcol() only work for the current window.
Solution: Add an optional winid argument. (Yegappan Lakshmanan,
closesvim/vim#11466, closesvim/vim#11461)
4c8d2f02b3
Cherry-pick test_functions.vim change from patch 8.2.0633.
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
- `:write ++p foo/bar/baz.txt` should create parent directories `foo/bar/` if
they do not exist
- Note: `:foo ++…` is usually for options. No existing options have
a single-char abbreviation (presumably by design), so it's safe to
special-case `++p` here.
- Same for `writefile(…, 'foo/bar/baz.txt', 'p')`
- `BufWriteCmd` can see the ++p flag via `v:cmdarg`.
closes#19884
Problem: deletebufline() does not always return 1 on failure.
Solution: Refactor the code to make it work more predictable. (closesvim/vim#11511)
7af3ee2b83
Enable and fix bugprone-misplaced-widening-cast warning.
Fix some modernize-macro-to-enum and readability-else-after-return
warnings, but don't enable them. While the warnings can be useful, they
are in general too noisy to enable.
Problem: Cannot have expandcmd() give an error message for mistakes.
Solution: Add an optional argument to give errors. Fix memory leak when
expanding files fails. (Yegappan Lakshmanan, closesvim/vim#10071)
2b74b6805b
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Problem: strchars() defaults to counting composing characters.
Solution: Add strcharlen() which ignores composing characters.
70ce8a1561
Use docs from latest Vim instead.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Using 2 where bool is expected may throw an error.
Solution: Make this backwards compatible.
bade44e5ca
In legacy Vim script get_bool functions do the same thing as get_number
functions, so just add aliases using #define.
N/A patches for version.c:
vim-patch:8.2.1506: Vim9: no error when using a number other than 0 or 1 as bool
Problem: Vim9: no error when using a number other than 0 or 1 as bool.
Solution: Check the number is 0 or 1.
d70840ed68
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Vim9: wrong argument for append() results in two errors.
Solution: Check did_emsg. Also for setline(). Adjust the help for
appendbufline().
8b6256f6ec
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Duplicated code for adding buffer lines.
Solution: Move code to a common function. Also move map functions to map.c.
(Yegappan Lakshmanan, closesvim/vim#8665)
4a15504e91
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Problem: Crash when using win_move_separator() in other tab page.
Solution: Check for valid window in current tab page.
(closesvim/vim#11479, closesvim/vim#11427)
873f41a018
Problem: Vim9: return type of readfile() is any.
Solution: Add readblob() so that readfile() can be expected to always
return a list of strings. (closesvim/vim#7671)
c423ad77ed
Co-authored-by: Bram Moolenaar <Bram@vim.org>
vim-patch:86e6717ace4f
Problem: Crash when using win_move_statusline() in another tab page.
Solution: Check for valid window pointer. (issue vim/vim#11427)
86e6717ace
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Cannot translate messages in a Vim script.
Solution: Add gettext(). Try it out for a few messages in the options
window.
0b39c3fd4c
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Using uninitialized memory when reading empty file.
Solution: Check for empty file before checking for NL. (Dominique Pellé,
closesvim/vim#9511)
f5d639a8af
Co-authored-by: Dominique Pelle <dominique.pelle@gmail.com>
Problem: Wrong column when calling setcursorcharpos() with zero lnum.
Solution: Set the line number before calling buf_charidx_to_byteidx().
(closesvim/vim#11329)
79f234499b
Problem: Vim9: no error when using "2" for a line number.
Solution: Give an error message if the line number is invalid. (closesvim/vim#7492)
9a963377b4
N/A patches for version.c:
vim-patch:8.2.1465: Vim9: subscript not handled properly
Problem: Vim9: subscript not handled properly.
Solution: Adjust error message. Remove dead code. Disallow string to
number conversion in scripts.
56acb0943e