]> git.lyx.org Git - features.git/commitdiff
Support protected and thin space in simple search (#12836)
authorJuergen Spitzmueller <spitz@lyx.org>
Mon, 17 Jul 2023 14:58:04 +0000 (16:58 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Mon, 17 Jul 2023 14:58:58 +0000 (16:58 +0200)
src/Paragraph.cpp
src/insets/InsetSpace.cpp

index 025acf157ef93c19442ed9e907ac037c820be796..d7fa35ef2ef526dff929cd0fe0ea3b779bbe6145 100644 (file)
@@ -4669,7 +4669,7 @@ int Paragraph::find(docstring const & str, bool cs, bool mw,
                        if (!inset->isLetter() && !inset->isChar())
                                break;
                        odocstringstream os;
-                       if (inset->lyxCode() == lyx::QUOTE_CODE) {
+                       if (inset->lyxCode() == lyx::QUOTE_CODE || inset->lyxCode() == lyx::SPACE_CODE) {
                                OutputParams op(0);
                                op.find_set_feature(OutputParams::SearchQuick);
                                inset->plaintext(os, op);
index a5b04648f506382f2d4899e038b76122eec81146..14db93fe55739fd8ec2d75c69e0d1dbf0b289c56 100644 (file)
@@ -703,7 +703,7 @@ void InsetSpace::latex(otexstream & os, OutputParams const & runparams) const
 
 
 int InsetSpace::plaintext(odocstringstream & os,
-        OutputParams const &, size_t) const
+        OutputParams const & rp, size_t) const
 {
        switch (params_.kind) {
        case InsetSpaceParams::HFILL:
@@ -747,7 +747,11 @@ int InsetSpace::plaintext(odocstringstream & os,
                os.put(0x2003);
                return 2;
        case InsetSpaceParams::THIN:
-               os.put(0x202f);
+               if (rp.find_effective())
+                       // simple search
+                       os << ' ';
+               else
+                       os.put(0x202f);
                return 1;
        case InsetSpaceParams::MEDIUM:
                os.put(0x200b); // ZERO WIDTH SPACE, makes the unbreakable medium space breakable
@@ -761,7 +765,11 @@ int InsetSpace::plaintext(odocstringstream & os,
                return 1;
        case InsetSpaceParams::PROTECTED:
        case InsetSpaceParams::CUSTOM_PROTECTED:
-               os.put(0x00a0);
+               if (rp.find_effective())
+                       // simple search
+                       os << ' ';
+               else
+                       os.put(0x00a0);
                return 1;
        case InsetSpaceParams::NEGTHIN:
        case InsetSpaceParams::NEGMEDIUM: