Commit Graph

2074 Commits

Author SHA1 Message Date
Dan Davison
823e852583 Fall back to diff if git diff fails due to lack of support for process substitution 2024-08-04 09:15:37 -04:00
Dan Davison
de7d32013b Use enum 2024-08-04 09:03:11 -04:00
Dan Davison
7acc55aa17 Revert "wip"
This reverts commit 915ff02134.
2024-08-04 08:58:30 -04:00
Dan Davison
027e78e8a2 wip 2024-08-04 08:50:44 -04:00
Dan Davison
915ff02134 wip 2024-08-04 08:49:58 -04:00
Dan Davison
17784285a1 Don't print entire --help text 2024-08-04 08:27:23 -04:00
Dan Davison
2bc8444546 Set unified context iff needed 2024-08-02 08:01:59 -04:00
Dan Davison
dbfa90ffbf Improve behaviour on error of external diff process 2024-08-01 22:04:21 -04:00
Dan Davison
c8bd7f0544 Suggestions from code review 2024-08-01 21:46:58 -04:00
Dan Davison
47a6177e00 Implement --diff-args 2024-08-01 21:46:56 -04:00
Thomas Otto
0712274996 Cargo toml dependencies all in one block, sorted 2024-08-01 21:40:55 -04:00
Thomas Otto
f441d4d083 Fix build for rust 1.80
Upgrade "time" (and its dependency chain rooted at "plist"), the previous
version did not build with 1.80.

Tell the new 'unexpected_cfgs' lint that 'tarpaulin_include' is okay

Mark one clippy lint as a false positive
2024-08-01 21:40:55 -04:00
Thomas Otto
e0274867cd Use angle bracket around <urls>, regenerate help output markdown 2024-08-01 21:40:55 -04:00
Thomas Otto
d2765a489e Wrap --help output and use pager
Tell clap to not wrap output, append `after_long_help()` (with matching
ansi codes in this section), then manually wrap the result.

The help output is now paginated if writing to a terminal.

All code paths flow back to main(), so an invoked pager is properly
waited for (by the OutputType drop impl).
2024-08-01 21:40:55 -04:00
Thomas Otto
6ef193250a Add wrap function for --help output
Unicode and somewhat ANSI aware, can add indentation (skippable) and
can also skip wrapping lines by using configurable magic prefixes.
2024-08-01 21:40:55 -04:00
Thomas Otto
546e0ed412 Make drop impl of OutputType more prominent 2024-08-01 21:40:55 -04:00
Thomas Otto
c5f7428edd OutputType: PagerCfg and oneshot_write
Use new, smaller PagerCfg instead of the full Config, as for
pager output only 3 variables are relevant.

oneshot_write() can be used to write paginated output, usually
before exiting.
2024-08-01 21:40:55 -04:00
Rui Chen
587fe8f078 chore: cleanup brew formula file in favor of core tap
Signed-off-by: Rui Chen <rui@chenrui.dev>
2024-07-28 10:37:03 -04:00
Thomas Otto
21695da83a Add --max-syntax-highlighting-length, set to 400
--max-line-length increased to 3000, highlighting now stops after 400
characters. In that case the highlighting may be incorrect until it
is reset for the next hunk.
2024-07-22 02:54:31 +01:00
Thomas Otto
6205118b85 Add truncate_str_short() which always returns a prefix of the input
Document that the input of `truncate_str()` may be cut on a double width
char ("fullwidth") - then the output is no longer a prefix of the input.

`truncate_str_short()` could be faster by not constructing the result and
instead only returning an index, but it will be used in rare edge cases so
reusing existing logic is good enough.

Common code moved to `truncate_str_impl()`.

