dandavison / delta

A syntax-highlighting pager for git, diff, grep, and blame output
https://dandavison.github.io/delta/
MIT License
22.5k stars 376 forks source link

πŸ› Panic at paint.rs #1839

Closed xudyang1 closed 3 days ago

xudyang1 commented 1 week ago
--- a/lua/config/options.lua
+++ b/lua/config/options.lua
@@ -2,6 +2,11 @@ local opt = vim.opt

 opt.spelllang = "en_us"

+opt.title = true
+opt.titlestring =
+  [[%t%( %m%)%( (%<%{execute('lua local ft=vim.bo.filetype print((ft=="help" or ft=="man") and ft or vim.fn.expand("%:~:.:h"))')})%)]]
+opt.titlelen = 27
+
 -- TODO: more on rg and fdfind and wildcards...
 opt.grepprg = [[rg --vimgrep --hidden --glob "!{**/.git/**}"]]
 opt.wildignore = {
th1000s commented 1 week ago

Thank you for the report!

Setting my terminal to a width of 137 (see echo $COLUMNS, so it wraps after filetype pr↡, also setting ↡ to the empty string), and running

cat crash_diff | HOME=/ delta --no-gitconfig --side-by-side  --wrap-left-symbol=' '

doesn't reproduce it here. Using delta 0.18.1 on Linux. Can you try that command, and add other flags from your gitconfig if needed?

bendem commented 1 week ago

I have a panic that looks like the same problem using latest delta:

thread 'main' panicked at /home/demarteaub/.cargo/registry/src/index.crates.io-6f17d22bba15001f/git-delta-0.18.1/src/paint.rs:957:17:
String mismatch encountered while superimposing style sections: ':' vs '↡'
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

With 92 columns and the following git config:

[pager]
    diff = delta

[delta]
    side-by-side = true
    inspect-raw-lines = true
    features = navigate
    hunk-header-style = file line-number syntax

Part of the diff to reproduce:

diff --git a/ansible/ansible_collections/vdl/devops/plugins/lookup/password.py b/ansible/ansible_collections/vdl/devops/plugins/lookup/password.py
index 358f9328..5a8a1dc2 100644
--- a/ansible/ansible_collections/vdl/devops/plugins/lookup/password.py
+++ b/ansible/ansible_collections/vdl/devops/plugins/lookup/password.py
@@ -83,6 +83,7 @@ class Secret(typing.TypedDict):

 class LookupModule(LookupBase):
+
     def run(self, terms, variables: HostVars, **kwargs) -> typing.List[Secret]:
         # First of all populate options,
         # this will already take into account env vars and ini config
@@ -126,6 +127,8 @@ class LookupModule(LookupBase):
             force_renew = variables.get("vdl.devops.password.force_renew")
             secret = None
             skip_existing = False
+            # 0 means vault must reject the secret create if a secret already exists
+            current_version = 0

             if force_renew == "*all" or force_renew == secret_path:
                 display.display(f"forcing renew of {secret_path}", color="purple")

The delta output:

$ < test.diff delta
thread 'main' panicked at /home/demarteaub/.cargo/registry/src/index.crates.io-6f17d22bba15001f/git-delta-0.18.1/src/paint.rs:957:17:
String mismatch encountered while superimposing style sections: ':' vs '↡'
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Ξ” ansible/ansible_collections/vdl/devops/plugins/lookup/password.py
────────────────────────────────────────────────────────────────────────────────────────────

────────────────────────────────────────────────────────────────────────────────────────────────────────┐
β€’ ansible/ansible_collections/vdl/devops/plugins/lookup/password.py:83: class Secret(typing.TypedDict): β”‚
β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚ 83 β”‚                                        β”‚ 83 β”‚
β”‚ 84 β”‚                                        β”‚ 84 β”‚
β”‚ 85 β”‚class LookupModule(LookupBase):         β”‚ 85 β”‚class LookupModule(LookupBase):

image

xudyang1 commented 3 days ago

Thank you for the report!

Setting my terminal to a width of 137 (see echo $COLUMNS, so it wraps after filetype pr↡, also setting ↡ to the empty string), and running

cat crash_diff | HOME=/ delta --no-gitconfig --side-by-side  --wrap-left-symbol=' '

doesn't reproduce it here. Using delta 0.18.1 on Linux. Can you try that command, and add other flags from your gitconfig if needed?

I am using windows terminal with WSL2 (Ubuntu 22.04) in full screen mode. The maximum $COLUMNS is 136:

image

Even when I set export COLUMNS=137, the diff still reports error.

Does delta only work for columns greater than 136? @th1000s

xudyang1 commented 3 days ago

By running cargo install git-delta --locked, the issue is fixed with delta 0.18.2.