Comments (6)
Thanks for the report @nedbat. That leading whitespace is indeed not supposed to be there. I'd definitely like to get to the bottom of this. However, it might require a bit of back and forth, because I haven't managed to reproduce it yet.
The short version is that it's looking to me like your system, when it encounters the ANSI escape code at the beginning of the problematic lines, is causing some white space to be rendered (as if it were a space character), and also switching color as the ANSI code dictates. Whereas mine is just switching color.
I've tried iTerm2 3.3.4, 3.3.3, 3.3.2. I haven't found a link to the beta that you're on yet. Could you perhaps try 3.3.4?
Here's how the beginning of --compare-themes
renders for me. So for me, the filename, the horizontal line and the ensuing diff hunk all appear to start in the first column1, whereas for you it looks like those lines start in the second column:
The main clue here seems to be that the problematic lines are the ones that start with an ANSI escape code; the initial line ("Theme: 1337") lacks any ANSI codes and starts in the first column for both of us.
$ delta --compare-themes 2>/dev/null | head -n10 | cat -A
$
Theme: ^[[1m1337^[[0m$
$
$
^[[34mtests/data/hello.c^[[0m$
^[[34mM-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@^[[0m$
^[[34m1^[[0m$
^[[38;2;248;248;242m ^[[38;2;255;94;94m#include^[[38;2;248;248;242m ^[[38;2;255;255;255m<^[[38;2;251;227;191mstdio.h^[[38;2;255;255;255m>^[[38;2;248;248;242m $
^[[38;2;248;248;242m $
^[[38;2;248;248;242m ^[[38;2;251;223;181mint^[[38;2;248;248;242m ^[[38;2;140;218;255mmain^[[38;2;248;248;242m(^[[38;2;251;223;181mint^[[38;2;248;248;242m ^[[38;2;252;147;84margc^[[38;2;248;248;242m, ^[[38;2;251;223;181mchar^[[38;2;248;248;242m ^[[38;2;255;94;94m**^[[38;2;252;147;84margv^[[38;2;248;248;242m) {
The versions I've tried are:
MacOS: 10.14.5
iTerm: {3.3.4, 3.3.3, 3.3.2}
delta: 0.0.9
git: 2.18.0
1 While the filename tests/data/hello.c
starts in the first column for me, the subsequent code in the diff hunk itself starts in the second column. This is how delta is currently supposed to behave. It's because it replaces the traditional unified diff +/- markers with a space. For you, the diff hunk code appears to start in the third column.
from delta.
Hmm, I didn't think delta used less, but the problem seems to be my LESS environment variable. I have LESS=-isFJRQWX
. If I use delta --compare-themes 2>&1 | head -n10
, it looks fine, and if I use LESS= delta --compare-themes
it looks fine.
from delta.
Ah, excellent, thanks for figuring that out. Yes, delta does spawn a less
process for paging functionality. (I actually took that code pretty much directly from bat). That code already does some overriding of the PAGER
env var value under certain conditions. It should be possible to improve the experience for delta users here. Perhaps I can improve the overriding, or warn the user that their environment variable values may not be optimal for delta.
from delta.
A simple way to fix this would be to subtract one or two from the width for "full-width" bars. No one will care if they don't go quite to the right edge.
from delta.
OK, good call, I'll do that.
(For any future readers of this issue, it was less -J
i.e. --status-column
that was adding the extra column on the left.)
from delta.
OK, this should be fixed in version 0.0.13.
from delta.
Related Issues (20)
- Navigate keybinds only go between hunks, not files
- update intsructions for tmux color issues
- 🐛 Online user manual website not working HOT 4
- 🐛 When piping --help, the output should not contain escape chars
- 🐛 `--color-only` doesn't produce any colour HOT 2
- 🚀 diff chinese words better HOT 2
- 🐛 Highlighting of capitalisation changes does not match `diff-so-fancy` when using `delta diff-so-fancy` HOT 1
- 🐛 Emacs lisp incorrect highlighting HOT 1
- 🚀 hjkl key bindings as arrow keys HOT 2
- 🚀 Enable using delta in git when output is piped (`git diff | cat`) HOT 3
- 🚀 use diff-compatible exit statuses that differ between difference-found and error HOT 8
- 🚀 Please add support for cargo-binstall HOT 1
- 🐛 wrong highlight with `rg --json | delta` when tabs are involved HOT 2
- 🚀 `ws-error-highlight`
- 🐛 Homebrew cannot install from HEAD HOT 2
- 🐛 delta fails to run (in some cases) when `git` is not installed
- 🐛 White space before 2nd, 3rd `k` shouldn't be in highlighted scope
- 🐛 delta not respecting LESS -F environment variable (--quit-if-one-screen) HOT 2
- 🐛 Syntax highlighting fails when the visible snippet includes a multiline comment HOT 2
- 🐛 error: unexpected argument '--generate-completion' found
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from delta.