Problem: blob2str() does not handle UTF-16 encoding
(Hirohito Higashi)
Solution: Refactor the code and fix remaining issues, see below
(Yasuhiro Matsumoto).
blob2str() function did not properly handle UTF-16/UCS-2/UTF-32/UCS-4
encodings with endianness suffixes (e.g., utf-16le, utf-16be, ucs-2le).
The encoding name was canonicalized too aggressively, losing the
endianness information needed by iconv.
This change include few fixes:
- Preserve the raw encoding name with endianness suffix for iconv calls
- Normalize encoding names properly: "ucs2be" → "ucs-2be", "utf16le" →
"utf-16le"
- For multi-byte encodings (UTF-16/32, UCS-2/4), convert the entire blob
first, then split by newlines
convert_string() cannot handle UTF-16 because it uses string_convert()
which expects NUL-terminated strings. UTF-16 contains 0x00 bytes within
characters (e.g., "H" = 0x48 0x00), causing premature termination.
Therefore, for UTF-16/32 encodings, the fix uses string_convert_ext()
with an explicit input length to convert the entire blob at once.
The code appends two NUL bytes (ga_append(&blob_ga, NUL) twice) because
UTF-16 requires a 2-byte NUL terminator (0x00 0x00), not a single-byte
NUL.
- src/strings.c: Add from_encoding_raw to preserve endianness, special
handling for UTF-16/32 and UCS-2/4
- src/mbyte.c: Fix convert_setup_ext() to use == ENC_UNICODE instead of
& ENC_UNICODE. The bitwise AND was incorrectly treating UTF-16/UCS-2
(which have ENC_UNICODE + ENC_2BYTE etc.) as UTF-8, causing iconv
setup to be skipped.
fixes: #19198closes: #19246
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Use standard indent and remove unnecessary bang.
closes: #19285
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: modeless selection not copied to * register when P in
guioptions (Coacher)
Solution: Make the "P" flag override the "a" and "A" flag
(Foxe Chen)
fixes: #19187closes: #19244
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Also add syntax tests for those newly constants.
closes: #17788closes: #18922
Signed-off-by: Rob B <github@0x7e.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
I've updated the Japanese translation for the Vim 9.2 release. The
content contained in this PR was created collaboratively by multiple
peoples in the vim-jp/lang-ja project, and I, koron (Muraoka Taro), am
submitting it as the project representative.
The PR used for this work is https://github.com/vim-jp/lang-ja/pull/171.
(Please note that the communication in this PR is in Japanese)
closes: #19215
Signed-off-by: Muraoka Taro <koron.kaoriya@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This update is meant to be included in the upcoming 9.2 release.
**New**
- Support ConTeXt's convention to optionally specify an output directory
in a comment line at the beginning of a source file.
- If a log file is not found, Vim does not create a new buffer.
- Removed `syntax/shared` files for the following reasons:
- they are not necessary for the plugin to work (they only improve
over existing syntax highlighting);
- they are relative large;
- they can be automatically (re)generated by users at any time using
ConTeXt (explained in the doc);
- since ConTeXt is updated frequently, they quickly become obsolete.
**Minor**
- Prefer `var` to `const` inside functions.
- Prefer `$`-interpolation to `printf()`.
- All revision dates set to the same date for consistency.
- Updated the error format.
- Various tweaks to the documentation, but nothing disruptive or new.
closes: #19148
Signed-off-by: Lifepillar <lifepillar@lifepillar.me>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: The behavior of vim.eval() with Vim special variables is not
clearly documented. It is (partly) the reason why Nvim
Python's vim.eval gives different output when evaluating
v:true and v:false
Solution: Document it (Phạm Bình An)
closes: #19157
Signed-off-by: Phạm Bình An <phambinhanctb2004@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Vim9: type issue when appending item to a list
(Peter Kenny)
Solution: When adding a new item at the end of a list in vim9script, use
the proper item type (Yegappan Lakshmanan)
fixes: #19045closes: #19076
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem:
- When I type `:h termdebug`, I will expect to see the introduction of
the termdebug plugin. But instead, it shows me document of
`termdebug_wide`, and I have to scroll up quite much to find the
introduction.
- `:h popup` says `floating-window`? Why? As I have tried both features
(of Vim and Neovim), I think they are _very different_ things, even
more different than job features in Vim and Neovim.
Solution:
- In `:h terminal.txt`, add tag `*termdebug*` to the introduction of
termdebug plugin.
- In `:h popup.txt`, "floating window" -> "popup window".
closes: #19135
Signed-off-by: Phạm Bình An <phambinhanctb2004@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: A few typos in the code and runtime files
Solution: Fix those (zeertzjq).
closes: #19119
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit updates `syntax/cangjie.vim` to match the latest `std.core`
library:
New Features:
* Documentation: Added highlighting for documentation keywords (e.g., `@param`, `@return`).
* Standard Library: Added highlighting for `std.core` functions, interfaces, and classes.
* Exceptions: Added highlighting for standard exception types.
* FFI Support: Added highlighting for C interoperability types (e.g., `CPointer`).
Improvements:
* Configuration: Added a unified switch (`s:enabled('builtin')`) for standard library highlighting.
* Type System: Updated `Int` and `UInt` aliases.
* Interpolation: Enabled standard library highlighting inside string interpolation.
* Cleanup: Removed non-core types like `ArrayList` and `HashMap`.
closes: #19085
Signed-off-by: Neila <wu.junkai@qq.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Add documentation notes explaining that visual marks '< and '> have
different behaviors in getpos() and setpos().
Also fix a small typo.
closes: #19070
Signed-off-by: Larson, Eric <numeric.larson@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: 'fsync' option cannot be set per buffer
Solution: Make 'fsync' option global-local
(glepnir)
closes: #19019
Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
- Start each field at the correct tabstop - on a new line if required.
- Use "Type1/Type2" for return types rather than "Type1 or Type2",
matching the dominant style.
- Convert hyperlinked Ex commands to command markup, `:cmd`.
- Wrap overlong lines.
closes: #18438
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: MS-Windows: Missing fullscreen support for GUI version
Solution: Add "s" flag to guioptions (Mao-Yining)
- Implement fullscreen mode controlled by the 'go-s' flag in 'guioptions'
- Update documentation with usage examples and platform-specific details
See :help 'go-s' and :help gui-w32-fullscreen for complete documentation.
closes: #18836
Signed-off-by: Mao-Yining <101858210+mao-yining@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
- Use `:!start` directly, discard the using of `explorer.exe`.
- Update the document in `eval.txt`.
closes: #18985
Signed-off-by: Mao-Yining <mao.yining@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Since patch 7.4.264 a leading "g:" is skipped.
closes: #18976
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: clipboard provider does not respect 'clipboard' option
(Satoru Kitaguchi, after v9.1.1972)
Solution: make clipboard provider register respect "unnamed/unnamedplus"
from the 'clipboard' option value
fixes: #18930closes: #18952
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>