Commit Graph

717 Commits (711d39975806233ce505abcea45998170d402579)

Author SHA1 Message Date
Wilfred Hughes a3055083c1 Highlight JS keyword in TS files
Fixes #126
2022-02-05 13:40:45 +07:00
Wilfred Hughes 9e48b64d2c Add a --missing-as-empty flag to allow non-existent paths
By default, difftastic now errors if paths don't exist.
2022-02-03 21:26:51 +07:00
Wilfred Hughes 0dcb76eec1 Report whether a binary file has changed
Fixes #119
2022-02-03 21:03:50 +07:00
Wilfred Hughes 3e9d506256 Highlight built-in constants too 2022-02-03 00:27:35 +07:00
Wilfred Hughes 43605bd5e8 Add support for Hack 2022-02-02 23:22:15 +07:00
Wilfred Hughes 73c12d2b04 Syntax highlight comments in Clojure and Common Lisp
These don't mark their comments as 'extra', but use the node kind
"comment" so it's easy to detect them.
2022-02-02 23:10:06 +07:00
Wilfred Hughes d1aa1d4925 Line up additions and removals if they affect more than one line 2022-01-31 22:23:58 +07:00
Wilfred Hughes 52ef67ccbd Treat quoted_string in OCaml as an atom
Fixes #117
2022-01-31 21:41:53 +07:00
Wilfred Hughes 8f6b269492 Tag a 0.18.1 release 2022-01-30 22:56:19 +07:00
Wilfred Hughes 409f7aae75 Roll version 2022-01-30 18:03:45 +07:00
Wilfred Hughes ea24dd8784 Skip unchanged delim and find a fixpoint
This lets us discard more nodes before diffing, improving performance.

Fixes #84
2022-01-30 17:20:24 +07:00
Wilfred Hughes 82ce1ab818 Add a --skip-unchanged flag
Closes #98
2022-01-29 23:06:42 +07:00
Wilfred Hughes 2d3b08cc0a Document loop parsing fix 2022-01-29 18:22:47 +07:00
Wilfred Hughes 36c4520025 Provide an environment variable for controlling background colour
Fixes #55
2022-01-29 16:07:31 +07:00
Wilfred Hughes c38b072fd2 Add a --background option
Improves #55
2022-01-29 15:58:51 +07:00
Wilfred Hughes 0eeb91d591 Add a --color CLI option 2022-01-29 12:38:31 +07:00
Wilfred Hughes c0ba12bf68 Add a --width CLI argument 2022-01-29 12:13:21 +07:00
Wilfred Hughes fca1c6fffe Prefer 'normal' over white foreground colours
This is important in terminals with white backgrounds.

Improves #55
2022-01-27 22:18:06 +07:00
Wilfred Hughes 1b907e84c1 Fix character literals in Lisp
Improves #85
2022-01-27 21:53:21 +07:00
Wilfred Hughes 5cf143228f Treat attribute IDs in OCaml as atoms
Fixes #114
2022-01-27 20:25:17 +07:00
Wilfred Hughes 6fb800606e Get all matched lines and then slice
This is much simpler conceptually and less prone to bugs.

Fixes #111
2022-01-26 21:58:02 +07:00
Wilfred Hughes cb510375c1 Show ChangedCommentPart in bold 2022-01-25 22:55:30 +07:00
Wilfred Hughes 69dbad35ad Roll version 2022-01-25 22:32:18 +07:00
Wilfred Hughes e123cad49e Only set next/prev on potentially changed syntax nodes
Otherwise we end up running dijkstra on nodes at the end that we've
already marked as unchanged, and erroneously claim they're novel.

Fixes #112
2022-01-25 22:29:19 +07:00
Wilfred Hughes 440c94ce3c Don't treat identical text files as binary
Looks like a copy-paste mistake.
2022-01-24 20:34:34 +07:00
Wilfred Hughes f053529f76 Use bold for highlighting types too
Too many colours makes it harder to spot the red/green changed
sections, but it's nice seeing types distinctly.

This is probably the limit of syntax highlighting possible within the
current design, so consider #32 done for the time being.

