Commit Graph

231 Commits (65a803b203c61c96a4a0f14ab5db7d42bc1e5f7e)

Author SHA1 Message Date
Wilfred Hughes 65a803b203 Improve column width calculation on hunks
Instead of considering the column width for the large line number in
the hunk, consider the largest line number from all hunks for this
file.

Fixes #753
2025-10-02 22:41:35 +07:00
Wilfred Hughes 7cfa40bf80 Calculating display width should only consider visible lines
This is perf neutral for the usual benchmarks (where diffing is the
bottleneck, not display) and only a small (0.4% instruction count
increase) on the huge_cpp_1.cpp test files.
2025-09-25 07:47:30 +07:00
Wilfred Hughes 64e73bb58c Update expected output for Zig test files 2025-07-02 23:14:34 +07:00
Wilfred Hughes eff3c36c38
Merge pull request #844 from llakala/update-gleam
Update gleam parser
2025-06-15 22:16:50 +07:00
Wilfred Hughes 7eaf57fe79 Revert accidental comparison change from previous commit 2025-06-15 21:42:49 +07:00
Eman Resu 91b288c1c0 Fix gleam sample files to use `let assert` 2025-06-14 15:05:11 +07:00
Wilfred Hughes 1c1617c5d1 Add an atom node declaration for Verilog 2025-06-13 00:33:30 +07:00
Bryce Berger 791b0e2bec add verilog, systemverilog support 2025-06-13 00:15:53 +07:00
Wilfred Hughes 2efe4003b3 Update expected output now file name has changed 2025-04-08 08:54:52 +07:00
Wilfred Hughes 083efd06f6 Tweak file size formatting to one decimal place
Fixes #821
2025-04-08 08:54:48 +07:00
Wilfred Hughes 362cd8f2b7 Update comparison file following file name fix 2025-04-08 08:20:20 +07:00
Wilfred Hughes 0b386d332f Update Erlang parser to use crate
Whilst we're here, restore support for rebar files now the parser
supports these.
2025-02-22 22:06:42 +07:00
Wilfred Hughes 89e2a459d6 Update F# parser to use crate 2025-02-22 21:53:21 +07:00
crbelaus b0a4ddc7ed Fix output regression test 2025-02-10 09:06:03 +07:00
Wilfred Hughes fadd0f22ef Support Windows-1252 and make UTF-16 detection stricter
Fixes #797
2025-01-04 15:48:39 +07:00
Wilfred Hughes a6eb339f71 Use tree-sitter-toml from crates.io 2024-12-20 09:07:52 +07:00
Wilfred Hughes 15b9590db5 Use tree-sitter-julia from crates.io 2024-12-20 08:25:23 +07:00
Wilfred Hughes 88731f932d Use tree-sitter-javascript from crates.io 2024-12-20 00:02:14 +07:00
Wilfred Hughes de6e6707d2 Use tree-sitter-ocaml from crates.io 2024-12-19 23:14:12 +07:00
Wilfred Hughes 79bdf87c97 Remove old vendored haskell parser 2024-12-19 22:41:54 +07:00
Wilfred Hughes 0ca2c594a3 Accept the hightlighting changes
elvish: less highlighted as bold, seems like a small regression

hcl: not highlighting variables in bold now, a small regression

