Fix bug in addLineWidget.

Fixed clipping of the insertAt index.