Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Second document label is missing last character (truncated) #324

Closed
AndydeCleyre opened this issue Sep 17, 2020 · 8 comments
Closed

Second document label is missing last character (truncated) #324

AndydeCleyre opened this issue Sep 17, 2020 · 8 comments

Comments

@AndydeCleyre
Copy link

$ printf '%s\n' 1 2 3 4 >a.txt
$ printf '%s\n' 1 TWO 3 FOUR >b.txt
$ diff -u a.txt b.txt
--- a.txt	2020-09-17 13:57:56.160725335 -0400
+++ b.txt	2020-09-17 13:58:11.573565683 -0400
@@ -1,4 +1,4 @@
 1
-2
+TWO
 3
-4
+FOUR
$ diff -u a.txt b.txt | delta

image

$ diff -u -L FIRST a.txt -L SECOND b.txt
--- FIRST
+++ SECOND
@@ -1,4 +1,4 @@
 1
-2
+TWO
 3
-4
+FOUR
$ diff -u -L FIRST a.txt -L SECOND b.txt | delta

image

$ delta --version
delta 0.4.3
$ diff --version | head -1
diff (GNU diffutils) 3.7
@dandavison
Copy link
Owner

dandavison commented Sep 17, 2020

Hi @AndydeCleyre, thanks for this. I can't reproduce it however. I don't have a good theory yet for what might be causing it at your end though! Could you try with delta --no-gitconfig to double-check it's not something in your git/delta config? Could you also pipe the output of delta into cat -A (or bat -A, which is what I used below) so that we can see that there really is a missing character as opposed to e.g. something odd going on at the level of ANSI sequences influencing terminal emulator display.

~ cat src/delta/diff1 
--- a.txt   2020-09-17 13:57:56.160725335 -0400
+++ b.txt   2020-09-17 13:58:11.573565683 -0400
@@ -1,4 +1,4 @@
 1
-2
+TWO
 3
-4
+FOUR
~ delta --no-gitconfig < src/delta/diff1

comparing: a.txt ⟶   b.txt
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

1
1
2
TWO
3
4
FOUR
~ delta --no-gitconfig < src/delta/diff1 | cat -A
␊
␛[38;5;4mcomparing:•a.txt•\u{27f6}•••b.txt␛[0m␊
␛[38;5;4m\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}␛[0m␊
␊
␛[38;5;4m1␛[0m␊
␛[38;2;248;248;242m1␛[0m␊
␛[48;2;63;0;1m2␛[0m␛[48;2;63;0;1m␛[0K␛[0m␊
␛[48;2;0;40;0;38;2;248;248;242mTWO␛[0m␛[48;2;0;40;0m␛[0K␛[0m␊
␛[38;2;248;248;242m3␛[0m␊
␛[48;2;63;0;1m4␛[0m␛[48;2;63;0;1m␛[0K␛[0m␊
␛[48;2;0;40;0;38;2;248;248;242mFOUR␛[0m␛[48;2;0;40;0m␛[0K␛[0m␊
~ delta --version
delta 0.4.3

@AndydeCleyre
Copy link
Author

Thanks so much for taking a good look at this so quickly!

Same results with --no-gitconfig, and in my usual zsh env, a zsh -f session, and bash.

You're right, the text is there:

␊
␛[38;5;4mcomparing:•a.txt•\u{27f6}•••b.txt␛[0m␊
␛[38;5;4m\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}␛[0m␊
␊
␛[38;5;4m1␛[0m␊
␛[38;5;7m1␛[0m␊
␛[48;2;63;0;1m2␛[0m␛[48;2;63;0;1m␛[0K␛[0m␊
␛[48;2;0;40;0;38;5;7mTWO␛[0m␛[48;2;0;40;0m␛[0K␛[0m␊
␛[38;5;7m3␛[0m␊
␛[48;2;63;0;1m4␛[0m␛[48;2;63;0;1m␛[0K␛[0m␊
␛[48;2;0;40;0;38;5;7mFOUR␛[0m␛[48;2;0;40;0m␛[0K␛[0m␊

So I'm having this issue with konsole, but not with alacritty.

@dandavison
Copy link
Owner

Hm, OK, glad we're getting somewhere! So, I guess the obvious next step would be to try to isolate a minimal printf example of some text with ANSI escapes that is behaving badly in your konsole (Is your version reasonably recent?). I'm a bit surprised; I think delta is using ANSI escapes standardly there and so I wouldn't expect konsole to have any problems (and I'm sure there are plenty of delta konsole users).

@AndydeCleyre
Copy link
Author

It's konsole 20.08.1, and I'm now reproducing with a default profile there. If I use zsh's print -b it looks alright, except for the horizontal line (here c and p are copy and paste):

image

I'm not sure how to properly feed these escape codes to printf:

image

Now also reproduced with konsole 20.08.0, 20.07.90, and 20.07.80, but not with 20.04.3.

Sorry for the noise here as this seems really unrelated to your project. Feel free to close this; I'll check for or open a new konsole issue, and maybe do a git bisect to track this down, and just post a relevant link here for others to find.

Thanks again!

@dandavison
Copy link
Owner

OK good luck investigating. If you get a chance to post any conclusions or further links here then please do; that could be useful to other konsole & delta users.

@AndydeCleyre
Copy link
Author

Continued discussion: https://bugs.kde.org/show_bug.cgi?id=426655

@dandavison
Copy link
Owner

dandavison commented Sep 17, 2020

Does this reproduce the problem without involving delta?

printf "\x1b[38;5;4mcomparing: a.txt ⟶  b.txt\x1b[0m\n"

(What about without the unicode arrow character?)

image

@AndydeCleyre
Copy link
Author

Just as you suggest: reproduced with the arrow, not reproduced without it. I guess it's konsole's character width calculations. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants