patch 8.2.0372: prop_find() may not find text property at start of the line

Problem:    Prop_find() may not find text property at start of the line.
Solution:   Adjust the loop to find properties. (Axel Forsman, closes #5761,
            closes #5663)
diff --git a/src/textprop.c b/src/textprop.c
index 2827af4..4f5329e 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -663,24 +663,22 @@
 	    mch_memmove(&prop, text + textlen + i * sizeof(textprop_T),
 			    sizeof(textprop_T));
 
+	    if (dir < 0)
+	    {
+		if (col < prop.tp_col)
+		    break;
+	    }
+	    else if (prop.tp_col + prop.tp_len - (prop.tp_len != 0) < col)
+		continue;
+
 	    if (prop.tp_id == id || prop.tp_type == type_id)
 	    {
 		// Check if the starting position has text props.
-		if (lnum_start == lnum)
-		{
-		    if (col >= prop.tp_col
-				       && (col <= prop.tp_col + prop.tp_len-1))
-			start_pos_has_prop = 1;
-		}
-		else
-		{
-		    // Not at the first line of the search so adjust col to
-		    // indicate that we're continuing from prev/next line.
-		    if (dir < 0)
-			col = buf->b_ml.ml_line_len;
-		    else
-			col = 1;
-		}
+		if (lnum_start == lnum
+			&& col >= prop.tp_col
+			&& (col <= prop.tp_col + prop.tp_len
+							 - (prop.tp_len != 0)))
+		    start_pos_has_prop = 1;
 
 		prop_start = !(prop.tp_flags & TP_FLAG_CONT_PREV);
 		prop_end = !(prop.tp_flags & TP_FLAG_CONT_NEXT);
@@ -705,17 +703,6 @@
 		    break;
 		}
 
-		if (dir < 0)
-		{
-		    if (col < prop.tp_col)
-			break;
-		}
-		else
-		{
-		    if (col > prop.tp_col + prop.tp_len-1)
-			break;
-		}
-
 		prop_fill_dict(rettv->vval.v_dict, &prop, buf);
 		dict_add_number(rettv->vval.v_dict, "lnum", lnum);
 
@@ -735,6 +722,8 @@
 		break;
 	    lnum--;
 	}
+	// Adjust col to indicate that we're continuing from prev/next line.
+	col = dir < 0 ? buf->b_ml.ml_line_len : 1;
     }
 }