proselint icon indicating copy to clipboard operation
proselint copied to clipboard

Fix one-off column offset with existence_check

Open blueyed opened this issue 7 years ago • 4 comments

When require_padding was not used (or it is at the beginning of a line), columns were off by 1.

This patch adds/substracts the matched subgroup conditionally.

This could use more tests in general - none was failing with initial (wrong) changes in this area. E.g. for the first fixup which passed all (py3) tests: https://github.com/amperser/proselint/pull/690/commits/b4e14621840c61820d693b2f9a8617b566411f65.

I've tried to use \b in the pattern instead, but that failed for/with proselint/checks/misc/currency.py.

blueyed avatar Mar 13 '17 20:03 blueyed

Running into AssertionError: sorry, but this version only supports 100 named groups with this approach (except on py35).

blueyed avatar Mar 14 '17 23:03 blueyed

@blueyed looks like the issue is coming from tools.py in the line compiling the regex causing your failed tests The ()'s here are creating too many groups for compiling regexes. Maybe use []'s here instead?

joshmgrant avatar Mar 15 '17 00:03 joshmgrant

@joshmgrant Thanks. I assume it's from https://github.com/amperser/proselint/pull/690/files#diff-a2bedf23c7c2dfe9ca9c71e77c10500cR323, and then they are needed, since they are used to adjust the offset - based on if \W or ^ was matched. I've not put much thought into it, I was just happy to see that it's easily hackable when finding the issue itself.. ;)

blueyed avatar Mar 15 '17 01:03 blueyed

Can anyone verify if this problem still occurs? I am currently not able to, so any help would be appreciated.

Nytelife26 avatar Jul 27 '23 14:07 Nytelife26