Commit Graph

1904 Commits

Author SHA1 Message Date
Dan Davison
b4ae4c47fb Bump version in private Homebrew formula 2022-12-03 09:33:41 -08:00
Dan Davison
373c8b131c Bump version in links to executables 2022-12-03 09:32:28 -08:00
Dan Davison
df11d18e82 Bump version in Cargo.lock 2022-12-03 07:05:33 -08:00
Dan Davison
eaa2c55d94 Bump version 2022-12-03 07:01:05 -08:00
Sheldon Nico
54e1ee79c7
try fix bad alignment in unicode (#1144) (#1145)
* try fix bad alignment in unicode (#1144)

* use width instead of count in wrap_line

* fix fmt

* 3 tests do not need fail

* fix tests

Co-authored-by: Thomas Otto <th1000s@posteo.net>
2022-12-03 06:59:06 -08:00
Marco Ieni
667d44c885
ci: release apple arm binary (#1239)
* ci: improve formatting

* ci.yaml: apply new formatting

* ci: release apple arm binary

* use cross for mac arm

* wip

* do not use cross

* install targets
2022-12-03 06:45:26 -08:00
Phillip Wood
96c2fa8673
Highlighting improvements (#1244)
* Stop ignoring a passing test

edits::tests::test_infer_edits_12 passes so there is no need to ignore
it.

* Refactor Levenshtein tests

Reduce the amount of repetition and specify the Levenshtein distance
explicitly in preparation for changing the Levenshtein calculation and
adding more tests in a future commit. As there are quite a few inputs to
each test use a struct rather than a plain function for the tests as
this effectively provides named parameters for the inputs.

* Highlight deletions before insertions

When a token has moved within a line try to highlight it as a deletion
followed by an insertion. Currently

    -'b '
    +' b'

is highlighted as

    -'b[ ]'
    +'[ ]b'

as if the space has moved to the left, instead highlight it as

    -'[b] '
    +' [b]'

as if the "b" has moved to the right. As the changes to the tests show
this also tends to favor a longer match at the start of the line.

* Don't highlight an unchanged trailing space

Only unchanged space between changed tokens should be highlighted, if
the line ends with an unchanged space then the space should not be
highlighted.

* Try to group highlighted changes together

Sometimes the highlighting of a change is not as clear as it could
be. For example the change

    -printf "%s\n" s y y ...
    +test_write_lines s y n ...

is highlighted as

    -[printf "%]s[\n"] [s ]y y ...
    +[test_write_lines ]s y y ...

rather than

    -[printf "%s\n"] s y n ...
    +[test_write_lines] s y y ...

This is because the Levenshtein distance calculation only checks if
the current tokens match without considering if the previous tokens
matched or not. Adding a small penalty for starting a run of changed
tokens forces the changes to be grouped together whenever possible. A
knock on effect of adding the penalty is that the cost a substitution
needs to be increased relative to the cost of an insertion/deletion
otherwise the lowest cost for "ab" -> "ba" is two substitutions rather
than an insertion, match and deletion.

There are several changes to the tests

 - the Levenshtein distance is updated to reflect the new calculation in
   tests::align::*

 - several new tests are added to tests::align to check the grouping of
   different combinations of insertions and deletions

 - tests::edits::test_infer_edits_10 shows an improvement in the
   highlighting as the unchanged space at the end of the changed tokens
   is no longer highlighted. This is because it is no longer considered
   to be deleted by the Levenshtein matching as deleting the space
   between the deleted words now has a lower cost.

 - there is a new test in tests::edits using the example in this
   message.

* Stop using substitutions in Levenshtein calculation

Now that the lowest cost edit path groups deletions and insertions
together there seems to be little point in keeping substitutions. Indeed
the lower cost of substitutions compared to a deletion followed by an
insertion can adversely affect the highlighting. If the length of the
line does not change delta will prefer to use substitutions over
deletions and insertions even if it results in unchanged tokens being
marked as changed. For example in

    -[a] a a a a a [b b b]
    +[c] a a a a a [a c c]

unchanged tokens are marked as deleted and inserted. Without
substitutions this is highlighted as

    -a a a a a a [b b b]
    +[c ]a a a a a a [c c]

which highlights the insertion at the beginning of the line and the
change at the end of the line more clearly.

There is a change to the distance calculation as substitutions only
contributed the length of the deletion whereas now the same change will
add the length of both the deletion and the insertion. This is addressed
by doubling the contribution of unchanged sections so that the
denominator equals the sum of the distance contributions of the plus
line and minus line.
2022-11-29 11:00:01 -05:00
Marco Ieni
d6db040421
ci: improve formatting (#1238)
* ci: improve formatting

* ci.yaml: apply new formatting
2022-11-27 12:40:07 -05:00
Thomas Otto
afa7a1a38d Handle quoted filenames in diff header
Otherwise the file extension would return 'rs"' which does not
match any language.
2022-11-15 07:40:49 -05:00
Witold Baryluk
b5ed58da71
Remove Provides in Debian package (#1217)
Remove Provides in Debian package as this is incorrect usage of this flag.

To provide two versions of packages `Conflicts` as used is sufficient.

See Debian Policy Manual (v4.6.1.1) section 7.5

When at it Remove trailing dot in Description header to comply with section 5.6.13
Fixes: https://github.com/dandavison/delta/issues/1210
2022-11-15 07:35:15 -05:00
clnoll
6b2d0b7fc8
Fix clippy warnings (#1236) 2022-11-13 18:54:39 -05:00
Adam Johnson
5ce2efbc6b
Remove Git 2.37 workaround from install docs (#1228) 2022-11-05 06:21:22 -04:00
Thomas Otto
970000f368 measure_text_width() without constructing a temporary string 2022-10-24 17:46:13 -04:00
Thomas Otto
60492f318f Add terminal width fallback via stty if on Windows/MSYS2
Also new workarounds.rs file, and DELTA_NO_WORKAROUNDS env var
to disable these.
2022-10-11 16:19:25 -04:00
Thomas Otto
65044c0e0d Fix clippy warnings after rust 1.64 upgrade 2022-10-11 16:19:25 -04:00
Chinmay Dalal
ae4f774936
Add codeberg link parsing (#1194) 2022-10-06 13:38:30 -04:00
Dan Davison
a7bab81665 Clarify that rg --json | delta is the only fully correct grep handler
Closes #1197
2022-09-29 12:50:16 -04:00
Maxim Zhiburt
1193d54d5c
Refactoring ansi/iterator (#1191)
Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>
2022-09-15 00:54:35 -04:00
Dan Davison
4e05ee5ef4 Check that new version number is present in docs
Ref #1192
2022-09-14 17:15:42 -04:00
Dan Davison
d9d80436ba Bump version in links to executables
Fixes #1192
2022-09-14 16:37:07 -04:00
Chinmay Dalal
d16ed23e73
Add sourcehut link parsing (#1190)
* Add sourcehut link parsing

* refactor: GitRemoteRepo::GitHubRepo -> ..::GitHub, repo_slug -> slug

https://rust-lang.github.io/rust-clippy/master/index.html#enum_variant_names

* readme.md: change bitbucket to sourcehut
2022-09-14 15:39:23 -04:00
Marcin Puc
cc0f1dd968
Switch bat to library mode (#1187) 2022-09-13 11:53:47 -04:00
Dan Davison
06cbbf7cc4 Edit CONTRIBUTING.md 2022-09-06 19:39:47 -04:00
Dan Davison
ab39c1dc0f Add note about git config env vars to configuration manual page. 2022-09-05 10:52:04 -04:00
Dan Davison
2984a8b9d3
Change Rust toolchain in 'Deploy Manual' CI task (#1183) 2022-09-05 10:28:53 -04:00
Dan Davison
052b8bdcbf New manual content: environment variables and configuration.
Ref #1113
2022-09-05 10:05:07 -04:00
Dan Davison
5c570f4931 Bump private homebrew formula 2022-08-31 21:50:15 -04:00
Dan Davison
5d961f4e79 Whitespace formatting 2022-08-31 21:45:42 -04:00
Dan Davison
2004c4e363 Bump version in links to executables 2022-08-31 21:32:40 -04:00
Dan Davison
db0a9cffda Bump version 2022-08-31 16:55:39 -04:00
exploide
df3ec7fa01 added auto completions for fish shell 2022-08-19 15:23:18 -04:00
mliszcz
b99e6c5d9c Fix clippy warnings after rust 1.63 upgrade
Following fixes are included:

* derive_partial_eq_without_eq:
  Eq trait was added by running `cargo clippy --fix --no-deps`.
* get_first:
  Function was replaced by running `cargo clippy --fix --no-deps`.
* unnecessary_to_owned:
  This check was disabled for ANSIString as to_string call is required
  to enforce formatting. Otherwise the underlying string was returned
  directly (probably due to Deref implementation).
* type_complexity:
  Closure type was simplified and Box<> usage was removed.
2022-08-16 18:17:10 -04:00
mliszcz
6d96b78502 Support configurable timestamps in git blame output (#1157)
New CLI/config option is introduced: blame-timestamp-output-format.

Fixes #1157.
2022-08-16 18:17:10 -04:00
mliszcz
f8bb6e4711 Update --help output in manual for 0.13.0 2022-08-16 18:17:10 -04:00
Kian-Meng Ang
738c5a141b
Fix typos (#1151)
Found via following command:

    codespell -L crate,nin,numer,struc,ded,fo
2022-08-07 10:42:36 -04:00
Stefan Schnyder
2d739d1813
chameleon theme update (#1138) 2022-08-01 08:23:58 -04:00
Jackson Popkin
b3cc0f8cae
Fix git-grep match-highlighting at line-start (#1057)
* Fix git-grep match-highlighting at line-start

This commit fixes highlighting the part of the line of code that matches
the git grep query in cases where the match starts at the beginning of
the lines.

Fixes #1056.

* Fix handling of non-match highlight

In some cases, `git grep` will customize the foreground-color for more
than just the subset of the line that matches the grep pattern. This
breaks the current match-detection behavior, which considers any
characters with a non-default "foreground color" within the "code" part
of a git-grep-ouput-line to be part of the match. This commit makes
match-detection check for boldness and a red foreground instead of just
checking for a non-default foreground-color.

git grep matches are bold and red by default. But git grep isn't the
only reason input to delta may contain color codes; there may still be
cases where the highlighting looks wrong here.
2022-07-15 21:58:05 -04:00
Dan Davison
f556db8d4e
Recreate highlighter on each line of git show $commit:$path output (#1127)
Prior to this commit, syntax highlighting of scala code was not
correct in `git show $commit:$path` output. It was working for other
languages as far as I know. I'm not sure why.
2022-07-15 08:39:33 -04:00
Dan Davison
f3b6c454b2 Revert "Bump git2 from 0.14.2 to 0.14.4 (#1085)"
This reverts commit 511d501d5e.
2022-07-05 10:23:41 -04:00
Dan Davison
b6e4d90a14
Update clap (#1119) 2022-07-04 18:25:24 -04:00
dependabot[bot]
b0bed17ccb
Bump itertools from 0.10.1 to 0.10.3 (#835)
Bumps [itertools](https://github.com/rust-itertools/itertools) from 0.10.1 to 0.10.3.
- [Release notes](https://github.com/rust-itertools/itertools/releases)
- [Changelog](https://github.com/rust-itertools/itertools/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-itertools/itertools/compare/v0.10.1...v0.10.3)

---
updated-dependencies:
- dependency-name: itertools
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-04 12:30:49 -04:00
dependabot[bot]
71a2243278
Bump serde_json from 1.0.70 to 1.0.82 (#1115)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.70 to 1.0.82.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.70...v1.0.82)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-04 12:30:26 -04:00
dependabot[bot]
511d501d5e
Bump git2 from 0.14.2 to 0.14.4 (#1085)
Bumps [git2](https://github.com/rust-lang/git2-rs) from 0.14.2 to 0.14.4.
- [Release notes](https://github.com/rust-lang/git2-rs/releases)
- [Commits](https://github.com/rust-lang/git2-rs/compare/0.14.2...0.14.4)

---
updated-dependencies:
- dependency-name: git2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-04 12:30:13 -04:00
dependabot[bot]
fe186677d7
Bump smol_str from 0.1.21 to 0.1.23 (#1058)
Bumps [smol_str](https://github.com/rust-analyzer/smol_str) from 0.1.21 to 0.1.23.
- [Release notes](https://github.com/rust-analyzer/smol_str/releases)
- [Commits](https://github.com/rust-analyzer/smol_str/compare/v0.1.21...v0.1.23)

---
updated-dependencies:
- dependency-name: smol_str
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-04 11:48:47 -04:00
dependabot[bot]
b2e43935a1
Bump ctrlc from 3.2.1 to 3.2.2 (#1055)
Bumps [ctrlc](https://github.com/Detegr/rust-ctrlc) from 3.2.1 to 3.2.2.
- [Release notes](https://github.com/Detegr/rust-ctrlc/releases)
- [Commits](https://github.com/Detegr/rust-ctrlc/compare/3.2.1...3.2.2)

---
updated-dependencies:
- dependency-name: ctrlc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-04 11:48:32 -04:00
dependabot[bot]
1472a87f4a
Bump sysinfo from 0.23.0 to 0.24.5 (#1108)
Bumps [sysinfo](https://github.com/GuillaumeGomez/sysinfo) from 0.23.0 to 0.24.5.
- [Release notes](https://github.com/GuillaumeGomez/sysinfo/releases)
- [Changelog](https://github.com/GuillaumeGomez/sysinfo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/GuillaumeGomez/sysinfo/commits)

---
updated-dependencies:
- dependency-name: sysinfo
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-04 11:46:39 -04:00
dependabot[bot]
1e008f835a
Bump bytelines from 2.2.2 to 2.4.0 (#1034)
Bumps [bytelines](https://github.com/whitfin/bytelines) from 2.2.2 to 2.4.0.
- [Release notes](https://github.com/whitfin/bytelines/releases)
- [Commits](https://github.com/whitfin/bytelines/compare/v2.2.2...v2.4.0)

---
updated-dependencies:
- dependency-name: bytelines
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-04 11:06:36 -04:00
Dan Davison
ab8015e4f7 Don't attempt to process ANSI sequences in non-UTF8 input
Fixes #677
2022-07-02 17:07:29 -04:00
Connor Braa
5f8ac5f717
Update README.md to include git 2.37.0 workaround (#1116)
see https://github.com/dandavison/delta/issues/1114
2022-07-01 15:04:56 -04:00
Dan Davison
1dab1a87ba Fix documentation of DELTA_FEATURES 2022-06-25 11:59:50 -04:00