Properly take gutter borders and margins into account when sizing gutter markers

Issue #2836