Commit Graph

314 Commits (master)

Author SHA1 Message Date
Wilfred Hughes 5b28c34eea Fix incorrect display width calculation
Previously we assumed that line numbers always required 4 characters to
display (3 digits plus a space). This should be calculated properly
and was probably a placeholder value when testing the original
implementation.

Instead, use the actual width of the rendered line numbers.
2025-11-16 01:26:23 +07:00
Wilfred Hughes 0a3f8c2f92 Merge adjacent spans to normalise output in regression tests 2025-11-15 02:40:43 +07:00
Wilfred Hughes 3943c1401a Don't consider - as a word character
This produced some unfortunate subword diffs when mixing words, numbers and
hyphens.

Fixes #918
2025-11-14 16:42:25 +07:00
Wilfred Hughes 77ade2e765 Fix file name confusing compare script because it has multiple _1 2025-10-23 10:03:36 +07:00
Wilfred Hughes 3c2d70b80d Update expected output for hyphen subword fix 2025-10-23 10:01:58 +07:00
Antonin Delpeuch 2a65dd7e02
Migrate to tree-sitter-sequel (#905)
For #891.
2025-10-15 00:52:40 +07:00
Antonin Delpeuch 85bda2f11b Unvendor tree-sitter-racket 2025-10-09 22:55:12 +07:00
Antonin Delpeuch 35f63d1015 Unvendor tree-sitter-devicetree 2025-10-06 21:52:29 +07:00
Wilfred Hughes 84d037343d Fix overly wide columns when last hunk is near start of file 2025-10-05 00:27:18 +07:00
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
Bryce Berger 32a5a16dfd compare_all.sh: get difft binary using `cargo metadata`
I have cargo configured to have a global target directory (in my case,
at /tmp/cargo). The output directory for cargo builds is not guarunteed
to be at ./target.

This could alternatively be solved by the user with strange defaults
(me) making a symlink like `ln -s /tmp/cargo ./target`, which doesn't
require having `jq` installed.
2025-06-08 10:04:42 +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 d920839be1 Configure typos for more directories and fix issues found 2025-03-31 23:35:27 +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
crbelaus c5527634b8 Add Elixir example files 2025-02-10 09:04:49 +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
Wilfred Hughes 5a51c02157 Fix crash when the last hunk includes the trailing newline at EOF
Input cleaning should happen before we diff the content, not during
display. Previously display would crash due to line numbers
referencing the line that had been stripped.

Fixes #713
Fixes #739
Fixes #742
2024-07-26 08:54:20 +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 a9bcee7733 Add sample conflicts file
This is already referenced in the manual.
2024-05-14 10:14:05 +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