Fix a bug in addLineWidget.

Fixed clipping of the insertAt index.