I'm pretty sure it does wait for the idle state, and then look for the starting edge to begin
timing, so you might want to test this.

The library routine indicates this, and the manual also states; if the pulse edge
never happens or the width of the pulse is too great to measure
, Var is set to zero.

Code:
        call    STATECNT        ; Wait for idle state
        btfsc   STATUS, Z       ; If timeout then it's over
        goto    DONE
        call    STATECNT        ; Wait for starting edge
        btfsc   STATUS, Z       ; If timeout then it's over
        goto    DONE
        call    STATECNT        ; Do the count