-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Instead of unconditionally returning the length of the current match, make sure the shortest match bubbles up along the recursive call stack. Note that this bug only occurs when a choice contains multiple instances of the query and the right-most match is the shortest one. See the example below including the choice, query, match prior this commit and after: Choice Query Before After aa/åå/aa/aa aa/aa aa/åå/aa/aa aa/åå/aa/aa ^ ^ ^ ^ |------| |---|
- Loading branch information
Showing
3 changed files
with
9 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
description: it favors the shortest match | ||
keys: aa/aa \n # ENTER | ||
stdin: | ||
aa/åå/aa | ||
aa/åå/aa/aa | ||
stdout: | ||
aa/åå/aa/aa |