Fixes #32
2022-01-23 11:56:27 +07:00
Wilfred Hughes 6ff60bf0c5 Add syntax highlighting on comments
Improves #32
2022-01-23 11:07:16 +07:00
Wilfred Hughes 94e968b660 Ignore unchanged nodes at the start/end of the file
This is the first part of #84.
2022-01-22 22:26:52 +07:00
Wilfred Hughes a2dc0b5109 Roll version 2022-01-22 19:03:58 +07:00
Wilfred Hughes de89caadb3 Don't consider newlines to be words in the line parser
This causes us to match up unrelated lines, and doesn't make sense for
a line parser.

Improves #90.
2022-01-22 17:56:12 +07:00
Wilfred Hughes e060ab31bf Fix another bug with duplicate line printing
hunk_end needs flipping when operating on the mirror image, as well as
the output.
2022-01-22 17:16:23 +07:00
Wilfred Hughes cb7122c937 Take an opposite line whenver possible when matching novel regions
Fixes #99
2022-01-22 13:16:33 +07:00
Wilfred Hughes b88ed07dc2 Update changelog 2022-01-21 21:42:34 +07:00
Wilfred Hughes b136369fd7 Revert "Prefer novel tokens on the same line, even if there are repeats"
This reverts commit 37a18401c6.
2022-01-20 19:12:52 +07:00
Wilfred Hughes 02a25ff251 Improve perf when diffing identical contents
Should help with #98.
2022-01-18 23:34:31 +07:00
Wilfred Hughes 109f1aac09 Consider previous context after fill when calculating after context
Fixes #80
2022-01-17 19:16:24 +07:00
Wilfred Hughes 37a18401c6 Prefer novel tokens on the same line, even if there are repeats
Fixes most cases in #76, but does not help with #56.
2022-01-15 19:38:18 +07:00
Wilfred Hughes 2d4ab5e494 Treat ocaml tags as atoms too 2022-01-15 11:00:41 +07:00
Wilfred Hughes c7b12d202f Treat ocaml type variables as an atom
The `'` in `'foo` gets a separate tree-sitter AST node, but the `foo`
does not. Treat the whole thing as an atom to avoid missing
highlighting on the `foo` part.

Fixes #89
2022-01-14 23:35:19 +07:00
Wilfred Hughes e404c0e86f Ensure we only calculate opposite positions once
Previously this was computed per-hunk, which was wasteful and slow
when there are many hunks.
2022-01-14 09:48:40 +07:00
Wilfred Hughes eeafbe681a Detect PKGBUILD and other common shell files
Fixes #95
2022-01-13 23:06:31 +07:00
Wilfred Hughes 8c6559ba81 Treat bash heredocs as atoms
Fixes #93
2022-01-11 19:14:04 +07:00
Wilfred Hughes 6ad40e10c4 Trim whitespace in JSX text
Fixes #72
2022-01-09 18:47:24 +07:00
Wilfred Hughes d240bfeebd Fix Mercurial when whole file has been removed
Mercurial gives us the path even when it doesn't exist. Just require
at least one of the paths to exist, rather than both.

(Git gives us /dev/null in this situation.)

Fixes #50
2022-01-07 09:42:56 +07:00
Wilfred Hughes a11e3081b2 Roll version 2022-01-06 01:00:48 +07:00
Wilfred Hughes c511b634f7 Only split source code on newlines once
Widths::new() is called once per hunk, so repeatedly splitting on
newlines can become a major performance bottleneck.
2022-01-06 00:54:52 +07:00
Wilfred Hughes 2f8a82de15 Document new textual differ
See #86
2022-01-06 00:54:05 +07:00
Wilfred Hughes c7c6f1a7b6 Print a newline on binary files, consistent with other files 2022-01-03 23:56:34 +07:00
Wilfred Hughes 40e23e4026 Improve alignment when the last line is novel 2022-01-03 12:43:43 +07:00
Wilfred Hughes 05be21d08e Fix typo in changelog 2022-01-01 20:28:45 +07:00
Wilfred Hughes 2dc480ec5c Updated typescript parser 2021-12-31 19:40:14 +07:00
Wilfred Hughes ba15ce8103 Updated Ruby parser 2021-12-31 19:39:22 +07:00
Wilfred Hughes efa8313e39 Update Python parser 2021-12-31 19:36:13 +07:00
Wilfred Hughes 13bf9f7f42 Update OCaml parser 2021-12-31 19:34:05 +07:00
Wilfred Hughes 5e8c116a3c Updated Java parser 2021-12-31 19:31:48 +07:00
Wilfred Hughes 75b29947b3 Updated Haskell parser 2021-12-31 19:31:11 +07:00
Wilfred Hughes 52af11744f Updated C# parser 2021-12-31 19:25:36 +07:00
Wilfred Hughes 426a95c552 Document C/C++ parser updates 2021-12-30 10:07:43 +07:00
Wilfred Hughes 3381a3dc60 Document bash parser update 2021-12-30 10:02:14 +07:00
Wilfred Hughes 177db1f652 Improve highlighting of blank lines in novel sections
If we're displaying a blank line and there's no opposite line, assume
it's novel and needs highlighting.

