summaryrefslogtreecommitdiff
path: root/src/utils/mod.rs
AgeCommit message (Collapse)Author
2024-11-28Support external subcommands: rg, diff, git-show (etc.) (#1769)Thomas Otto
* Support external subcommands: rg, git show, git log (etc.) The possible command line now is: delta <delta-args> [SUBCMD <subcmd-args>] If the entire command line fails to parse because SUBCMD is unknown, then try (until the next arg fails) parsing <delta-args> only, and then parse and call SUBCMD.., its output is piped into delta. Other subcommands also take precedence over the diff/git-diff mode (`delta a b`, where e.g. a=git and b=show), and any diff call gets converted into an external subcommand first. Available are: delta rg .. => rg --json .. | delta delta a b .. => git diff a b .. | delta delta git show .. => git <color-on> show .. | delta and all other git-CMDS, of which add -p, blame, checkout -p, diff, grep, log -p, reflog -p, and stash show -p produce a diff. Because --json is automatically added for `delta rg ..`, it avoids the parsing ambiguities of and is easier to type than `rg .. | delta`. The piping is not done by the shell, but delta, so the subcommands are now child processes of delta. * Set calling process directly because delta started it This info then takes precedence over whatever start_determining_calling_process_in_thread() finds or rather doesn't find. (The simple yet generous SeqCst is used on purpose for the atomic operations.)
2024-08-15Support passing arguments to git diff and diff (#1697)Dan Davison
Adds --diff-args with short form -@.
2024-08-01Add wrap function for --help outputThomas Otto
Unicode and somewhat ANSI aware, can add indentation (skippable) and can also skip wrapping lines by using configurable magic prefixes.
2023-05-31Misc tab refactoring (#1424)Thomas Otto
* Move tabs logic into utils * Re-use buffer returned by tabs::expand * Add TabCfg to configure tabs Use the String from this config for the tab replacement. This avoids creating a new String for each processed line. * Avoid unicode segmentation for each line just to remove a prefix In some code paths no prefix is removed, and in almost all other cases the prefix is just ascii. This simplifies a lot of calls. * Set default tab with to 8 Editors like vim, emacs, nano and most terminal emulators set this value as the default tab display width.
2022-10-11Add terminal width fallback via stty if on Windows/MSYS2Thomas Otto
Also new workarounds.rs file, and DELTA_NO_WORKAROUNDS env var to disable these.
2022-07-02Don't attempt to process ANSI sequences in non-UTF8 inputDan Davison
Fixes #677
2022-02-14Fix hyperlink absolute paths (#939)Dan Davison
Fix file paths and hyperlinks With this commit the target of a hyperlink should always be an absolute path. This should be true for all file hyperlinks, e.g. - File hyperlink - Hunk header hyperlink - Line number hyperlink Fixes #890
2022-01-17Construct hyperlink file path relative to cwdDan Davison
Fixes #890
2022-01-06New option file-transformation to transform file pathsDan Davison
2021-11-15Refactor: utils moduleDan Davison