Fix formatting of invalid regex error

Preserve whitespace, special characters and use monospace font.
This commit is contained in:
RumovZ 2021-03-12 20:31:23 +01:00
parent 9ba02b5ca6
commit 2078a094f4

View File

@ -158,7 +158,7 @@ impl AnkiError {
SearchErrorKind::InvalidPropOperator(ctx) => i18n
.trn(TR::SearchInvalidPropOperator, tr_strs!["val"=>(ctx)])
.into(),
SearchErrorKind::Regex(text) => text.into(),
SearchErrorKind::Regex(text) => format!("<pre>`{}`</pre>", text.replace('`', "'")).into(),
SearchErrorKind::Other(Some(info)) => info.into(),
SearchErrorKind::Other(None) => i18n.tr(TR::SearchInvalidOther),
SearchErrorKind::InvalidNumber { provided, context } => i18n