This is a best-effort heuristic, but it seems to work well.
2021-12-29 16:44:14 +07:00
Wilfred Hughes 667a42d57b Downgrade to tree-sitter 0.20.0
0.20.1 has a performance regression, which seems to particularly
affect Elixir parsing:
https://github.com/tree-sitter/tree-sitter/issues/1510
2021-12-29 14:59:12 +07:00
Wilfred Hughes 9d9f55a605 Document elixir parser changes 2021-12-29 10:45:44 +07:00
Wilfred Hughes 0cf68ef847 Roll version 2021-12-27 18:28:15 +07:00
Wilfred Hughes 9e3c6a7c9d Use shebang (if present) to detect language type 2021-12-27 17:33:14 +07:00
Wilfred Hughes 91db24fc9a Add language detection based on whole file names 2021-12-27 12:38:22 +07:00
Wilfred Hughes 382d498559 Fix crash when opposite side has unpaired lines
See #66
2021-12-18 23:30:16 +07:00
Wilfred Hughes 447ed2c14d Fix crash on unicode characters on line boundaries
Fixes #74
2021-12-11 15:58:07 +07:00
Wilfred Hughes 36857c3828 Allow terminal width to be overridden by DFT_WIDTH
Should help with #71.
2021-12-11 14:46:03 +07:00
Wilfred Hughes 6f1baae23e Prefer terminal_width crate so we support more platforms
term_width is unmaintained and does not support Windows.

Fixes #71
2021-12-07 23:24:13 +07:00
Wilfred Hughes bffbf1b779 Document release dates 2021-12-07 23:13:46 +07:00
Wilfred Hughes d820a4ed29 Document windows build fixes 2021-12-07 23:10:07 +07:00
Wilfred Hughes 4948f59855 Roll version 2021-12-04 23:56:42 +07:00
Wilfred Hughes e00f94fed8 Treat float values as atoms in CSS
Otherwise we treat `0.5em` as two atoms, unlike `1em` which was
already a single atom.
2021-12-04 18:34:24 +07:00
Wilfred Hughes aab3e7f2cc Treat regex literals and template string literals as atoms in JS/TS
Fixes #64
2021-12-04 18:19:15 +07:00
Wilfred Hughes 4f0fa617df Don't require flags that only disable warnings
These flags aren't strictly required, they're only used to prevent
warnings when compiling tree-sitter parsers.

