Mercurial > vim
comparison runtime/doc/textprop.txt @ 26242:685206b54ecf v8.2.3652
patch 8.2.3652: can only get text properties one line at a time
Commit: https://github.com/vim/vim/commit/e021662f39b38ef7cf27e13850d0ce6890e48376
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Tue Nov 23 11:46:32 2021 +0000
patch 8.2.3652: can only get text properties one line at a time
Problem: Can only get text properties one line at a time.
Solution: Add options to prop_list() to use a range of lines and filter by
types. (Yegappan Lakshmanan, closes #9138)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 23 Nov 2021 13:00:05 +0100 |
parents | 42723b535ab3 |
children | f8116058ca76 |
comparison
equal
deleted
inserted
replaced
26241:ae5abfa1efc8 | 26242:685206b54ecf |
---|---|
1 *textprop.txt* For Vim version 8.2. Last change: 2021 Aug 16 | 1 *textprop.txt* For Vim version 8.2. Last change: 2021 Nov 23 |
2 | 2 |
3 | 3 |
4 VIM REFERENCE MANUAL by Bram Moolenaar | 4 VIM REFERENCE MANUAL by Bram Moolenaar |
5 | 5 |
6 | 6 |
228 as with prop_list(), and additionally an "lnum" entry. | 228 as with prop_list(), and additionally an "lnum" entry. |
229 If no match is found then an empty Dict is returned. | 229 If no match is found then an empty Dict is returned. |
230 | 230 |
231 | 231 |
232 prop_list({lnum} [, {props}]) *prop_list()* | 232 prop_list({lnum} [, {props}]) *prop_list()* |
233 Return a List with all text properties in line {lnum}. | 233 Returns a List with all the text properties in line {lnum}. |
234 | 234 |
235 When {props} contains a "bufnr" item, use this buffer instead | 235 The following optional items are supported in {props}: |
236 of the current buffer. | 236 bufnr use this buffer instead of the current buffer |
237 end_lnum return text properties in all the lines | |
238 between {lnum} and {end_lnum} (inclusive). | |
239 A negative value is used as an offset from the | |
240 last buffer line; -1 refers to the last buffer | |
241 line. | |
242 types List of property type names. Return only text | |
243 properties that match one of the type names. | |
244 ids List of property identifiers. Return only text | |
245 properties with one of these identifiers. | |
237 | 246 |
238 The properties are ordered by starting column and priority. | 247 The properties are ordered by starting column and priority. |
239 Each property is a Dict with these entries: | 248 Each property is a Dict with these entries: |
249 lnum starting line number. Present only when | |
250 returning text properties between {lnum} and | |
251 {end_lnum}. | |
240 col starting column | 252 col starting column |
241 length length in bytes, one more if line break is | 253 length length in bytes, one more if line break is |
242 included | 254 included |
243 id property ID | 255 id property ID |
244 type name of the property type, omitted if | 256 type name of the property type, omitted if |
250 | 262 |
251 When "start" is zero the property started in a previous line, | 263 When "start" is zero the property started in a previous line, |
252 the current one is a continuation. | 264 the current one is a continuation. |
253 When "end" is zero the property continues in the next line. | 265 When "end" is zero the property continues in the next line. |
254 The line break after this line is included. | 266 The line break after this line is included. |
267 | |
268 Returns an empty list on error. | |
269 | |
270 Examples: | |
271 " get text properties placed in line 5 | |
272 echo prop_list(5) | |
273 " get text properties placed in line 20 in buffer 4 | |
274 echo prop_list(20, {'bufnr': 4}) | |
275 " get all the text properties between line 1 and 20 | |
276 echo prop_list(1, {'end_lnum': 20}) | |
277 " get all the text properties of type 'myprop' | |
278 echo prop_list(1, {'types': ['myprop'], | |
279 \ 'end_lnum': -1}) | |
280 " get all the text properties of type 'prop1' or 'prop2' | |
281 echo prop_list(1, {'types': ['prop1', 'prop2'], | |
282 \ 'end_lnum': -1}) | |
283 " get all the text properties with ID 8 | |
284 echo prop_list(1, {'ids': [8], 'end_lnum': line('$')}) | |
285 " get all the text properties with ID 10 and 20 | |
286 echo prop_list(1, {'ids': [10, 20], 'end_lnum': -1}) | |
287 " get text properties with type 'myprop' and ID 100 | |
288 " in buffer 4. | |
289 echo prop_list(1, {'bufnr': 4, 'types': ['myprop'], | |
290 \ 'ids': [100], 'end_lnum': -1}) | |
255 | 291 |
256 Can also be used as a |method|: > | 292 Can also be used as a |method|: > |
257 GetLnum()->prop_list() | 293 GetLnum()->prop_list() |
258 < | 294 < |
259 *prop_remove()* *E968* *E860* | 295 *prop_remove()* *E968* *E860* |