Assume (with fallback) that graphemes are at most 2 wide.
Fewer allocations.
Tests.
2024-07-22 02:54:31 +01:00
Tau Gärtli
841d559a84 Disable light mode detection in tests (#1765) 2024-07-21 20:41:23 -04:00
Tim Hill
95b2689d4a Update syntect to 5.2.0 (#1672) 2024-07-17 10:23:46 -04:00
Justin Su
26d764a209 Fix copy-paste typo (#1767)
Accidentally introduced in #1744
2024-07-17 09:33:26 -04:00
Justin Su
07e951db22 Add missing --file-*-label option to --navigate docs (#1744)
Also sort the options alphabetically
2024-07-17 05:28:53 -04:00
wangweijie
c1e8e7b163 deps: bump libc from 0.2.153 to 0.2.155 (#1715)
Signed-off-by: wangweijie <wangweijie@loongson.cn>
2024-07-17 05:22:02 -04:00
Justin Su
f2c43ae0f3 Fix a typo to make Catppuccin Latte detected as light theme (#1745)
Also sort `LIGHT_SYNTAX_THEMES`
2024-07-17 05:18:00 -04:00
Thomas Otto
048ae76aaa Make less version >= 633 behave like previous versions wrt. Nerd Fonts
Sets `LESSUTFCHARDEF` (unless already present), a new env var introduced
by this less version to always print characters from the Private Use Area
of Unicode as-is, even if the terminal does not understand them.
2024-07-17 10:13:59 +01:00
Tau Gärtli
c4803e6825 Update terminal-colorsaurus (#1699)
* Update terminal-colorsaurus to 0.4.0

* Update `terminal-colorsaurus` with bugfix

> * 🐛 Fixed `OSC 11` response being visible to users of GNU Screen
     by detecting Screen and erroring before sending any control sequences (bash/terminal-colorsaurus#16).

* Update `terminal-colorsaurus` to 0.4.3
2024-07-16 13:39:59 -04:00
Edwin Hermans
4127abc807 Fix github links from master to main (#1709)
* Fix github master to main URLs

The commit history of `master` is now empty, so only the PR list link fails (and didn't get rendered as link before anyway).
I'm fixing all the links I could find with a cursory search just to clean things up.

* Update how-delta-works.md master to main

* Update color-moved-support.md master to main

* Update ARCHITECTURE.md master to main
2024-07-12 08:04:06 +01:00
Thomas Otto
5d538b2303 Make relative-paths work with binary files
`relativize_path_maybe()` was not called in this case. Added
test and converted a few existing ones to insta.
2024-07-09 00:00:18 +01:00
Thomas Otto
995dc41525 Make relativize_path_maybe directly update the path argument
This simplifies the call sites.
Also skip updating if the path is already absolute, and handle
'/dev/null' on Windows so it is no longer converted to '\dev\null'.
2024-07-09 00:00:18 +01:00
Thomas Otto
c9d72d0d89 gitignore: add pending insta snapshots 2024-07-09 00:00:18 +01:00
Dan Davison
0d7c5afa5c Add a manual entry for toggling side-by-side 2024-07-08 05:44:25 -04:00
Thorou
716fa79500 Fix panic when blame-palette is empty (#1737)
* Fix panic when blame-palette is empty

* Move check to config.rs
2024-07-08 03:42:59 -04:00
Thomas Otto
d7a22a7cf9 tests: set terminal width to 43 (#1741)
Make tests more deterministic by not allowing them
to "see" the current terminal width.
2024-07-07 04:33:15 -04:00
Thomas Otto
096941f77f tests: add insta for snapshot testing (#1739)
Insta makes writing new tests or performing changes which update the
expected value(s) easier. The new reference data can be reviewed
and inserted/updated automatically by `cargo insta review` (after
`cargo install cargo-insta`, but that tool is optional).

The snapshots are stored inline using the `@""` syntax and not in
separate files because the delta test output is small and designed to
be human readable.

See https://insta.rs/#hello-snapshot-testing
and https://docs.rs/insta/1.39.0/insta/
2024-07-06 10:35:06 -04:00
Thomas Otto
f5b37173fe Don't read git files when --no-gitconfig is given + unused variables (#1728)
* Fix unused variables

* Don't read git files when --no-gitconfig is given

Despite starting delta with `--no-gitconfig`, strace still shows
that `.git/config` etc. files are accessed. By no longer doing
that it is very clear that no config options are read from there.
2024-06-24 13:26:28 -04:00
martinml
0f8a2f0786 Only use nosort in bash <4.4 (#1683)
* Only use `nosort` in bash <4.4

* Fix bad parameter order
2024-05-10 13:05:29 -04:00
Thomas Otto
97839c61c8 CI: fix macOS build (#1696)
macos-latest defaults to aarch64 as of ~2024-04
2024-05-06 19:39:19 -04:00
Dan Davison
d995bf76cf clippy (#1686) 2024-05-04 10:00:44 -04:00
Thomas Otto
711353b4dd tests: prevent parallel env var access (#1681)
`env::set_var` is not-yet-unsafe, and here tests fail
because a var is already set by a second test while the first one
is still running.

`cargo test -- test_env` with sufficient (auto detected) parallelism
triggers this.
2024-05-04 09:45:37 -04:00
Thomas Otto
3b953daac7 Repair --default-language, and highlight using full filename (#1549)
* Fix clippy warnings

* Repair --default-language, and highlight using full filename

Fixed that the "txt" fallback was used instead of --default-language

And when looking for syntax highlighting, keep the filename around
as long as possible.

Using simple custom logic (filename > 4) a Makefile can be highlighted
with make syntax, but a 'cc' or 'ini' file does not get treated like
a *.cc or *.ini file.

Currently the underlying highlighting lib syntect and the sublime syntax
definitions can not make this distinction
(<http://www.sublimetext.com/docs/syntax.html>).
2024-05-04 09:44:39 -04:00
Dan Davison
3c6c50e4f5 Add documentation help regarding autodetection and light/dark settings 2024-03-22 07:34:34 -04:00
Phillip Wood
ffaaba9890 add .gitattributes rules for rust files (#1245)
While delta currently removes git's whitespace error markup from diffs
adding the whitespace rules will mean pre-commit hooks that run `git
diff --check` will reject changes with whitespace errors. In order to
get git to print the correct position of the error when there is an
unwanted tab in the indent following a space it is necessary to turn off
`space-before-tab` otherwise the space will be considered to be an error
instead of the tab.

The whitespace rule could perhaps be applied more widely but the
Makefile and example gitcofig have leading tabs so it is restricted them
to just rust files for now.
2024-03-17 14:08:50 -04:00
Phillip Wood
4b80dfb04c Stop highlighting unchanged whitespace (#1659)
Fix a regression introduced by feec45b (Fix warning highlight for
trailing whitespace (#1037), 2023-05-17) where trailing space at the end
of an unchanged token is highlighted if the token follows an insertion.
This happens because when the token is split in two to separate trailing
whitespace the two halves end up being tagged with different edit
operations. This can be seen in the test changes in
`test_infer_edits_14` and `test_infer_edits_16` introduced by feec45b
which changed the operation from `PlusNoop` to `Insertion` when
splitting trailing whitespace from unchanged tokens. Fix this by using
the same operation when adding both halves of a split token and
correcting the tests.

Fixes #1658
2024-03-17 10:17:49 -04:00
Tau
1ea5ee87a5 Link to repository from manual (#1657) 2024-03-16 12:25:08 -04:00
Dan Davison
23b967db8a Stop running bump-homebrew-formula
It looks like delta tags/releases are automatically detected:

https://github.com/Homebrew/homebrew-core/blob/master/.github/autobump.txt
https://github.com/dandavison/delta/actions/runs/8308431801/job/22738650426
2024-03-16 10:34:46 -04:00
Dan Davison
ad1df2d680 Update README 2024-03-16 10:30:50 -04:00
Dan Davison
13c8219799 Bump version 0.17.0 2024-03-16 10:25:15 -04:00
Dan Davison
a6cd23c48f Upgrade bat (#1656) 2024-03-16 10:24:40 -04:00