Should help with compiling on MSVC, see #63.
2021-12-04 18:10:31 +07:00
Wilfred Hughes d9e149decc Log a warning on parse errors
Fixes #62
2021-12-04 18:02:36 +07:00
Wilfred Hughes 87c486742c Treat punctuation characters individually when splitting comments
Fixes #49
2021-11-30 22:45:10 +07:00
Wilfred Hughes 05873b546b Add support for Common Lisp 2021-11-26 22:53:21 +07:00
Wilfred Hughes 4b0f7708ae Expand file associations 2021-11-25 00:07:36 +07:00
Wilfred Hughes de56eabe94 Add support for bash syntax 2021-11-24 23:53:21 +07:00
Wilfred Hughes a5ed3fbd48 Add basic Ruby support 2021-11-20 01:08:33 +07:00
Wilfred Hughes 7c5a0aec0c Merge commit 'a03f1d2d1dfbf6f8e0fdca5f9ff030228241eb57' 2021-11-19 23:57:48 +07:00
Wilfred Hughes 153cc5eeca Merge commit '203e239408d642be83edde8988d6e7b20a19f0e8' 2021-11-19 23:56:55 +07:00
Wilfred Hughes f8427c6970 Merge commit 'fdeb68ac8d2bd5a78b943528bb68ceda3aade2eb' 2021-11-19 23:54:58 +07:00
Wilfred Hughes e8f45d91b8 Roll version 2021-11-19 00:49:14 +07:00
Wilfred Hughes d2f73e343c Document newer haskell parser commit 2021-11-14 16:51:47 +07:00
Wilfred Hughes 546391e9c0 Fix subword highlighting in multiline comments 2021-11-14 16:48:55 +07:00
Wilfred Hughes 9693d813d2 Document Haskell parser upgrade 2021-11-14 13:27:55 +07:00
Wilfred Hughes 25dae40dfa Display the file name even when there are no syntactic changes 2021-11-14 13:04:06 +07:00
Wilfred Hughes 8f0603e22b Merge branch 'truncate_lines' 2021-11-14 13:02:56 +07:00
Wilfred Hughes d3b38866a8 Document new hunk logic for display 2021-11-03 00:48:46 +07:00
Wilfred Hughes 0f8a2d3672 Highlight line numbers for lines with changes 2021-10-28 00:21:45 +07:00
Wilfred Hughes c23a36411d Only use bold for keywords in novel tokens
This makes added/removed regions slightly less prominent, but easier
to read. It also makes them more consistent with the styling on the
surrounding text.
2021-10-27 23:55:33 +07:00
Wilfred Hughes b3106e1382 Print file name and hunk number on every hunk 2021-10-23 16:52:49 +07:00
Wilfred Hughes c698f8979b Rename binary to `difft` for brevity 2021-10-23 16:19:33 +07:00
Sebastian Dröge ebebfdf23e Fix typo in CHANGELOG.md 2021-10-19 08:54:25 +07:00
Wilfred Hughes e82a3f62f7 Clarify syntax highlighting features in 0.11 2021-10-18 23:10:09 +07:00
Wilfred Hughes ddd05cf738 Fix heading in changelog that should be h3 2021-10-18 23:07:44 +07:00
Wilfred Hughes 44b025fdc5 Roll version 2021-10-18 22:42:17 +07:00
Wilfred Hughes 4287594cda Don't consider other paths when UnchangedNode is available
This substantially decreases the number of edges in our graphs,
especially when few nodes have changed. Diffing slow_before.rs with
slow_after.rs now takes half the time on my machine.

This makes diffing slightly greedier, so there may exist cases where
diffs are slightly worse. Comparing AXAB with AB is arguably nicer
as (+AX)AB rather than A(+XA)B. However, all the tests still pass,
and it's a huge perf win.

Closes #47
2021-10-18 22:23:44 +07:00
Wilfred Hughes febfbcea3e Make word diffs more granular
Fixes #39
2021-10-03 16:43:08 +07:00
Wilfred Hughes 98ca8ea106 Ensure that single-item tree-sitter lists are difftastic lists
This is important when executing tree-sitter queries, as highlighting
queries tend to target leaf nodes. Flattening the tree loses that.

This may also lead to more accurate diffing logic in some examples,
but I haven't found any obvious cases.
2021-10-01 23:57:15 +07:00
Wilfred Hughes 67916d260d Dim unchanged comments as a crude syntax highlighting technique 2021-09-30 00:07:37 +07:00
Wilfred Hughes b747cdcb01 Make bad position data more obvious (use purple) 2021-09-29 23:57:44 +07:00
Wilfred Hughes d37c87a1a5 Update changelog for patch release 2021-09-28 09:50:02 +07:00
Wilfred Hughes 9409e4fb4e Clarify platform in changelog 2021-09-28 09:41:08 +07:00
Wilfred Hughes ec37c5bef1 Add full Mercurial extdiff support 2021-09-26 21:23:22 +07:00
Wilfred Hughes 6ac01365c6 Update changelog for build fix 2021-09-26 21:21:02 +07:00
Wilfred Hughes 4e09fd0507 Match delimiters when converting from tree-sitter to syntax
Previously, we only handled simple cases like `(x)` where the first
and last token were the delimiter tokens. We now allow arbitrary
tokens before and after the delimiter, and wrap them in an additional
list.

