Problem: Vim9: blob operations not fully tested.
Solution: Make more blob tests run in Vim9 script. Fix filter(). Make
insert() give an error for a null blob, like add().
39211cba72
vim-patch:8.2.3284: no error for insert() or remove() changing a locked blob
Problem: No error for insert() or remove() changing a locked blob.
Solution: Check a blob is not locked before changing it. (Sean Dewar,
closesvim/vim#8696)
80d7395dcf
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Co-authored-by: Sean Dewar <seandewar@users.noreply.github.com>
Problem:
has('gui_running') is still common in the wild and our answer has
changed over time, causing frustration.
95a6ccbe9f
Solution:
Use stdin_tty/stdout_tty to decide if a UI is (not) a GUI.
Problem: Vim9: it is not possible to extend a dictionary with different
item types.
Solution: Add extendnew(). (closesvim/vim#7666)
b0e6b51364
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Code and help for indexof() is not ideal.
Solution: Refactor the code, improve the help. (Yegappan Lakshmanan,
closesvim/vim#10908)
3fbf6cd355
Skip CHECK_LIST_MATERIALIZE and set_vim_var_type().
Use tv_list_uidx() instead of lv_idx.
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Problem: Finding value in list may require a for loop.
Solution: Add indexof(). (Yegappan Lakshmanan, closesvim/vim#10903)
b218655d5a
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Problem: flattennew() makes a deep copy unnecessarily.
Solution: Use a shallow copy. (issue vim/vim#10012)
c6c1ec4da5
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: flatten() does not use maxdepth correctly.
Solution: Use a recursive implementation. (closesvim/vim#10020)
acf7d73a7f
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Vim9: flatten() always changes the list type.
Solution: Disallow using flatten() and add flattennew().
3b69006973
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This value can not be relied on as it doesn't work for
multi-configuration generators. I don't think this undocumented option
is used much, if at all, so I think we should remove it.
Problem: Code is indented more than necessary.
Solution: Use an early return where it makes sense. (Yegappan Lakshmanan,
closesvim/vim#11879)
032713f829
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Problem: search() loops forever if "skip" is TRUE for all matches.
Solution: Keep the position of the first match.
3d79f0a430
Co-authored-by: Bram Moolenaar <Bram@vim.org>
A blob is used as a sequence of bytes and usually accessed individually,
not as as a NUL-terminuated string, so uint8_t should be better.
Not sure about ga_append(), but using uint8_t leads to fewer casts.
Problem: Cannot lock a variable in legacy Vim script like in Vim9.
Solution: Make ":lockvar 0" work.
a187c43cfe
Co-authored-by: Bram Moolenaar <Bram@vim.org>
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