Fix bug in patching lines with widgets

The gutter element would end up before any 'above' widgets, causing
the widgets to hide it.

Closes #1971