smali: more stuff in bold overall, but no longer the method name in bold
2024-12-19 21:11:55 +07:00
Wilfred Hughes 4df51dc57c Improve syntax highlighting on tree-sitter lists that are just keywords
Closes #777
2024-11-15 00:03:30 +07:00
Wilfred Hughes 549cb483fe Fix crash due to trailing newlines in string nodes at EOF
Fixes #782
2024-11-15 00:03:30 +07:00
Wilfred Hughes 511b7579fb Fix min() which should be max() 2024-10-21 22:53:28 +07:00
Wilfred Hughes 845bbeafff Cap the maxmimum size of columns in side-by-side display 2024-10-21 09:04:29 +07:00
Wilfred Hughes 8cdb59fa5e Normalise newlines before diffing
This produces good, consistent results on different trailing newlines
before, consistent with the behaviour before 7edd2a82cd (see #755).
2024-10-21 08:34:39 +07:00
Wilfred Hughes 7edd2a82cd Always consider newlines when diffing lines
StringIgnoringNewline caused crashes in code that assumed that two
equal values would hav the same string length.

This reverts 86612798ad. A better
approach would be to normalise line endings before diffing, but
additionally print whether files have/lack trailing newlines.

Fixes #755
2024-10-15 08:46:34 +07:00
Wilfred Hughes 1ac95534fe Don't push empty positions when diffing lines 2024-07-30 16:16:34 +07:00
Hugo van Rijswijk df76ea2369 Update compare result 2024-07-23 12:55:49 +07:00
Wilfred Hughes 92fa3fb3de Ensure files with no common content are aligned 2024-07-20 23:43:04 +07:00
Wilfred Hughes ffe27c575e Ensure line splitting distinguishes "foo" and "foo\n"
We rely on being able to split lines and rejoin them to obtain the
original string. `str::lines()` in the Rust stdlib does not have this
property.

This was causing crashes in word-diffing on textual diffing, where
code paths differed on the number of lines they thought a string had.

This was broken in 8b842387a1.

Fixes #688.
2024-07-20 16:09:44 +07:00
Wilfred Hughes 7827a059cb Update F# expected output 2024-05-25 14:58:14 +07:00
Wilfred Hughes d92b65c5fd Merge remote-tracking branch 'thecentury/f#' 2024-05-14 09:46:55 +07:00
Wilfred Hughes d292546df7 Prefer 'device tree' as two words 2024-05-13 16:59:48 +07:00
Wilfred Hughes d3e5aa5232 Merge remote-tracking branch 'blmaier/support-devicetree' 2024-05-13 16:50:13 +07:00
Wilfred Hughes 28d8673371 Treat tree-sitter nodes highlighted as comments as atoms
Fixes #711
2024-05-11 22:03:59 +07:00
Wilfred Hughes e51834fa77 Support comment.foo highlighting queries
This should improve highlighting in cases like Elm that use
`@comment.elm`.
2024-05-11 16:08:29 +07:00
Wilfred Hughes 5c40cd0282 Prefer _1 and _2 naming for test files
This is less to type, and it's now alphabetical, so e.g.
sample_files/*.kt just works as a test argument.
2024-04-28 23:28:06 +07:00
Wilfred Hughes 2e016566ac Update CSS parser 2024-04-28 21:45:25 +07:00
Wilfred Hughes 38f148df1f Don't flatten error nodes
As of b9d44ae65f (released in 0.38), difftastic prefers a textual
diff if any parse errors are present. As a result, users have to
opt-in to allowing parse errors. We can now preserve structure to
produce diffs that are more granular, at the slight risk of changes
being missed if parsers discard tokens.

Fixes #703
2024-04-28 17:28:34 +07:00
Wilfred Hughes 3be8e80fe7 Fix issue with later lines not having positions during diffing 2024-03-19 00:25:18 +07:00
Wilfred Hughes b78f7d447b Always replace tabs, even in single-column display
Fixes #617
2024-03-04 21:38:23 +07:00
Wilfred Hughes 7ddd8879b1 Merge branch 'scheme-support' of github.com:kutsurak/difftastic into kutsurak-scheme-support 2024-03-04 08:46:59 +07:00
Wilfred Hughes 53298e4240 Set a length limit on lines when doing a word diff
See #653
2024-02-29 00:54:55 +07:00
Brandon Maier e6b27caf06 Add support for devicetrees 2024-02-28 17:11:53 +07:00
Wilfred Hughes 7a00339977
Merge pull request #634 from evanrichter/smali
Smali language support
2024-02-19 11:57:54 +07:00
Wilfred Hughes 4fef3f7b00 Update regression test for QML parser 2024-02-15 23:40:56 +07:00
Wilfred Hughes e70224bb22 Update regression tests for new JS/TS parsers 2024-02-15 08:30:57 +07:00
Panagiotis Koutsourakis 67ada1ccd4 Add support for Scheme 2024-02-12 10:20:57 +07:00
Evan Richter d106c979ee add smali language support 2024-02-01 15:41:14 +07:00