\(\frac{sinx+cosx-1}{sinx-cosx+1}=\frac{\left(sinx+cosx-1\right)\left(sinx-\left(cosx-1\right)\right)}{\left(sinx-cosx+1\right)^2}\)
\(=\frac{sin^2x-\left(cosx-1\right)^2}{sin^2x+cos^2x+1-2sinx.cosx+2sinx-2cosx}=\frac{sin^2x-cos^2x+2cosx-1}{2\left(1-cosx+sinx-sinx.cosx\right)}\)
\(=\frac{1-cos^2x-cos^2x+2cosx-1}{2\left(1-cosx\right)\left(1+sinx\right)}=\frac{cosx\left(1-cosx\right)}{\left(1-cosx\right)\left(1+sinx\right)}=\frac{cosx}{1+sinx}\)