This was more common in the C family parsers, but it's a general
problem. It also helps with robustness of JSX/TSX delimiter parsing of
`<`, where we now require a close `>` at the same level.
2021-09-25 22:25:05 +07:00
Wilfred Hughes 48efe9d7c4 Roll version 2021-09-24 23:40:07 +07:00
Wilfred Hughes c9f85d806e Document the main tricky cases with tree diffs 2021-09-24 23:33:25 +07:00
Wilfred Hughes 3b36e6486d Add C# support
Closes #37.
2021-09-22 22:37:53 +07:00
Wilfred Hughes f6ada434fe Add Haskell support
Fixes #36
2021-09-22 10:18:48 +07:00
Wilfred Hughes a0388c7d8b Optimise equal_content by checking num_descendants first
Traversing children is costly so we avoid it where possible. This
saves a further ~5% runtime on slow_before.rs/slow_after.rs.
2021-09-19 23:57:14 +07:00
Wilfred Hughes d7b0c917c1 Remove regex parser 2021-09-19 12:17:25 +07:00
Wilfred Hughes 6c08507b0d Add C++ support 2021-09-17 22:37:41 +07:00
Wilfred Hughes fb96b0a78d Add C support 2021-09-14 23:25:22 +07:00
Wilfred Hughes 31572a83a9 Roll version following release 2021-09-14 00:34:38 +07:00
Wilfred Hughes 7fa9b29e4d Factor out a lib.rs
This makes it easier for us to use tools that require a library, such
as criterion.
2021-09-13 00:41:58 +07:00
Wilfred Hughes 2da9747e26 Add more Rust delimiter tokens 2021-09-12 00:36:33 +07:00
Wilfred Hughes 9e9f7aff78 Update changelog for Rust parsing improvements 2021-09-11 21:11:41 +07:00
Wilfred Hughes eed16fc6d7 Simplify Dijkstra implementation
This is faster than the previous approach, and also less code.
2021-09-11 15:26:59 +07:00
Wilfred Hughes fd0dd8e75d Always use the full width for LHS column in side-by-side display 2021-09-06 15:21:20 +07:00
Wilfred Hughes 2ac459918a Add support for Elixir 2021-09-06 15:09:44 +07:00
Wilfred Hughes a39d4b3bb7 Use word-level diffs for text content too
We already do word-level diffs for comments, so use comment atoms in
the line-based parser.

Fixes #33
2021-09-06 12:47:20 +07:00
Wilfred Hughes d29bd46969 Associate more file extensions with Clojure
Fixes #31
2021-09-05 19:43:47 +07:00
Wilfred Hughes 34a5bd768d TSX is now supported 2021-09-05 19:37:28 +07:00
Wilfred Hughes 6d98fd86ab Configure typescript parser 2021-09-05 19:26:44 +07:00
Wilfred Hughes b6b0f8057b Treat integer values as atoms in CSS 2021-09-05 11:39:49 +07:00
Wilfred Hughes e3b2994aa9 Java parser was added in 0.7 too 2021-09-05 11:23:21 +07:00
Wilfred Hughes 0f042fb160 Roll version 2021-09-05 11:23:00 +07:00
Wilfred Hughes d99ada1573 Preserve leading whitespace when constructing comment nodes
Display relies on accurate content values. If we transform comment
contents, we would colour the wrong part of the source code when
displaying. See before/after.java sample files.
2021-09-05 11:13:05 +07:00
Wilfred Hughes e4b5bd4e19 Remove Scheme support
There's no tree-sitter parser available sadly, and I eventually plan
to drop the regex parser.
2021-09-04 18:30:17 +07:00
Wilfred Hughes 809d6383ad Document Python support 2021-09-04 17:05:11 +07:00
Wilfred Hughes 86a330c44e Add debug logging and log stats on shortest path found 2021-09-04 10:46:51 +07:00
Wilfred Hughes d1354c7174 Use a single-column display when whole files are added or removed 2021-08-29 23:42:59 +07:00
Wilfred Hughes cc93976969 Handle SIGPIPE
Based on the sample code in
https://stackoverflow.com/a/65760807/509706

