From 2ddd07791db5a40a2f68ea47bd095a071249ee6a Mon Sep 17 00:00:00 2001 From: Wilson Date: Thu, 14 Nov 2024 01:42:20 +0700 Subject: [PATCH] relax reconstruction error criteria (#959) Co-authored-by: ggurdin <46800240+ggurdin@users.noreply.github.com> --- lib/pangea/choreographer/controllers/choreographer.dart | 4 +++- lib/pangea/models/igc_text_data_model.dart | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/pangea/choreographer/controllers/choreographer.dart b/lib/pangea/choreographer/controllers/choreographer.dart index 151c0eb82..e35fdf4fc 100644 --- a/lib/pangea/choreographer/controllers/choreographer.dart +++ b/lib/pangea/choreographer/controllers/choreographer.dart @@ -116,8 +116,10 @@ class Choreographer { // we've got a rather elaborate method of updating tokens after matches are accepted // so we need to check if the reconstructed text matches the current text // if not, let's get the tokens again and log an error + final reconstructedText = + PangeaToken.reconstructText(igc.igcTextData!.tokens); if (igc.igcTextData?.tokens != null && - PangeaToken.reconstructText(igc.igcTextData!.tokens) != currentText) { + reconstructedText.trim() != currentText.trim()) { if (kDebugMode) { PangeaToken.reconstructText( igc.igcTextData!.tokens, diff --git a/lib/pangea/models/igc_text_data_model.dart b/lib/pangea/models/igc_text_data_model.dart index 7ef2afa3b..d95210388 100644 --- a/lib/pangea/models/igc_text_data_model.dart +++ b/lib/pangea/models/igc_text_data_model.dart @@ -160,7 +160,7 @@ class IGCTextData { newTokens.replaceRange(startIndex, endIndex, replacement.tokens); final String newFullText = PangeaToken.reconstructText(newTokens); - if (newFullText != originalInput && kDebugMode) { + if (newFullText.trim() != originalInput.trim() && kDebugMode) { PangeaToken.reconstructText(newTokens, debugWalkThrough: true); ErrorHandler.logError( m: "reconstructed text not working",