Crop and extend line methods in Line class

This is resubmission of pull request #464.

Fixed bug. Now tests passed.