Closes #28
2021-08-29 16:50:05 +07:00
Wilfred Hughes c662181cd6 Make tree-sitter the default parser 2021-08-29 15:17:40 +07:00
Wilfred Hughes 1dfedc6534 Ensure we use codepoints when slicing strings to avoid crashes
Rust will panic if we try to slice on a boundary that isn't a char
boundary. Count unicode codepoints and slice to the relevant byte.

Added a test file that was crashing before due to the use of curly
quotes.
2021-08-29 15:10:01 +07:00
Wilfred Hughes 32c3e9d0ca Fix another crash when removing a whole file in git 2021-08-28 12:53:55 +07:00
Wilfred Hughes 7f021e147d Improve handling of delimiters in all supported tree-sitter languages 2021-08-28 12:00:06 +07:00
Wilfred Hughes 2eb2f8b67d Add a --dump-ts debug option 2021-08-28 11:24:29 +07:00
Wilfred Hughes 1d0b1ad6b6 Add --dump-syntax for debugging the syntax tree 2021-08-27 22:32:48 +07:00
Wilfred Hughes 35779dde2e Remove unused --lang argument 2021-08-27 22:11:30 +07:00
Wilfred Hughes 309e4bc02c Match delimiter tokens based on their content 2021-08-26 23:51:06 +07:00
Wilfred Hughes bda2ce7d11 Improve string literals in tree-sitter parsers 2021-08-26 23:35:19 +07:00
Wilfred Hughes d5ce3e626f Fix missing string pattern for JSON parser 2021-08-24 01:12:11 +07:00
Wilfred Hughes 5d67ad3bea Merge display sections in changelog 2021-08-24 00:23:32 +07:00
Wilfred Hughes f17e0a5e0a Support colour when using git with a pager
Closes #29
2021-08-24 00:20:34 +07:00
Wilfred Hughes fad0775315 Fix crash on renaming files 2021-08-22 23:51:41 +07:00
Wilfred Hughes 6f1a069a75 Document usage of tree-sitter 2021-08-16 22:30:12 +07:00
Wilfred Hughes 414182c9dd Only show a single column in side-by-side when adding a whole file 2021-08-08 23:25:26 +07:00
Wilfred Hughes 09a80150df Fix adding/removing whole files
The 'remove unaligned lines at beginning of hunk' logic meant we just
discarded the whole hunk.

This breaks alignment again (previously fixed in 3ebbf268fd), but that
should be fixed properly in the padding logic.
2021-08-08 23:15:23 +07:00
Wilfred Hughes 3ae0b7df84 Allow RHS to be arbitrarily long in a pager
If stdout is not a TTY, assume it's a pager and don't truncate the
RHS.
2021-08-08 17:35:31 +07:00
Wilfred Hughes 857cb77d8f Ensure LHS and RHS source code are the same width 2021-08-08 17:31:18 +07:00
Wilfred Hughes 83b8c843cb Use .. for column numbers on blank lines used to align 2021-08-08 11:26:17 +07:00
Wilfred Hughes 1ceaecfa25 Remove --width from CLI parameters
This is the first step in refactoring for inline diffs.
2021-08-01 15:30:12 +07:00
Wilfred Hughes 2e6666041f Contiguous novel atoms are always better than changing depth of novel lists 2021-07-31 23:32:23 +07:00
Wilfred Hughes 34f084d8f1 Calculate content width based on visible lines 2021-07-31 17:21:55 +07:00
Wilfred Hughes e67732bab9 Improve contiguous novel logic
Inspect the previous syntactic node, then get the atom position, open
delimiter position or close delimiter position depending on the
context.
2021-07-31 16:54:14 +07:00
Wilfred Hughes a4751b98f1 Fix a parsing issue with -> in Rust 2021-07-31 01:25:16 +07:00
Wilfred Hughes 573cd32a01 Prefer matching comments that are similar
Previously, we'd match up any pair of comments with a levenstein
distance of 0.4 or more. This was reasonably effective, but misssed
opportunities even more precise diffs.

