@@ -623,7 +623,8 @@ f_prop_find(typval_T *argvars, typval_T *rettv)
623623 int lnum_start ;
624624 int start_pos_has_prop = 0 ;
625625 int seen_end = 0 ;
626- int id = -1 ;
626+ int id = 0 ;
627+ int id_found = FALSE;
627628 int type_id = -1 ;
628629 int skipstart = 0 ;
629630 int lnum = -1 ;
@@ -688,8 +689,7 @@ f_prop_find(typval_T *argvars, typval_T *rettv)
688689 if (dict_find (dict , (char_u * )"id" , -1 ) != NULL )
689690 {
690691 id = dict_get_number (dict , (char_u * )"id" );
691- if (id == -1 )
692- id = -2 ;
692+ id_found = id != 0 ;
693693 }
694694 if (dict_find (dict , (char_u * )"type" , -1 ))
695695 {
@@ -701,12 +701,12 @@ f_prop_find(typval_T *argvars, typval_T *rettv)
701701 type_id = type -> pt_id ;
702702 }
703703 both = dict_get_bool (dict , (char_u * )"both" , FALSE);
704- if (id == -1 && type_id == -1 )
704+ if (! id_found && type_id == -1 )
705705 {
706706 emsg (_ ("E968: Need at least one of 'id' or 'type'" ));
707707 return ;
708708 }
709- if (both && (id == -1 || type_id == -1 ))
709+ if (both && (! id_found || type_id == -1 ))
710710 {
711711 emsg (_ ("E860: Need 'id' and 'type' with 'both'" ));
712712 return ;
@@ -744,7 +744,8 @@ f_prop_find(typval_T *argvars, typval_T *rettv)
744744 continue ;
745745 }
746746 if (both ? prop .tp_id == id && prop .tp_type == type_id
747- : prop .tp_id == id || prop .tp_type == type_id )
747+ : (id_found && prop .tp_id == id )
748+ || prop .tp_type == type_id )
748749 {
749750 // Check if the starting position has text props.
750751 if (lnum_start == lnum
0 commit comments