Skip to content

Update textprop.{txt,jax} #976

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion doc/textprop.jax
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*textprop.txt* For Vim バージョン 8.2. Last change: 2021 May 26
*textprop.txt* For Vim バージョン 8.2. Last change: 2021 Aug 16


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

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

|method| としても使用できる: >
GetLnum()->prop_add(col, props)
<
*prop_add_list()*
prop_add_list({props}, [[{lnum}, {col}, {end-lnum}, {end-col}], ...])
prop_add() に似ているが、バッファ内の複数位置にテキストプロパ
ティが付加される。

{props}は次のフィールドを持つ辞書である:
bufnr プロパティを追加するバッファ。省略された場合、
カレントバッファが使用される
id プロパティのユーザー定義ID。数字でなければなら
ない。省略時は0が使われる
type テキストプロパティ名
"type" を除くすべてのフィールドは任意である。

第2引数はリストのリストで、各リストはテキストの開始と終了の位
置を示す。最初の2つの項目{lnum}と{col}はプロパティを付加する開
始位置を、最後の2つの項目{end-lnum}と{end-col}は付加される位置
の直後を示す。

例:
call prop_add_list(#{type: 'MyProp', id: 2},
\ [[1, 4, 1, 7],
\ [1, 15, 1, 20],
\ [2, 30, 3, 30]]

|method| としても使用できる: >
GetProp()->prop_add_list([[1, 1, 1, 2], [1, 4, 1, 8]])


prop_clear({lnum} [, {lnum-end} [, {props}]]) *prop_clear()*
Expand Down Expand Up @@ -207,6 +236,8 @@ prop_list({lnum} [, {props}]) *prop_list()*
id プロパティID
type プロパティタイプ名。タイプが削除された場合は省
略される
type_bufnr プロパティタイプが定義されたバッファ番号。
タイプがグローバルの場合は0を指定する
start TRUEの時はプロパティはこの行から始まる
end TRUEの時はプロパティはこの行で終わる

Expand Down
36 changes: 35 additions & 1 deletion en/textprop.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*textprop.txt* For Vim version 8.2. Last change: 2021 May 26
*textprop.txt* For Vim version 8.2. Last change: 2021 Aug 16


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

prop_add({lnum}, {col}, {props}) add a text property
prop_add_list({props}, [[{lnum}, {col}, {end-lnum}, {end-col}], ...])
add a text property at multiple
positions.
prop_clear({lnum} [, {lnum-end} [, {bufnr}]])
remove all text properties
prop_find({props} [, {direction}]) search for a text property
Expand Down Expand Up @@ -157,6 +160,35 @@ prop_add({lnum}, {col}, {props})

Can also be used as a |method|: >
GetLnum()->prop_add(col, props)
<
*prop_add_list()*
prop_add_list({props}, [[{lnum}, {col}, {end-lnum}, {end-col}], ...])
Similar to prop_add(), but attaches a text property at
multiple positions in a buffer.

{props} is a dictionary with these fields:
bufnr buffer to add the property to; when omitted
the current buffer is used
id user defined ID for the property; must be a
number; when omitted zero is used
type name of the text property type
All fields except "type" are optional.

The second argument is a List of Lists where each list
specifies the starting and ending position of the text. The
first two items {lnum} and {col} specify the starting position
of the text where the property will be attached and the last
two items {end-lnum} and {end-col} specify the position just
after the text.

Example:
call prop_add_list(#{type: 'MyProp', id: 2},
\ [[1, 4, 1, 7],
\ [1, 15, 1, 20],
\ [2, 30, 3, 30]]

Can also be used as a |method|: >
GetProp()->prop_add_list([[1, 1, 1, 2], [1, 4, 1, 8]])


prop_clear({lnum} [, {lnum-end} [, {props}]]) *prop_clear()*
Expand Down Expand Up @@ -211,6 +243,8 @@ prop_list({lnum} [, {props}]) *prop_list()*
id property ID
type name of the property type, omitted if
the type was deleted
type_bufnr buffer number for which this type was defined;
0 if the type is global
start when TRUE property starts in this line
end when TRUE property ends in this line

Expand Down