In tagless_find_helper only tag before start should be ignored
The search result is irrelevant to which tag we should ignore Fix wangqr/Aegisub#17
This commit is contained in:
parent
6732179a8a
commit
7a1756a26f
2 changed files with 5 additions and 1 deletions
|
@ -173,7 +173,7 @@ void tagless_find_helper::map_range(size_t &s, size_t &e) {
|
||||||
// match
|
// match
|
||||||
for (auto const& block : blocks) {
|
for (auto const& block : blocks) {
|
||||||
// Any blocks before start are irrelevant as they're included in `start`
|
// Any blocks before start are irrelevant as they're included in `start`
|
||||||
if (block.second < s) continue;
|
if (block.second <= start) continue;
|
||||||
// Skip over blocks at the very beginning of the match
|
// Skip over blocks at the very beginning of the match
|
||||||
// < should only happen if the cursor was within an override block
|
// < should only happen if the cursor was within an override block
|
||||||
// when the user started a search
|
// when the user started a search
|
||||||
|
|
|
@ -84,6 +84,8 @@ TEST(lagi_skip_tags, tag_stripping) {
|
||||||
EXPECT_EQ("abc", helper.strip_tags("a{}bc", 0));
|
EXPECT_EQ("abc", helper.strip_tags("a{}bc", 0));
|
||||||
EXPECT_EQ("abc", helper.strip_tags("abc{}", 0));
|
EXPECT_EQ("abc", helper.strip_tags("abc{}", 0));
|
||||||
EXPECT_EQ("abc", helper.strip_tags("{}a{}bc{}", 0));
|
EXPECT_EQ("abc", helper.strip_tags("{}a{}bc{}", 0));
|
||||||
|
EXPECT_EQ("rmofmat", helper.strip_tags("{\\i1}rmofmat{\\i}", 0));
|
||||||
|
EXPECT_EQ("rm of mat", helper.strip_tags("{\\i1}rm of mat{\\i}", 0));
|
||||||
|
|
||||||
EXPECT_EQ("abc", helper.strip_tags("{}abc", 1));
|
EXPECT_EQ("abc", helper.strip_tags("{}abc", 1));
|
||||||
EXPECT_EQ("abc", helper.strip_tags("{}abc", 2));
|
EXPECT_EQ("abc", helper.strip_tags("{}abc", 2));
|
||||||
|
@ -112,6 +114,8 @@ TEST(lagi_skip_tags, range_mapping) {
|
||||||
EXPECT_RANGE("{cc}ab", 0, 1, 2, 5, 6);
|
EXPECT_RANGE("{cc}ab", 0, 1, 2, 5, 6);
|
||||||
EXPECT_RANGE("{cc}ab{cc}b", 0, 1, 2, 5, 6);
|
EXPECT_RANGE("{cc}ab{cc}b", 0, 1, 2, 5, 6);
|
||||||
EXPECT_RANGE("{cc}ab{cc}b", 0, 1, 3, 5, 11);
|
EXPECT_RANGE("{cc}ab{cc}b", 0, 1, 3, 5, 11);
|
||||||
|
EXPECT_RANGE("{\\i1}rmofmat{\\i}", 0, 4, 7, 9, 12);
|
||||||
|
EXPECT_RANGE("{\\i1}rm of mat{\\i}", 0, 6, 9, 11, 14);
|
||||||
|
|
||||||
EXPECT_RANGE("{cc}ab{cc}b", 3, 1, 3, 5, 11);
|
EXPECT_RANGE("{cc}ab{cc}b", 3, 1, 3, 5, 11);
|
||||||
EXPECT_RANGE("{cc}ab{cc}b", 4, 1, 3, 5, 11);
|
EXPECT_RANGE("{cc}ab{cc}b", 4, 1, 3, 5, 11);
|
||||||
|
|
Loading…
Reference in a new issue