From 0e81930597e48159e8ad0d6e0ab881b4d6371ff1 Mon Sep 17 00:00:00 2001 From: Tommaso Cucinotta Date: Mon, 22 Oct 2012 01:03:44 +0100 Subject: [PATCH] Fixed bug in escape sequence, showing up with ignore format off (addressing #8380). --- development/autotests/findadv-re-04-in.txt | 12 ++++++++++++ src/lyxfind.cpp | 21 +++++++++++---------- 2 files changed, 23 insertions(+), 10 deletions(-) create mode 100644 development/autotests/findadv-re-04-in.txt diff --git a/development/autotests/findadv-re-04-in.txt b/development/autotests/findadv-re-04-in.txt new file mode 100644 index 0000000000..06481b127b --- /dev/null +++ b/development/autotests/findadv-re-04-in.txt @@ -0,0 +1,12 @@ +# Finding styles with regexp + +Lang it_IT.utf8 +TestBegin test.lyx -dbg find > lyx-log.txt 2>&1 +KK: Hello \CeHello\C\[Home] +KK: \Cs +KK: \CF +# Uncheck ignore format (depends on IT language) +KK: \Az\Ag\Ae +KK: \Ce\Axregexp-mode\[Return].*\[Return] +TestEnd +Assert pcregrep -M 'Putting selection at .*idx: 0 par: 0 pos: 6\n with len: 5' lyx-log.txt diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index bd4e04e860..b46abc790e 100644 --- a/src/lyxfind.cpp +++ b/src/lyxfind.cpp @@ -492,19 +492,20 @@ Escapes const & get_regexp_escapes() { static Escapes escape_map; if (escape_map.empty()) { - escape_map.push_back(pair("$", "\\$")); - escape_map.push_back(pair("{", "\\{")); - escape_map.push_back(pair("}", "\\}")); - escape_map.push_back(pair("[", "\\[")); - escape_map.push_back(pair("]", "\\]")); - escape_map.push_back(pair("(", "\\(")); - escape_map.push_back(pair(")", "\\)")); - escape_map.push_back(pair("+", "\\+")); - escape_map.push_back(pair("*", "\\*")); - escape_map.push_back(pair(".", "\\.")); + escape_map.push_back(pair("$", "_x_$")); + escape_map.push_back(pair("{", "_x_{")); + escape_map.push_back(pair("}", "_x_}")); + escape_map.push_back(pair("[", "_x_[")); + escape_map.push_back(pair("]", "_x_]")); + escape_map.push_back(pair("(", "_x_(")); + escape_map.push_back(pair(")", "_x_)")); + escape_map.push_back(pair("+", "_x_+")); + escape_map.push_back(pair("*", "_x_*")); + escape_map.push_back(pair(".", "_x_.")); escape_map.push_back(pair("\\", "(?:\\\\|\\\\backslash)")); escape_map.push_back(pair("~", "(?:\\\\textasciitilde|\\\\sim)")); escape_map.push_back(pair("^", "(?:\\^|\\\\textasciicircum\\{\\}|\\\\mathcircumflex)")); + escape_map.push_back(pair("_x_", "\\")); } return escape_map; }