From 52fd21f90293c5c8f66df4871730d98f624121b0 Mon Sep 17 00:00:00 2001 From: Pavel Sanda Date: Wed, 10 May 2023 12:23:56 +0200 Subject: [PATCH] Handle stats for French guillemets --- src/insets/InsetQuotes.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/insets/InsetQuotes.cpp b/src/insets/InsetQuotes.cpp index 4c073da227..9896ec85a6 100644 --- a/src/insets/InsetQuotes.cpp +++ b/src/insets/InsetQuotes.cpp @@ -1024,8 +1024,25 @@ string InsetQuotes::contextMenuName() const pair InsetQuotes::isWords() const { - //one character from the statistics perspective - return std::pair(1, 0); + int length = 1; + // In PassThru, we use straight quotes otherwise we need to check for French + if (!pass_thru_) { + + QuoteStyle style = (style_ == QuoteStyle::Dynamic) ? global_style_ : style_; + + // in French, thin spaces are added inside double guillemets + if (prefixIs(context_lang_, "fr") + && level_ == QuoteLevel::Primary + && (style == QuoteStyle::Swiss + || style == QuoteStyle::French + || style == QuoteStyle::FrenchIN)) { + // space added by default for all formats + length++; + } + } + + //one or two characters from the statistics perspective + return std::pair(length, 0); } } // namespace lyx