Dear John,

thanks for the nice patch. I adapted it to 1.2.2cvs and made a slight
modification such that the vertical bar is also printed for vfills again
(like it was printed in the pre-patch era).

Attached please find the patch for 1.2.2cvs. I have also attached a
little demo file that I used when running valgrind to check that the
patch is sane.

IMHO the patch should find its way into both 1.2.2 and 1.3.0 - a little
bit more WYSIWYM, a little bit less WYSIWYG! Currently, it is really
difficult to detect a smallskip unless you grep the LyX file.

Have a nice weekend,

Michael

#LyX 1.2 created this file. For more info see http://www.lyx.org/
\lyxformat 220
\textclass article
\language english
\inputencoding auto
\fontscheme default
\graphics default
\paperfontsize default
\papersize Default
\paperpackage a4
\use_geometry 0
\use_amsmath 0
\use_natbib 0
\use_numerical_citations 0
\paperorientation portrait
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\defskip medskip
\quotes_language english
\quotes_times 2
\papercolumns 1
\papersides 1
\paperpagestyle default

\layout Standard

par1 (None below)
\layout Standard
\added_space_bottom defskip 
par2 (Defskip below)
\layout Standard
\added_space_bottom smallskip 
par3 (Smallskip below)
\layout Standard
\added_space_bottom medskip 
par4 (Medskip below)
\layout Standard
\added_space_bottom bigskip 
par5 (Bigskip below)
\layout Standard
\added_space_bottom vfill 
par6 (vfill below)
\layout Standard
\added_space_bottom -1in 
par7 (-1in below)
\layout Standard
\added_space_bottom 1in 
par8 (1in below)
\layout Standard
\added_space_top defskip 
par9 (defskip above)
\layout Standard
\added_space_top bigskip 
par10 (bigskip above)
\layout Standard

par11
\layout Standard
\added_space_top smallskip 
par12 (smallskip above)
\layout Standard

par13
\layout Standard

par14
\layout Standard

par15
\the_end

Index: lyx-devel/src/text.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/text.C,v
retrieving revision 1.248.2.4
diff -u -r1.248.2.4 text.C
--- lyx-devel/src/text.C        2002/08/21 10:29:20     1.248.2.4
+++ lyx-devel/src/text.C        2002/09/06 17:18:40
@@ -3248,13 +3248,12 @@
 
 int LyXText::getLengthMarkerHeight(BufferView * bv, VSpace const & vsp) const
 {
+       if (vsp.kind() == VSpace::NONE)
+               return 0;
+
        int const arrow_size = 4;
        int const space_size = int(vsp.inPixels(bv));
 
-       if (vsp.kind() != VSpace::LENGTH) {
-               return space_size;
-       }
-
        LyXFont font;
        font.decSize();
        int const min_size = max(3 * arrow_size,
@@ -3271,6 +3270,9 @@
 int LyXText::drawLengthMarker(DrawRowParams & p, string const & prefix,
                              VSpace const & vsp, int start)
 {
+       if (vsp.kind() == VSpace::NONE)
+               return 0;
+
        int const arrow_size = 4;
        int const size = getLengthMarkerHeight(p.bv, vsp);
        int const end = start + size;
@@ -3281,10 +3283,11 @@
        int ty1, ty2;
        // y-values for bottom arrow
        int by1, by2;
+
+       str = prefix + " (" + vsp.asLyXCommand() + ")";
+
        switch (vsp.kind()) {
-       case VSpace::LENGTH:
-       {
-               str = prefix + " (" + vsp.asLyXCommand() + ")";
+       case VSpace::LENGTH: {
                // adding or removing space
                bool const added = !(vsp.length().len().value() < 0.0);
                ty1 = added ? (start + arrow_size) : start;
@@ -3293,14 +3296,10 @@
                by2 = added ? end : (end - arrow_size);
                break;
        }
-       case VSpace:: VFILL:
-               str = prefix + " (vertical fill)";
+       default:
                ty1 = ty2 = start;
                by1 = by2 = end;
                break;
-       default:
-               // nothing to draw here
-               return size;
        }
 
        int const leftx = p.xo + leftMargin(p.bv, p.row);
@@ -3321,6 +3320,9 @@
                         str, font,
                         backgroundColor(),
                         backgroundColor());
+
+       if (vsp.kind() != VSpace::LENGTH && vsp.kind() != VSpace::VFILL )
+               return size;
 
        // top arrow
        p.pain->line(leftx, ty1, midx, ty2, LColor::added_space);

Reply via email to