aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/builtin.txt9
-rw-r--r--runtime/lua/vim/_meta/vimfn.lua9
2 files changed, 12 insertions, 6 deletions
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index ceecc61b97..8b472523f1 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -8291,15 +8291,18 @@ tr({src}, {fromstr}, {tostr}) *tr()*
trim({text} [, {mask} [, {dir}]]) *trim()*
Return {text} as a String where any character in {mask} is
removed from the beginning and/or end of {text}.
- If {mask} is not given, {mask} is all characters up to 0x20,
- which includes Tab, space, NL and CR, plus the non-breaking
- space character 0xa0.
+
+ If {mask} is not given, or is an empty string, {mask} is all
+ characters up to 0x20, which includes Tab, space, NL and CR,
+ plus the non-breaking space character 0xa0.
+
The optional {dir} argument specifies where to remove the
characters:
0 remove from the beginning and end of {text}
1 remove only at the beginning of {text}
2 remove only at the end of {text}
When omitted both ends are trimmed.
+
This function deals with multibyte characters properly.
Returns an empty string on error.
diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua
index 2b79feec8e..2c594e049f 100644
--- a/runtime/lua/vim/_meta/vimfn.lua
+++ b/runtime/lua/vim/_meta/vimfn.lua
@@ -9845,15 +9845,18 @@ function vim.fn.tr(src, fromstr, tostr) end
--- Return {text} as a String where any character in {mask} is
--- removed from the beginning and/or end of {text}.
---- If {mask} is not given, {mask} is all characters up to 0x20,
---- which includes Tab, space, NL and CR, plus the non-breaking
---- space character 0xa0.
+---
+--- If {mask} is not given, or is an empty string, {mask} is all
+--- characters up to 0x20, which includes Tab, space, NL and CR,
+--- plus the non-breaking space character 0xa0.
+---
--- The optional {dir} argument specifies where to remove the
--- characters:
--- 0 remove from the beginning and end of {text}
--- 1 remove only at the beginning of {text}
--- 2 remove only at the end of {text}
--- When omitted both ends are trimmed.
+---
--- This function deals with multibyte characters properly.
--- Returns an empty string on error.
---