]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetSpace.cpp
Fix logic of new InsetFlex::updateBuffer() routine from a9614f1.
[lyx.git] / src / insets / InsetSpace.cpp
index c516b137ee8cb0ab312631de53f326e74e5e7317..03c9367b9acaaca31edd5bb066ec454d93d6b2fa 100644 (file)
@@ -621,7 +621,8 @@ void InsetSpace::latex(otexstream & os, OutputParams const & runparams) const
 }
 
 
-int InsetSpace::plaintext(odocstream & os, OutputParams const &) const
+int InsetSpace::plaintext(odocstringstream & os,
+        OutputParams const &, size_t) const
 {
        switch (params_.kind) {
        case InsetSpaceParams::HFILL:
@@ -646,9 +647,17 @@ int InsetSpace::plaintext(odocstream & os, OutputParams const &) const
        case InsetSpaceParams::DOWNBRACEFILL:
                os << "/-^-\\";
                return 5;
+       case InsetSpaceParams::VISIBLE:
+               os.put(0x2423);
+               return 1;
        case InsetSpaceParams::ENSKIP:
                os.put(0x2002);
                return 1;
+       case InsetSpaceParams::ENSPACE:
+               os.put(0x2060); // WORD JOINER, makes the breakable en space unbreakable
+               os.put(0x2002);
+               os.put(0x2060); // WORD JOINER, makes the breakable en space unbreakable
+               return 3;
        case InsetSpaceParams::QUAD:
                os.put(0x2003);
                return 1;
@@ -738,20 +747,27 @@ docstring InsetSpace::xhtml(XHTMLStream & xs, OutputParams const &) const
                output = " ";
                break;
        case InsetSpaceParams::ENSKIP:
-       case InsetSpaceParams::ENSPACE:
                output ="&ensp;";
                break;
+       case InsetSpaceParams::ENSPACE:
+               output ="&#x2060;&ensp;&#x2060;";
+               break;
        case InsetSpaceParams::QQUAD:
-               output ="&emsp;";
+               output ="&emsp;&emsp;";
+               break;
        case InsetSpaceParams::THICK:
+               output ="&#x2004;";
+               break;
        case InsetSpaceParams::QUAD:
                output ="&emsp;";
                break;
+       case InsetSpaceParams::MEDIUM:
+               output ="&#x2005;";
+               break;
        case InsetSpaceParams::THIN:
                output ="&thinsp;";
                break;
        case InsetSpaceParams::PROTECTED:
-       case InsetSpaceParams::MEDIUM:
        case InsetSpaceParams::NEGTHIN:
        case InsetSpaceParams::NEGMEDIUM:
        case InsetSpaceParams::NEGTHICK:
@@ -773,9 +789,13 @@ docstring InsetSpace::xhtml(XHTMLStream & xs, OutputParams const &) const
                // Can we do anything with those in HTML?
                break;
        case InsetSpaceParams::CUSTOM:
+               // FIXME XHTML
+               // Probably we could do some sort of blank span?
+               break;
        case InsetSpaceParams::CUSTOM_PROTECTED:
                // FIXME XHTML
                // Probably we could do some sort of blank span?
+               output ="&nbsp;";
                break;
        }
        // don't escape the entities!
@@ -794,7 +814,9 @@ void InsetSpace::validate(LaTeXFeatures & features) const
 
 void InsetSpace::toString(odocstream & os) const
 {
-       plaintext(os, OutputParams(0));
+       odocstringstream ods;
+       plaintext(ods, OutputParams(0));
+       os << ods.str();
 }
 
 
@@ -818,9 +840,9 @@ bool InsetSpace::isStretchableSpace() const
 }
 
 
-docstring InsetSpace::contextMenuName() const
+string InsetSpace::contextMenuName() const
 {
-       return from_ascii("context-space");
+       return "context-space";
 }
 
 
@@ -840,7 +862,8 @@ void InsetSpace::string2params(string const & in, InsetSpaceParams & params)
                params.math = true;
        else {
                params.math = false;
-               LASSERT(name == "space", /**/);
+               // we can try to read this even if the name is wrong
+               LATTEST(name == "space");
        }
 
        // There are cases, such as when we are called via getStatus() from