4141 '^(?:silent! )bwipeout!? (?P<buffer_number>[0-9]+)$' )
4242GETBUFVAR_REGEX = re .compile (
4343 '^getbufvar\\ ((?P<buffer_number>[0-9]+), "(?P<option>.+)"\\ )( \\ ?\\ ? 0)?$' )
44+ PROP_LIST_REGEX = re .compile (
45+ '^prop_list\\ ( ' # A literal at the start
46+ '(?P<lnum>\\ d+), ' # Start line
47+ '{ "bufnr": (?P<bufnr>\\ d+), ' # Corresponding buffer number
48+ '"end_lnum": (?P<end_lnum>[0-9-]+), ' # End line, can be negative.
49+ '"types": (?P<prop_types>\\ [.+\\ ]) } ' # Property types
50+ '\\ )$' )
4451PROP_ADD_REGEX = re .compile (
4552 '^prop_add\\ ( ' # A literal at the start
4653 '(?P<start_line>\\ d+), ' # First argument - number
@@ -249,14 +256,16 @@ def _MockVimFunctionsEval( value ):
249256
250257
251258def _MockVimPropEval ( value ):
252- match = re .match ( 'prop_list\\ ( (?P<lnum>\\ d+), '
253- '{ "bufnr": (?P<bufnr>\\ d+) } \\ )' , value )
254- if match :
255- return [ p for p in VIM_PROPS_FOR_BUFFER [ int ( match .group ( 'bufnr' ) ) ]
256- if p .start_line == int ( match .group ( 'lnum' ) ) ]
257-
258- match = PROP_ADD_REGEX .search ( value )
259- if match :
259+ if match := PROP_LIST_REGEX .search ( value ):
260+ if int ( match .group ( 'end_lnum' ) ) == - 1 :
261+ return [ p for p in VIM_PROPS_FOR_BUFFER [ int ( match .group ( 'bufnr' ) ) ]
262+ if p .start_line >= int ( match .group ( 'lnum' ) ) ]
263+ else :
264+ return [ p for p in VIM_PROPS_FOR_BUFFER [ int ( match .group ( 'bufnr' ) ) ]
265+ if int ( match .group ( 'end_lnum' ) ) >= p .start_line and
266+ p .start_line >= int ( match .group ( 'lnum' ) ) ]
267+
268+ if match := PROP_ADD_REGEX .search ( value ):
260269 prop_start_line = int ( match .group ( 'start_line' ) )
261270 prop_start_column = int ( match .group ( 'start_column' ) )
262271 import ast
@@ -265,14 +274,13 @@ def _MockVimPropEval( value ):
265274 opts [ 'type' ],
266275 prop_start_line ,
267276 prop_start_column ,
268- int ( opts [ 'end_lnum' ] ) if opts [ 'end_lnum' ] else prop_start_line ,
269- int ( opts [ 'end_col' ] ) if opts [ 'end_col' ] else prop_start_column
277+ int ( opts [ 'end_lnum' ] ),
278+ int ( opts [ 'end_col' ] )
270279 )
271280 VIM_PROPS_FOR_BUFFER [ int ( opts [ 'bufnr' ] ) ].append ( vim_prop )
272281 return vim_prop .id
273282
274- match = PROP_REMOVE_REGEX .search ( value )
275- if match :
283+ if match := PROP_REMOVE_REGEX .search ( value ):
276284 prop , lin_num = eval ( match .group ( 'prop' ) )
277285 vim_props = VIM_PROPS_FOR_BUFFER [ prop [ 'bufnr' ] ]
278286 for index , vim_prop in enumerate ( vim_props ):
@@ -577,8 +585,8 @@ def __init__( self,
577585 prop_type ,
578586 start_line ,
579587 start_column ,
580- end_line = None ,
581- end_column = None ):
588+ end_line ,
589+ end_column ):
582590 current_buffer = VIM_MOCK .current .buffer .number
583591 self .id = len ( VIM_PROPS_FOR_BUFFER [ current_buffer ] ) + 1
584592 self .prop_type = prop_type
@@ -613,6 +621,8 @@ def __getitem__( self, key ):
613621 return self .start_column
614622 elif key == 'length' :
615623 return self .end_column - self .start_column
624+ elif key == 'lnum' :
625+ return self .start_line
616626
617627
618628 def get ( self , key , default = None ):
0 commit comments