Skip to content

Commit 8995db4

Browse files
authored
Merge pull request #976 from kuuote/20211120-textprop
Update textprop.{txt,jax}
2 parents 2dc7778 + 3c7009b commit 8995db4

File tree

2 files changed

+67
-2
lines changed

2 files changed

+67
-2
lines changed

doc/textprop.jax

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*textprop.txt* For Vim バージョン 8.2. Last change: 2021 May 26
1+
*textprop.txt* For Vim バージョン 8.2. Last change: 2021 Aug 16
22

33

44
VIMリファレンスマニュアル by Bram Moolenaar
@@ -108,6 +108,8 @@ prop_type_list([{props}]) プロパティタイプ一覧を取得
108108
テキストプロパティの操作:
109109

110110
prop_add({lnum}, {col}, {props}) テキストプロパティを追加
111+
prop_add_list({props}, [[{lnum}, {col}, {end-lnum}, {end-col}], ...])
112+
複数位置にテキストプロパティを追加
111113
prop_clear({lnum} [, {lnum-end} [, {bufnr}]])
112114
全てのテキストプロパティを削除
113115
prop_find({props} [, {direction}]) テキストプロパティを検索
@@ -157,6 +159,33 @@ prop_add({lnum}, {col}, {props})
157159

158160
|method| としても使用できる: >
159161
GetLnum()->prop_add(col, props)
162+
<
163+
*prop_add_list()*
164+
prop_add_list({props}, [[{lnum}, {col}, {end-lnum}, {end-col}], ...])
165+
prop_add() に似ているが、バッファ内の複数位置にテキストプロパ
166+
ティが付加される。
167+
168+
{props}は次のフィールドを持つ辞書である:
169+
bufnr プロパティを追加するバッファ。省略された場合、
170+
カレントバッファが使用される
171+
id プロパティのユーザー定義ID。数字でなければなら
172+
ない。省略時は0が使われる
173+
type テキストプロパティ名
174+
"type" を除くすべてのフィールドは任意である。
175+
176+
第2引数はリストのリストで、各リストはテキストの開始と終了の位
177+
置を示す。最初の2つの項目{lnum}{col}はプロパティを付加する開
178+
始位置を、最後の2つの項目{end-lnum}{end-col}は付加される位置
179+
の直後を示す。
180+
181+
例:
182+
call prop_add_list(#{type: 'MyProp', id: 2},
183+
\ [[1, 4, 1, 7],
184+
\ [1, 15, 1, 20],
185+
\ [2, 30, 3, 30]]
186+
187+
|method| としても使用できる: >
188+
GetProp()->prop_add_list([[1, 1, 1, 2], [1, 4, 1, 8]])
160189
161190
162191
prop_clear({lnum} [, {lnum-end} [, {props}]]) *prop_clear()*
@@ -207,6 +236,8 @@ prop_list({lnum} [, {props}]) *prop_list()*
207236
id プロパティID
208237
type プロパティタイプ名。タイプが削除された場合は省
209238
略される
239+
type_bufnr プロパティタイプが定義されたバッファ番号。
240+
タイプがグローバルの場合は0を指定する
210241
start TRUEの時はプロパティはこの行から始まる
211242
end TRUEの時はプロパティはこの行で終わる
212243

en/textprop.txt

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*textprop.txt* For Vim version 8.2. Last change: 2021 May 26
1+
*textprop.txt* For Vim version 8.2. Last change: 2021 Aug 16
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -108,6 +108,9 @@ prop_type_list([{props}]) get list of property types
108108
Manipulating text properties:
109109

110110
prop_add({lnum}, {col}, {props}) add a text property
111+
prop_add_list({props}, [[{lnum}, {col}, {end-lnum}, {end-col}], ...])
112+
add a text property at multiple
113+
positions.
111114
prop_clear({lnum} [, {lnum-end} [, {bufnr}]])
112115
remove all text properties
113116
prop_find({props} [, {direction}]) search for a text property
@@ -157,6 +160,35 @@ prop_add({lnum}, {col}, {props})
157160

158161
Can also be used as a |method|: >
159162
GetLnum()->prop_add(col, props)
163+
<
164+
*prop_add_list()*
165+
prop_add_list({props}, [[{lnum}, {col}, {end-lnum}, {end-col}], ...])
166+
Similar to prop_add(), but attaches a text property at
167+
multiple positions in a buffer.
168+
169+
{props} is a dictionary with these fields:
170+
bufnr buffer to add the property to; when omitted
171+
the current buffer is used
172+
id user defined ID for the property; must be a
173+
number; when omitted zero is used
174+
type name of the text property type
175+
All fields except "type" are optional.
176+
177+
The second argument is a List of Lists where each list
178+
specifies the starting and ending position of the text. The
179+
first two items {lnum} and {col} specify the starting position
180+
of the text where the property will be attached and the last
181+
two items {end-lnum} and {end-col} specify the position just
182+
after the text.
183+
184+
Example:
185+
call prop_add_list(#{type: 'MyProp', id: 2},
186+
\ [[1, 4, 1, 7],
187+
\ [1, 15, 1, 20],
188+
\ [2, 30, 3, 30]]
189+
190+
Can also be used as a |method|: >
191+
GetProp()->prop_add_list([[1, 1, 1, 2], [1, 4, 1, 8]])
160192
161193
162194
prop_clear({lnum} [, {lnum-end} [, {props}]]) *prop_clear()*
@@ -211,6 +243,8 @@ prop_list({lnum} [, {props}]) *prop_list()*
211243
id property ID
212244
type name of the property type, omitted if
213245
the type was deleted
246+
type_bufnr buffer number for which this type was defined;
247+
0 if the type is global
214248
start when TRUE property starts in this line
215249
end when TRUE property ends in this line
216250

0 commit comments

Comments
 (0)