+
+int LyXText::getLengthMarkerHeight(BufferView * bv, VSpace const & vsp) const
+{
+ if (vsp.kind() != VSpace::LENGTH) {
+ return int(vsp.inPixels(bv));
+ }
+
+ int const space_size = int(vsp.inPixels(bv));
+ int const arrow_size = 10;
+
+ LyXFont font;
+ font.decSize();
+ int const min_size = 2 * arrow_size + 10
+ + lyxfont::maxAscent(font)
+ + lyxfont::maxDescent(font);
+
+ return std::max(min_size, space_size);
+}
+
+
+int LyXText::drawLengthMarker(DrawRowParams & p, string const & prefix,
+ VSpace const & vsp, int start)
+{
+ string const str(prefix
+ + " (" + vsp.asLyXCommand() + ")");
+
+ int const arrow_size = 10;
+
+ int const size = getLengthMarkerHeight(p.bv, vsp);
+
+ // first the string
+ int w = 0;
+ int a = 0;
+ int d = 0;
+
+ LyXFont font;
+ font.setColor(LColor::added_space).decSize();
+ lyxfont::rectText(str, font, w, a, d);
+
+ int const end = start + size;
+
+ p.pain->rectText(p.xo + 2 * arrow_size + 5,
+ start + ((end - start) / 2) + d,
+ str, font,
+ backgroundColor(),
+ backgroundColor());
+
+ // adding or removing space
+ bool const added = !(vsp.length().len().value() < 0.0);
+
+ int const leftx = p.xo;
+ int const midx = leftx + arrow_size;
+ int const rightx = midx + arrow_size;
+
+ // top arrow
+ int const ty1 = added ? (start + arrow_size) : start;
+ int const ty2 = added ? start : (start + arrow_size);
+
+ p.pain->line(leftx, ty1, midx, ty2, LColor::added_space);
+ p.pain->line(midx, ty2, rightx, ty1, LColor::added_space);
+
+ // bottom arrow
+ int const by1 = added ? (end - arrow_size) : end;
+ int const by2 = added ? end : (end - arrow_size);
+
+ p.pain->line(leftx, by1, midx, by2, LColor::added_space);
+ p.pain->line(midx, by2, rightx, by1, LColor::added_space);
+
+ // joining line
+ p.pain->line(midx, ty2, midx, by2, LColor::added_space);
+
+ return size;
+}
+