Am Sat, 22 Jul 2023 19:36:06 -0400
schrieb Scott Kostyshak <skost...@lyx.org>:

> On Sat, Jul 22, 2023 at 05:30:16PM +0200, Kornel Benko wrote:
> > Am Sat, 22 Jul 2023 06:54:37 -0400
> > schrieb Scott Kostyshak <skost...@lyx.org>:
> >   
> > > On Sat, Jul 22, 2023 at 11:57:58AM +0200, Kornel Benko wrote:  
> > > > 
> > > > * Should we discard them
> > > > * Handle like white space
> > > > 
> > > > If using in findadv with selected 'Adhere to search string formatting 
> > > > of'
> > > > they are treated as ordinary non-word chars.
> > > > Without this option, the are discarded.
> > > > 
> > > > I am unsure, how to proceed. Using them as white spaces disables the 
> > > > specific
> > > > search for them.    
> > > 
> > > That's a tough one. I guess I would treat like positive space. Would that 
> > > make
> > > sense?
> > > 
> > > s.  
> > 
> > I don't feel so. What if one wants to find an occurrence of, say 
> > negthinspace, and
> > then the search stops at each white space? On big documents this may be 
> > annoying.  
> 
> I see, I don't have much intuition on the best approach.
> 
> Scott

I have a patch ready, so that neg*space chars are handled like white space iff 
no
formatted search is in effect.
I had to rename hasToString() to findUsesToString() because even that 
InsetSpace.cpp has
toString(), we need to call plaintext() in src/Paragraph.cpp

        Kornel
diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index d7fa35ef2e..466a091e70 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -4311,11 +4311,11 @@ docstring Paragraph::asString(pos_type beg, pos_type end, int options, const Out
 		    || (c == '\n' && (options & AS_STR_NEWLINES)))
 			os.put(c);
 		else if (c == META_INSET && (options & AS_STR_INSETS)) {
 			if (c == META_INSET && (options & AS_STR_PLAINTEXT)) {
 				LASSERT(runparams != nullptr, return docstring());
-				if (runparams->find_effective() && getInset(i)->hasToString())
+				if (runparams->find_effective() && getInset(i)->findUsesToString())
 					getInset(i)->toString(os);
 				else
 					getInset(i)->plaintext(os, *runparams);
 			} else if (c == META_INSET && (options & AS_STR_MATHED)
 				   && getInset(i)->lyxCode() == REF_CODE) {
diff --git a/src/insets/Inset.h b/src/insets/Inset.h
index 1b7adb5e89..6f3402c024 100644
--- a/src/insets/Inset.h
+++ b/src/insets/Inset.h
@@ -347,11 +347,11 @@ public:
 	/// normal stream, and which will in fact be written after the current
 	/// paragraph closes. this is appropriate e.g. for floats.
 	virtual docstring xhtml(XMLStream &, OutputParams const &) const;
 
 	/// 
-	virtual bool hasToString() const { return false; }
+	virtual bool findUsesToString() const { return false; }
 	/// Writes a string representation of the inset to the odocstream.
 	/// This one should be called when you want the whole contents of
 	/// the inset.
 	virtual void toString(odocstream &) const {}
 	/// Appends a potentially abbreviated version of the inset to
diff --git a/src/insets/InsetBranch.h b/src/insets/InsetBranch.h
index 16e5524e23..627e685661 100644
--- a/src/insets/InsetBranch.h
+++ b/src/insets/InsetBranch.h
@@ -78,11 +78,11 @@ private:
 	///
 	void docbook(XMLStream &, OutputParams const &) const override;
 	///
 	docstring xhtml(XMLStream &, OutputParams const &) const override;
 	///
-	bool hasToString() const override { return true; }
+	bool findUsesToString() const override { return true; }
 	///
 	void toString(odocstream &) const override;
 	///
 	void forOutliner(docstring &, size_t const, bool const) const override;
 	///
diff --git a/src/insets/InsetCitation.h b/src/insets/InsetCitation.h
index 56ad45a9b6..b1b27e0291 100644
--- a/src/insets/InsetCitation.h
+++ b/src/insets/InsetCitation.h
@@ -60,11 +60,11 @@ public:
 	///
 	void docbook(XMLStream &, OutputParams const &) const override;
 	///
 	docstring xhtml(XMLStream &, OutputParams const &) const override;
 	///
-	bool hasToString() const override { return true; }
+	bool findUsesToString() const override { return true; }
 	///
 	void toString(odocstream &) const override;
 	///
 	void forOutliner(docstring &, size_t const, bool const) const override;
 	///
diff --git a/src/insets/InsetCounter.h b/src/insets/InsetCounter.h
index eb6338dde2..65a38ab325 100644
--- a/src/insets/InsetCounter.h
+++ b/src/insets/InsetCounter.h
@@ -41,11 +41,11 @@ public:
 	///
 	void docbook(XMLStream &, OutputParams const &) const override;
 	///
 	docstring xhtml(XMLStream &, OutputParams const &) const override;
 	///
-	bool hasToString() const override { return true; }
+	bool findUsesToString() const override { return true; }
 	///
 	void toString(odocstream &) const override;
 	///
 	void validate(LaTeXFeatures & features) const override;
 	///
diff --git a/src/insets/InsetHyperlink.h b/src/insets/InsetHyperlink.h
index 59615b0d5b..36bd249902 100644
--- a/src/insets/InsetHyperlink.h
+++ b/src/insets/InsetHyperlink.h
@@ -32,11 +32,11 @@ public:
 	///
 	bool hasSettings() const override { return true; }
 	///
 	bool isInToc() const override { return true; }
 	///
-	bool hasToString() const override { return true; }
+	bool findUsesToString() const override { return true; }
 	///
 	void toString(odocstream &) const override;
 	///
 	void forOutliner(docstring &, size_t const, bool const) const override;
 	///
diff --git a/src/insets/InsetIPAMacro.h b/src/insets/InsetIPAMacro.h
index 5855da9e95..dc1977f977 100644
--- a/src/insets/InsetIPAMacro.h
+++ b/src/insets/InsetIPAMacro.h
@@ -152,11 +152,11 @@ public:
 	///
 	void docbook(XMLStream &, OutputParams const &) const override;
 	///
 	docstring xhtml(XMLStream &, OutputParams const &) const override;
 	///
-	bool hasToString() const override { return true; }
+	bool findUsesToString() const override { return true; }
 	///
 	void toString(odocstream &) const override;
 	///
 	void forOutliner(docstring &, size_t const, bool const) const override;
 	///
diff --git a/src/insets/InsetQuotes.h b/src/insets/InsetQuotes.h
index 41bad175b8..fb5f2cf6e7 100644
--- a/src/insets/InsetQuotes.h
+++ b/src/insets/InsetQuotes.h
@@ -153,11 +153,11 @@ public:
 	void docbook(XMLStream &, OutputParams const &) const override;
 	///
 	docstring xhtml(XMLStream &, OutputParams const &) const override;
 
 	///
-	bool hasToString() const override { return true; }
+	bool findUsesToString() const override { return true; }
 	///
 	void toString(odocstream &) const override;
 	///
 	void forOutliner(docstring &, size_t const maxlen, bool const) const override;
 
diff --git a/src/insets/InsetRef.h b/src/insets/InsetRef.h
index 6286652f4d..4685aa0699 100644
--- a/src/insets/InsetRef.h
+++ b/src/insets/InsetRef.h
@@ -63,11 +63,11 @@ public:
 	///
 	void docbook(XMLStream &, OutputParams const &) const override;
 	///
 	docstring xhtml(XMLStream &, OutputParams const &) const override;
 	///
-	bool hasToString() const override { return true; }
+	bool findUsesToString() const override { return true; }
 	///
 	void toString(odocstream &) const override;
 	///
 	void forOutliner(docstring &, size_t const, bool const) const override;
 	///
diff --git a/src/insets/InsetSpace.cpp b/src/insets/InsetSpace.cpp
index 0e0b9b6aac..f587ddeb11 100644
--- a/src/insets/InsetSpace.cpp
+++ b/src/insets/InsetSpace.cpp
@@ -772,11 +772,16 @@ int InsetSpace::plaintext(odocstringstream & os,
 			os.put(0x00a0);
 		return 1;
 	case InsetSpaceParams::NEGTHIN:
 	case InsetSpaceParams::NEGMEDIUM:
 	case InsetSpaceParams::NEGTHICK:
-		return 0;
+		if (rp.find_effective()) {
+			os << ' ';
+			return 1;
+		}
+		else
+			return 0;
 	default:
 		os << ' ';
 		return 1;
 	}
 }
diff --git a/src/insets/InsetSpace.h b/src/insets/InsetSpace.h
index 0b1bd7bfe5..ceca1cfa06 100644
--- a/src/insets/InsetSpace.h
+++ b/src/insets/InsetSpace.h
@@ -134,11 +134,11 @@ public:
 	///
 	docstring xhtml(XMLStream &, OutputParams const &) const override;
 	///
 	void validate(LaTeXFeatures & features) const override;
 	///
-	bool hasToString() const override { return true; }
+	bool findUsesToString() const override { return false; }
 	///
 	void toString(odocstream &) const override;
 	///
 	void forOutliner(docstring &, size_t const, bool const) const override;
 	///
diff --git a/src/insets/InsetSpecialChar.h b/src/insets/InsetSpecialChar.h
index 36afa15fed..5f7338b8dd 100644
--- a/src/insets/InsetSpecialChar.h
+++ b/src/insets/InsetSpecialChar.h
@@ -80,11 +80,11 @@ public:
 	///
 	void docbook(XMLStream &, OutputParams const &) const override;
 	///
 	docstring xhtml(XMLStream &, OutputParams const &) const override;
 	///
-	bool hasToString() const override { return true; }
+	bool findUsesToString() const override { return true; }
 	///
 	void toString(odocstream &) const override;
 	///
 	bool isInToc() const override { return true; }
 	///
diff --git a/src/insets/InsetText.h b/src/insets/InsetText.h
index e271478114..bce125bcca 100644
--- a/src/insets/InsetText.h
+++ b/src/insets/InsetText.h
@@ -178,11 +178,11 @@ public:
 	/// Update the counters of this inset and of its contents
 	void updateBuffer(ParIterator const &, UpdateType, bool const deleted = false) override;
 	///
 	void setMacrocontextPositionRecursive(DocIterator const & pos);
 	///
-	bool hasToString() const override { return true; }
+	bool findUsesToString() const override { return true; }
 	///
 	void toString(odocstream &) const override;
 	///
 	void forOutliner(docstring &, size_t const, bool const) const override;
 	///

Attachment: pgpIK1hFLbQmy.pgp
Description: Digitale Signatur von OpenPGP

-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to