Instead, prefer the comment matching with the highest levenshtein
distance.

We still only highlight word-level changes for comments with a
levenshtein of 0.4 or more.

Closes #27
2021-07-30 22:54:30 +07:00
Wilfred Hughes da63704675 Roll version 2021-07-28 00:04:47 +07:00
Wilfred Hughes 6f2140e901 Replace tabs with spaces before parsing
Difftastic uses offsets to store the positions of AST nodes, so we
cannot replace tabs after parsing.

A string literal with a tab character "	" being replaced by a four
space string literal "    " is now ignored by difftastic. This is
wrong: difftastic should only ignore whitespace between atoms.

This is still an improvement for source code that uses tab characters,
which is common in Go. The above case should be rare until we have a
full solution.

Fixes #24
2021-07-27 23:36:20 +07:00
Wilfred Hughes a7f688ee82 Put a spacer between LHS and RHS lines printed
Width calculations already consider the spacer, but it was lost in a
refactor.
2021-07-27 22:02:48 +07:00
Wilfred Hughes f24c4954bc Update changelog for previous commit 2021-07-27 22:01:38 +07:00
Wilfred Hughes 7701e38510 Add a basic Go parser 2021-07-25 23:46:33 +07:00
Wilfred Hughes e36a2e8c96 Don't crash on binary files 2021-07-25 12:50:42 +07:00
Wilfred Hughes c8481775e2 Remove --context CLI argument 2021-07-25 12:34:50 +07:00
Wilfred Hughes 04214ef1ef Ignore indentation changes on multiline comments 2021-07-25 12:27:24 +07:00
Wilfred Hughes 3ebbf268fd Improve alignment when LHS and RHS have different numbers of lines 2021-07-24 18:01:12 +07:00
Wilfred Hughes 928584676a Only highlight individual comment words for comments that are similar 2021-07-24 17:01:30 +07:00
Wilfred Hughes 3f8e41d862 Parse @ in elisp 2021-07-24 16:50:53 +07:00
Wilfred Hughes 45af6b4534 Parse < and > as symbols in elisp 2021-07-24 16:45:06 +07:00
Wilfred Hughes 2da5181ffb Prefer replacing comments over novel atoms
This was broken in 4c33f34.
2021-07-24 16:36:36 +07:00
Wilfred Hughes 6d7e155cc6 Remove unused CLI parameter 2021-07-24 16:27:33 +07:00
Wilfred Hughes b81312e88b Roll version 2021-07-22 00:09:13 +07:00
Wilfred Hughes 5d2c14a3f9 Entering a list should set the prev_novel state to the open delimiter 2021-07-22 00:07:09 +07:00
Wilfred Hughes 61446c916a Prefer marking large subtrees as novel rather than largely novel
This solves the "replace function A with completely different function
B" problem, even if they start with the same function keyword.
2021-07-21 01:05:01 +07:00
Wilfred Hughes c48e8e2977 Improve JS and JSON parsing 2021-07-20 01:18:39 +07:00
Wilfred Hughes 7bd8afc439 Improve handling of = and & in lisps 2021-07-20 01:09:29 +07:00
Wilfred Hughes aa28b26f48 Basic support for non-UTF8 source files 2021-07-20 00:46:12 +07:00
Wilfred Hughes 2d9efe15a0 Fix another crash on empty files
Git history with file additions/removals should now work.
2021-07-20 00:22:01 +07:00
Wilfred Hughes 6bec8b7e2c Don't crash on files without an extension 2021-07-20 00:10:58 +07:00
Wilfred Hughes 49ec9d68cc Improve OCaml parsing for := and !
Fixes #20
2021-07-19 23:04:03 +07:00
Wilfred Hughes 6fb01cf7d3 Lex string literals with escaped delimiters 2021-07-18 23:42:36 +07:00
Wilfred Hughes ad81a86419 + is a legal symbol constituent in elisp 2021-07-18 23:40:46 +07:00
Wilfred Hughes 88b0ec2283 & is legal in elisp
It's used for variadic functions.
2021-07-18 23:25:56 +07:00
Wilfred Hughes 75839a1185 Support # and . in lisps
Elisp uses # for sharp-quoting, and some Schemes use # for vector
literals.

