fix: diff file headers and unanchored ! in diff and git - #78
Open
lvolland wants to merge 1 commit into
Open
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
hey! the two header lines of every
git diffcome out wrong.today
--- a/fileisdeleted(red) and+++ b/fileisinsert(green), as if they were content lines. expected: bothsection, like the@@line.cause:
[*-+]in the section rule is a range (U+002A–U+002B), so it holds*and+but not-./[*-+]/.test('-')isfalse. and even with the class fixed nothing moves, because the rule sat last and lost the index tie todeleted/insert— the loop runs backwards and takes<=. so the class and the position both have to change.two more in the same pass:
/!.*/gmwas unanchored, soif (a !== b) {painted!== b) {as a keyword mid-line. anchored to^.git.jsusedexpand: 'str', so every apostrophe in a commit message opened a green string. swapped forstrDoubleplus a prose-aware apostrophe rule.+16 bytes in
diff.js, +144 ingit.js. fixture lines intest.diffandtest.git.notes
--- <one word>now readssectioninstead ofdeleted. that hits one-word deleted sql/lua comments (-- up,-- down) — common in migrations.--- primary key(two words) is unaffected. tightening further means reasoning about the---/+++pair, which costs a lot more than 16 bytes.--- a/my file.txt) are not fixed —( \S+)?$wants a single token. no regression, main got them wrong too, but the fix is narrower than the title suggests.bash.jsalready has four, one of them variable-length, so no new floor.a "b\"c" dis one string, same as before. half-typed quotes stay coloured too.