Commit Graph
51 Commits
Author SHA1 Message Date
Scott Baker e90c8e5b29 Allow calling DH directly as a script as well as a loadable module 2026-03-18 09:20:45 -07:00
Scott Baker ac156a340e Change theme variables to our to allow setting them from the outside
If theme variables aren't set from outside the module we fall back to
loading them from the ~/.gitconfig
2026-03-18 09:13:46 -07:00
Scott Baker 91e1feff58 Drop requirements to Perl v5.8 because we're not using any fancy features 2026-03-18 08:56:54 -07:00
Scott Baker b1f825a0ed Start with the vanilla DiffHighlight.pm from 2026-03-18 2026-03-18 08:55:37 -07:00
Scott Baker 03f366ac5e BUGFIX: Corner case where removing a \n from the end of a file adds extra newlines
https://github.com/so-fancy/diff-so-fancy/issues/474
2026-03-17 15:33:43 -07:00
Scott Baker 3132702b6b Upstream DiffHighlight.pm fixes
We have a customer diffhighlight, so we cherry pick some of the simple
pieces for our use case
2026-03-12 10:50:27 -07:00
Scott Baker 5c4da1ccea Correct the diff-highlight defaults 2021-05-31 16:52:45 -07:00
Scott Baker 5ad99c0271 Use the default diff-highlight colors. Addresses #374 2021-05-31 12:58:03 -07:00
Scott Baker 4ef5a78eca Use the cached git config to set the DiffHiglight colors
This should speedup start up a decent amount
2021-05-18 10:15:54 -07:00
Scott Baker d4eb9da614 Remove the STDERR redirect to speed up execution 2021-05-17 20:53:36 -07:00
Scott Baker 77de3bd63b Update DiffHighlight.pm to (hopefully) address #199 2019-06-24 10:09:49 -07:00
chris 67f58c8fbb Fix so-fancy#311 Windows doesn't have '\dev\null'
Update DiffHighlight to use File::Spec->devnull() to avoid platform problems.
2019-01-19 11:30:45 -08:00
Scott Baker f31626393b Change the d-h defaults to our d-s-f defaults 2018-01-03 14:28:39 -08:00
Scott Baker 5c96bddd5b Colorize file add/deletes (#253) 2017-07-19 21:39:19 -07:00
Scott Baker 066ad1cbac Don't auto-convert everything to UTF-8 which should work around weird encodings
Potentially addresses #203
2017-07-10 14:12:11 -07:00
Scott Baker 0ae3e58e95 Don't bomb on our invalid UTF8 2017-07-10 10:46:50 -07:00
Scott Baker 29c08025e3 Make d-s-f handle file renames better. Addresses #213 2017-07-05 08:58:36 -07:00
Scott Baker f3dbd2dacf Add the initial DiffHighlight.pm stuff to the script 2017-07-05 08:58:22 -07:00
Steve Mao fb8eba11ac change lib/ to libexec/
fixes https://github.com/Homebrew/homebrew-core/pull/3663#issuecomment-238010069
2016-08-08 21:40:05 +10:00
Frank Schumacher 2fa9897e5d Add setting to allow disabling of unicode ruler
This commit adds a single setting to allow users
to disable the use of the unicode em-dash that is being used
as a horizonal ruler character for marking the changed filename.

It defaults to the current bahaviour of using em-dash.

Setting `diff-so-fancy.useUnicodeRuler` to `false` will use a simple
dash (minus sign) instead.
2016-07-15 10:04:26 +02:00
delphinus b1bfb11dcb Fix to avoid warnings for old Perl 2016-06-23 14:56:56 +09:00
delphinus f9a35fa4cd Fix for old Perl. additional to 280b97f 2016-06-23 14:56:45 +09:00
Scott Baker 280b97f314 Fix for #175, Perl's prior to 5.10 did not know the // operator 2016-06-21 07:55:34 -07:00
Scott Baker 954bc7f938 Fix a Perl Critic error and make some code more readable
Subroutine "get_less_charset" does not end with "return" at line 267, column 1. See page 197 of PBP.
2016-06-15 08:12:36 -07:00
Scott Baker 5d487f41cd Fix a Perl Critic error
I/O layer ":utf8" used at line 12, column 1. Use ":encoding(UTF-8)" to get strict validation.
2016-06-15 08:12:12 -07:00
Scott Baker 2a7590b10e Merge pull request #168 from scottchiefbaker/handle_latin1
Properly handle latin1 encoded text
2016-06-15 07:57:39 -07:00
Greg f5c8abc702 Do not use hardcoded "/usr/bin/perl" path 2016-06-15 01:28:10 +04:00
Tuomas Siipola 7298fddf7a Fix code style 2016-06-14 20:37:52 +03:00
Tuomas Siipola 04c071550f Handle all binary file modifications similiar to text files
Format correctly modify, add, delete and rename operation titles on
binary files.
2016-06-14 19:57:45 +03:00
Scott Baker e74fdbbb5c Properly handle latin1 encoded diffs
aka: fail gracefully
2016-06-14 08:33:33 -07:00
William Boman 23f265c640 don't print characters that we know will be incompatible with less(1) 2016-05-25 01:36:13 +02:00
William Boman d50eded750 fix unicode output 2016-05-24 23:14:55 +02:00
Scott Baker ed8200e2c7 Add a bunch of comments 2016-05-20 08:20:34 -07:00
Scott Baker 42553291ed Handle binary file modifications like we do text ones 2016-05-16 13:47:44 -07:00
Scott Baker 8e2c6acd56 Move horizontal header to Perl 2016-05-16 13:47:32 -07:00
Jonas Hermsmeier 796a5a5390 Fix Use of uninitialized $value in substitution (s///) 2016-05-12 18:16:47 +02:00
Scott Baker 391fb536f7 Version 0.1 of reading items from ~/.gitconfig 2016-04-05 08:35:43 -07:00
Daniel Hahler c3a141b7e6 Fix handling lines starting with dashes as file header
Use a global state ($in_hunk) to only look for `---`-lines before (and
not in) the actual hunk.

Closes https://github.com/so-fancy/diff-so-fancy/pull/144.
2016-04-04 22:41:44 +02:00
Daniel Hahler 9b283058e1 Handle mnemonicprefix with last_file_seen
This is not really required currently, because `basename` is used on it,
but it is good to have it fixed nonetheless.

Closes https://github.com/so-fancy/diff-so-fancy/pull/146.
2016-04-04 22:40:41 +02:00
Daniel Hahler 0e647fb59c Also move mark_empty_line down
Ref: https://github.com/so-fancy/diff-so-fancy/pull/143#discussion_r58394936
2016-04-04 22:39:49 +02:00
Daniel Hahler 1ba35037a0 Do not sneak in another dash/plus in format_diff_header
And especially do not match with `*` for this, which might trigger false
positives.

This moves the removal of leading +/- down to where those lines are
printed, instead of applying it globally to the input.

Ref: https://github.com/so-fancy/diff-so-fancy/commit/2f743f07941e744b2f24218dc422f26512823549#commitcomment-16952151

Closes https://github.com/so-fancy/diff-so-fancy/pull/143.
2016-04-04 22:39:32 +02:00
Scott Baker 22b045fbfa Streamline the input by reading one line at a time
Before we'd load the entire input in to memory, but this should:

1) Use less memory
2) Output things to the screen a lot faster
2016-03-31 15:23:03 -07:00
Scott Baker 9df7597361 By default don't remove any lines (i.e. don't fail on non-diff files) 2016-03-31 14:36:54 -07:00
Scott Baker 5c47ebec84 Don't error out if we don't have a filename 2016-03-30 16:13:16 -07:00
Scott Baker b90ff629e7 Specifically bold the context line 2016-03-28 12:01:37 -07:00
Scott Baker 0ef08b5019 Move "highlight context line" to Perl (one less sed call) 2016-03-28 09:10:44 -07:00
Scott Baker cf8c229e75 Properly remove the right number of leading columns in a three way merge 2016-03-17 14:44:21 -07:00
Paul Irish 6054b77a52 Merge pull request #131 from scottchiefbaker/start_line
Try and be smart about what line the diff starts on
2016-03-17 14:27:32 -07:00
Paul Irish 9c3000d3b5 show previous file mode. 2016-03-15 23:04:48 -07:00
Scott Baker d1a4c91c19 Try and be smart about what line the diff starts on
1: @@ -1,4 +1,4 @@
2: @@ -1,5 +1,5 @@
3: @@ -1,6 +1,6 @@
4: @@ -1,7 +1,7 @@
5: @@ -2,6 +2,7 @@
6: @@ -3,7 +3,7 @@

Starting from the end (last line (10), second to last line (9))...
-1: @@ -7,4 +7,4 @@
-2: @@ -6,5 +6,5 @@
-3: @@ -5,6 +5,6 @@
-4: @@ -4,7 +4,7 @@
2016-03-15 11:16:06 -07:00