summaryrefslogtreecommitdiffstats
path: root/runtime/doc
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-11-21 19:57:04 +0000
committerBram Moolenaar <Bram@vim.org>2022-11-21 19:57:04 +0000
commitce30ccc06af7f2c03762e5b18dde37b26ea6ec42 (patch)
tree2933f7b9a71269829df045bf8b59178e698c937a /runtime/doc
parent29967732761d1ffb5592db5f5aa7036f5b52abf1 (diff)
patch 9.0.0916: getbufline() is inefficient for getting a single linev9.0.0916
Problem: getbufline() is inefficient for getting a single line. Solution: Add getbufoneline().
Diffstat (limited to 'runtime/doc')
-rw-r--r--runtime/doc/builtin.txt12
-rw-r--r--runtime/doc/usr_41.txt1
2 files changed, 11 insertions, 2 deletions
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index f17a892da7..04cadadd8f 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -208,6 +208,7 @@ get({func}, {what}) any get property of funcref/partial {func}
getbufinfo([{buf}]) List information about buffers
getbufline({buf}, {lnum} [, {end}])
List lines {lnum} to {end} of buffer {buf}
+getbufoneline({buf}, {lnum}) String line {lnum} of buffer {buf}
getbufvar({buf}, {varname} [, {def}])
any variable {varname} in buffer {buf}
getchangelist([{buf}]) List list of change list items
@@ -3204,7 +3205,8 @@ getbufinfo([{dict}])
getbufline({buf}, {lnum} [, {end}])
Return a |List| with the lines starting from {lnum} to {end}
(inclusive) in the buffer {buf}. If {end} is omitted, a
- |List| with only the line {lnum} is returned.
+ |List| with only the line {lnum} is returned. See
+ `getbufoneline()` for only getting the line.
For the use of {buf}, see |bufname()| above.
@@ -3227,6 +3229,11 @@ getbufline({buf}, {lnum} [, {end}])
< Can also be used as a |method|: >
GetBufnr()->getbufline(lnum)
+<
+ *getbufoneline()*
+getbufoneline({buf}, {lnum})
+ Just like `getbufline()` but only get one line and return it
+ as a string.
getbufvar({buf}, {varname} [, {def}]) *getbufvar()*
The result is the value of option or local buffer variable
@@ -3771,7 +3778,8 @@ getline({lnum} [, {end}])
< Can also be used as a |method|: >
ComputeLnum()->getline()
-< To get lines from another buffer see |getbufline()|
+< To get lines from another buffer see |getbufline()| and
+ |getbufoneline()|
getloclist({nr} [, {what}]) *getloclist()*
Returns a |List| with all the entries in the location list for
diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt
index 086081f72e..b6d98b9799 100644
--- a/runtime/doc/usr_41.txt
+++ b/runtime/doc/usr_41.txt
@@ -935,6 +935,7 @@ Working with text in the current buffer: *text-functions*
Working with text in another buffer:
getbufline() get a list of lines from the specified buffer
+ getbufoneline() get a one line from the specified buffer
setbufline() replace a line in the specified buffer
appendbufline() append a list of lines in the specified buffer
deletebufline() delete lines from a specified buffer