. is used for dotted pair notation.
2021-07-18 23:18:55 +07:00
Wilfred Hughes 28d5e51911 Fix crash on multibyte characters
Previously parsing would proceed byte at a time, which would crash if
the source contained multibyte characters. Instead, try all the
regular expression patterns, and jump to the next nearest match.
2021-07-18 22:34:52 +07:00
Wilfred Hughes 5f4ab7c292 Support using difftastic with built-in git commands 2021-07-18 15:01:32 +07:00
Wilfred Hughes abddca0b46 Dijkstra visits nodes in distance order, so we only need predecessors
The first time we see a node, we've found the shortest path to it. Add
it to the predecessors then, and don't visit it again.
2021-07-17 17:53:59 +07:00
Wilfred Hughes 1c9ece441a Improve --help 2021-07-17 14:18:40 +07:00
Wilfred Hughes cdc70dd784 Add ReplaceComment edge and display a word diff between the comments 2021-07-17 13:55:41 +07:00
Wilfred Hughes 00fcd4652a Recognise # and <- as OCaml punctuation
Fixes #18
2021-07-15 23:54:53 +07:00
Wilfred Hughes a2e36cac46 Add more two-character lexems to Rust parser 2021-07-13 23:36:52 +07:00
Wilfred Hughes 4c79267602 Roll version 2021-07-13 23:27:17 +07:00
Wilfred Hughes 8b382e4356 Improved OCaml handling
Fixes #17
Fixes #15
2021-07-13 22:52:13 +07:00
Wilfred Hughes 74c2b8e901 Clarify slider and performance status 2021-07-13 22:31:13 +07:00
Wilfred Hughes fbb2dffd4a Store an ID on Syntax values and use it for vertex equality 2021-07-13 21:49:40 +07:00
Wilfred Hughes b2d9035774 Consider nesting depth when comparing nodes 2021-07-10 17:42:02 +07:00
Wilfred Hughes 5c644baf7c Treat .. as a single atom in Rust 2021-07-10 17:13:07 +07:00
Wilfred Hughes 4cf2a24997 Fixed crash on multibyte characters that include '\n'
Fixes #13
2021-07-09 23:37:04 +07:00
Wilfred Hughes bbc77b8cbc Organise changelog by area 2021-07-09 23:35:53 +07:00
Wilfred Hughes ce35a5cc3a Support $( ... ) and $foo in Rust
Closes #14
2021-07-09 22:54:11 +07:00
Wilfred Hughes 1dc6ab3977 Fix crash when diff touches first line 2021-07-08 01:10:37 +07:00
Wilfred Hughes 094133fe10 Ensure that we display all context lines, even if matched pairs are unordered 2021-07-07 23:45:22 +07:00
Wilfred Hughes 9e821956a5 Roll version 2021-07-07 22:25:03 +07:00
Wilfred Hughes 6f87140703 Don't crash if file is unchanged
Fixes #4
2021-07-07 22:19:46 +07:00
Wilfred Hughes c43e724caf Ensure :: is treated as a single token in Rust 2021-07-07 22:02:20 +07:00
Wilfred Hughes da8a4c1ee1 Line up visible lines and include gaps if necessary 2021-07-07 22:01:19 +07:00
Wilfred Hughes 5463c120f4 Better punctuation parsing for JS and OCaml
Closes #7
2021-07-07 19:53:45 +07:00
Wilfred Hughes ccaca6f6a6 Rust: Consider , as separate punctuation
Closes #8
2021-07-07 19:51:49 +07:00
Wilfred Hughes 483fe8ca51 Ensure we always find the shortest route
Previously we would ignore shorter routes if we'd already found a
route to the node.
2021-07-04 22:38:17 +07:00
Wilfred Hughes 76ef7c510c Teach syntax about Rust lifetimes 2021-07-04 12:59:17 +07:00
Wilfred Hughes 64bfc73a6c Roll version for next release 2021-07-04 11:42:59 +07:00
Wilfred Hughes 9cd63c972d Adding a changelog 2021-07-04 11:40:31 +07:00