From 5d7d553bb5faa7ddb89b89422b960897780319b7 Mon Sep 17 00:00:00 2001 From: Abs62 Date: Thu, 22 Oct 2020 18:32:55 +0300 Subject: [PATCH] Dsl: Fix displayed headword selection for the case of ignore diacritic --- dsl.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dsl.cc b/dsl.cc index 0c3bb031..640e077f 100644 --- a/dsl.cc +++ b/dsl.cc @@ -263,6 +263,7 @@ private: /// Loads the article. Does not process the DSL language. void loadArticle( uint32_t address, wstring const & requestedHeadwordFolded, + bool ignoreDiacritics, wstring & tildeValue, wstring & displayedHeadword, unsigned & headwordIndex, @@ -536,6 +537,7 @@ bool isDslWs( wchar ch ) void DslDictionary::loadArticle( uint32_t address, wstring const & requestedHeadwordFolded, + bool ignoreDiacritics, wstring & tildeValue, wstring & displayedHeadword, unsigned & headwordIndex, @@ -680,7 +682,13 @@ void DslDictionary::loadArticle( uint32_t address, unescapeDsl( *i ); normalizeHeadword( *i ); - if ( Folding::trimWhitespace( *i ) == requestedHeadwordFolded ) + bool found; + if( ignoreDiacritics ) + found = Folding::applyDiacriticsOnly( Folding::trimWhitespace( *i ) ) == Folding::applyDiacriticsOnly( requestedHeadwordFolded ); + else + found = Folding::trimWhitespace( *i ) == requestedHeadwordFolded; + + if ( found ) { // Found it. Now we should make a displayed headword for it. if ( hadFirstHeadword ) @@ -1707,7 +1715,7 @@ void DslArticleRequest::run() try { - dict.loadArticle( chain[ x ].articleOffset, wordCaseFolded, tildeValue, + dict.loadArticle( chain[ x ].articleOffset, wordCaseFolded, ignoreDiacritics, tildeValue, displayedHeadword, headwordIndex, articleBody ); if ( !articlesIncluded.insert( std::make_pair( chain[ x ].articleOffset,