[LyX/master] Use a static map so we don't have to reinitialize every time.

Richard Kimberly Heck rikiheck at lyx.org
Tue Feb 2 22:28:38 UTC 2021


commit 7b6db55f280fa06455a11cf20a4f2ad2aad1ec1f
Author: Richard Kimberly Heck <rikiheck at lyx.org>
Date:   Tue Feb 2 17:30:57 2021 -0500

    Use a static map so we don't have to reinitialize every time.
---
 src/Text.cpp |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/Text.cpp b/src/Text.cpp
index b00f10d..98d19df 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -859,11 +859,12 @@ void Text::insertStringAsLines(Cursor & cur, docstring const & str,
 	pos_type pos = cur.pos();
 
 	// The special chars we handle
-	map<wchar_t, InsetSpecialChar::Kind> specialchars;
-	specialchars[0x200c] = InsetSpecialChar::LIGATURE_BREAK;
-	specialchars[0x200b] = InsetSpecialChar::ALLOWBREAK;
-	specialchars[0x2026] = InsetSpecialChar::LDOTS;
-	specialchars[0x2011] = InsetSpecialChar::NOBREAKDASH;
+	static map<wchar_t, InsetSpecialChar::Kind> specialchars = {
+		{ 0x200c, InsetSpecialChar::LIGATURE_BREAK },
+		{ 0x200b, InsetSpecialChar::ALLOWBREAK },
+		{ 0x2026, InsetSpecialChar::LDOTS },
+		{ 0x2011, InsetSpecialChar::NOBREAKDASH }
+	};
 
 	// insert the string, don't insert doublespace
 	bool space_inserted = true;


More information about the lyx-cvs mailing list