lazygit icon indicating copy to clipboard operation
lazygit copied to clipboard

Still seeing errors when using delta

Open MikaelElkiaer opened this issue 3 years ago • 7 comments

Describe the bug I get panics when using delta as a pager.

Specifically ones like this one:

panic: runtime error: index out of range [3] with length 3

goroutine 198 [running]:
github.com/jesseduffield/gocui.(*escapeInterpreter).outputTrue(0xc000232640)
	/home/me/.cache/yay/lazygit-git/src/src/github.com/jesseduffield/lazygit/vendor/github.com/jesseduffield/gocui/escape.go:304 +0x430
github.com/jesseduffield/gocui.(*escapeInterpreter).parseOne(0xc000232640, 0x34)
	/home/me/.cache/yay/lazygit-git/src/src/github.com/jesseduffield/lazygit/vendor/github.com/jesseduffield/gocui/escape.go:166 +0x428
github.com/jesseduffield/gocui.(*View).parseInput(0xc000246b40, 0x6d)
	/home/me/.cache/yay/lazygit-git/src/src/github.com/jesseduffield/lazygit/vendor/github.com/jesseduffield/gocui/view.go:667 +0x45
github.com/jesseduffield/gocui.(*View).writeRunes(0xc000246b40, {0xc000562000, 0x7d, 0x38})
	/home/me/.cache/yay/lazygit-git/src/src/github.com/jesseduffield/lazygit/vendor/github.com/jesseduffield/gocui/view.go:638 +0x15a
github.com/jesseduffield/gocui.(*View).Write(0xc000246b40, {0xc0002a8437, 0x7d, 0x0})
	/home/me/.cache/yay/lazygit-git/src/src/github.com/jesseduffield/lazygit/vendor/github.com/jesseduffield/gocui/view.go:606 +0xe6
github.com/jesseduffield/lazygit/pkg/tasks.(*ViewBufferManager).NewCmdTask.func1.4()
	/home/me/.cache/yay/lazygit-git/src/src/github.com/jesseduffield/lazygit/pkg/tasks/tasks.go:182 +0x24b
github.com/jesseduffield/lazygit/pkg/utils.Safe.func1()
	/home/me/.cache/yay/lazygit-git/src/src/github.com/jesseduffield/lazygit/pkg/utils/utils.go:95 +0x1b
github.com/jesseduffield/lazygit/pkg/utils.SafeWithError(0x43e9c5)
	/home/me/.cache/yay/lazygit-git/src/src/github.com/jesseduffield/lazygit/pkg/utils/utils.go:106 +0x67
github.com/jesseduffield/lazygit/pkg/utils.Safe(0x0)
	/home/me/.cache/yay/lazygit-git/src/src/github.com/jesseduffield/lazygit/pkg/utils/utils.go:95 +0x35
created by github.com/jesseduffield/lazygit/pkg/tasks.(*ViewBufferManager).NewCmdTask.func1
	/home/me/.cache/yay/lazygit-git/src/src/github.com/jesseduffield/lazygit/pkg/tasks/tasks.go:151 +0x645

To Reproduce I am not entirely sure how to reproduce. It mostly happens when seeing diffs for commits, less so when staging changes. My configs look like this:

lazygit:

git:
  pull:
    mode: 'auto'
  overrideGpg: true
  paging:
    colorArg: always
    pager: delta --dark --paging=never
services:
  'git.rtx.mapspeople.com': 'gitlab:git.rtx.mapspeople.com'

And git:

[user]
	name = Mikael Elkiaer
	email = [email protected]
[includeIf "gitdir:**/Repositories/GitHub/**"]
	path = ~/.gitconfig-github
[includeIf "gitdir:**/Repositories/MapsPeople/**"]
	path = ~/.gitconfig-mapspeople
[includeIf "gitdir:**/Repositories/AUR/**"]
	path = ~/.gitconfig-aur
[core]
	autocrlf = input 
	editor = nvim
	pager = delta --dark
[interactive]
	diffFilter = delta --dark --color-only
[rebase]
	autosquash = true
[credential]
	helper = cache
[pull]
	rebase = true
[merge]
	ff = false
	tool = vimdiff
[push]
	default = current
[alias]
	{...}
[color]
	ui = auto
[diff]
	tool = vimdiff
[advice]
  addIgnoredFile = false

Expected behavior Expected it to work, as it had done previously.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • lazygit -v outputs commit=d0196263, build date=20220117.112305, build source=unknown, version=v0.32.1.d0196263, os=linux, arch=amd64
  • Running on Manjaro i3 edition

Additional context Add any other context about the problem here.

MikaelElkiaer avatar Jan 17 '22 11:01 MikaelElkiaer

Can't reproduce myself (though I don't typically use delta locally). looking at the code from that stack trace, I'm not sure if we're failing to handle an escape sequence that's got fewer than 5 elements, or if we've got a race condition where we're swapping out one sequence for another, but I suspect it's the former.

jesseduffield avatar Jan 17 '22 11:01 jesseduffield

I'll dig a little deeper, as I finally have a proper dev set-up, thanks to the PR I did.

I was just hoping it might ring a bell for you, seeing the previous issues with delta. :)

MikaelElkiaer avatar Jan 17 '22 12:01 MikaelElkiaer

Sounds good, lemme know if you need any guidance :)

jesseduffield avatar Jan 17 '22 21:01 jesseduffield

It seems to consistently crash trying to diff on the same file for me, if that helps:

Screen Shot 2022-05-16 at 08 16 21

The second I try to see the diff of that file it crashes.

Before: Screen Shot 2022-05-16 at 08 18 01

After: Screen Shot 2022-05-16 at 08 19 04

iovis avatar May 16 '22 12:05 iovis

@iovis I haven't taken time to look at this, and not sure if I ever will. I just went back to the default pager for lazygit.

MikaelElkiaer avatar May 17 '22 06:05 MikaelElkiaer

No problem, I understand. Thanks for the heads up!

iovis avatar May 17 '22 16:05 iovis

Related: https://github.com/jesseduffield/lazygit/issues/1311#issuecomment-1198662097

c02y avatar Jul 28 '22 21:07 c02y

Seems related to the 24-bit color option?

git:
  paging:
    colorArg: always
    pager: delta --dark --paging=never --true-color=never

Seems to work

iovis avatar Oct 17 '22 17:10 iovis

Seems related to the 24-bit color option?

git:
  paging:
    colorArg: always
    pager: delta --dark --paging=never --true-color=never

Seems to work

I will try this out.

MikaelElkiaer avatar Oct 20 '22 06:10 MikaelElkiaer

Seems related to the 24-bit color option?

git:
  paging:
    colorArg: always
    pager: delta --dark --paging=never --true-color=never

Seems to work

--true-color=never does indeed seem to get rid of the errors. Unfortunately, at least with my colors, it gets harder to read the diffs.

MikaelElkiaer avatar Oct 26 '22 06:10 MikaelElkiaer

Unfortunately, at least with my colors, it gets harder to read the diffs.

Yeah, with mine too, but I figured it could help find the root cause of the incompatibility

iovis avatar Oct 26 '22 16:10 iovis