From 73f76e00128c7908b3584b4de50b9d207d716198 Mon Sep 17 00:00:00 2001 From: Hirohito Higashi Date: Tue, 22 Sep 2026 23:17:48 +0900 Subject: [PATCH] Update builtin.{txt,jax} --- doc/builtin.jax | 25 ++++++++++++++++++++++++- en/builtin.txt | 27 ++++++++++++++++++++++++++- 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/doc/builtin.jax b/doc/builtin.jax index da8050f81..448d8db86 100644 --- a/doc/builtin.jax +++ b/doc/builtin.jax @@ -1,4 +1,4 @@ -*builtin.txt* For Vim バージョン 9.2. Last change: 2026 Sep 13 +*builtin.txt* For Vim バージョン 9.2. Last change: 2026 Sep 14 VIM リファレンスマニュアル by Bram Moolenaar @@ -5195,6 +5195,29 @@ getregionpos({pos1}, {pos2} [, {opts}]) *getregionpos()* 対して "col" 値 0 が使用される。 (デフォルト: |FALSE|) + bounds |TRUE| の場合、領域の外側の境界のみを + 単一のペアとして返す: > + [[{start_pos}, {end_pos}]] +< {start_pos} は領域の最初の行における開 + 始位置、{end_pos} は最後の行における終 + 了位置である。その間の行は処理の対象と + ならないため、大きな領域を扱う場合には + るかに高速に動作する。 + (デフォルト: |FALSE|) + + 同じ {opts} を指定して "bounds" を使用することは、完全な結果の + 外側の位置を取得することと同等である: > + let full = getregionpos(pos1, pos2, opts) + let bounds = [[full[0][0], full[-1][1]]] +< 例えば {pos1} と {pos2} が異なるバッファにある場合など、完全な + 結果が空であるとき、結果も同様に空となる。 + Note これら 2 つの位置は異なる行に属するため、領域の形状そのも + のではなく、その領域の対角線を表すことになる点に注意。ブロック + 単位の領域の場合、これらはブロックの隅ではなく、最初の行の開始 + 位置と最後の行の終了位置となる。同様に、最初の行が空で "eol" + が |FALSE| の場合、{start_pos} の "col" は 0 になるが、 + {end_pos} は必ずしもそうとは限らない。 + |method| としても使用できる: > getpos('.')->getregionpos(getpos("'a")) < diff --git a/en/builtin.txt b/en/builtin.txt index 0d7110385..c72a7f2ba 100644 --- a/en/builtin.txt +++ b/en/builtin.txt @@ -1,4 +1,4 @@ -*builtin.txt* For Vim version 9.2. Last change: 2026 Sep 13 +*builtin.txt* For Vim version 9.2. Last change: 2026 Sep 14 VIM REFERENCE MANUAL by Bram Moolenaar @@ -5260,6 +5260,31 @@ getregionpos({pos1}, {pos2} [, {opts}]) *getregionpos()* value of 0 is used for both positions. (default: |FALSE|) + bounds If |TRUE|, return only the outer + bounds of the region as a single + pair: > + [[{start_pos}, {end_pos}]] +< {start_pos} is the start position on + the first line of the region and + {end_pos} the end position on its + last line. The lines in between are + not visited, which is much faster for + a large region. + (default: |FALSE|) + + Using "bounds" with the same {opts} is equivalent to taking + the outer positions of the full result: > + let full = getregionpos(pos1, pos2, opts) + let bounds = [[full[0][0], full[-1][1]]] +< When the full result is empty, e.g. because {pos1} and {pos2} + are in different buffers, the result is empty as well. + Note that the two positions then come from different lines, so + they describe a diagonal of the region and not its shape. For + a blockwise region they are the start of the first line and + the end of the last line, not the corners of the block. + Likewise, when the first line is empty and "eol" is |FALSE|, + {start_pos} has a "col" of 0 while {end_pos} may not. + Can also be used as a |method|: > getpos('.')->getregionpos(getpos("'a")) <