Skip to content

Image preview crashing #330

@alastor367

Description

@alastor367

For some reason when i use kitty in config file and try to enter and exit the photo a few times, it shrinks and the program until it will not display anything and crash i testes it with basic in config and i didn't have that problem.

clipse version: clipse v1.2.1

log from console:

Caught panic:

runtime error: integer divide by zero

Restoring terminal...

goroutine 1 [running]:
runtime/debug.Stack()
/usr/lib/go/src/runtime/debug/stack.go:26 +0x5e
runtime/debug.PrintStack()
/usr/lib/go/src/runtime/debug/stack.go:18 +0x13
github.com/charmbracelet/bubbletea.(*Program).recoverFromPanic(0xc0001e2280, {0x6031a0, 0x8ccd70})
/home/alastor/go/pkg/mod/github.com/charmbracelet/bubbletea@v1.3.10/tea.go:847 +0xac
github.com/charmbracelet/bubbletea.(*Program).Run.func2()
/home/alastor/go/pkg/mod/github.com/charmbracelet/bubbletea@v1.3.10/tea.go:638 +0xe6
panic({0x6031a0?, 0x8ccd70?})
/usr/lib/go/src/runtime/panic.go:783 +0x132
github.com/savedra1/clipse/app.smartResize({0x70af90, 0xc0000c0c80}, 0x10c, 0x0)
/home/alastor/Builds/clipse/app/preview.go:103 +0x130
github.com/savedra1/clipse/app.getKittyString({0x70af90?, 0xc0000c0c80?}, 0x0?, 0x0?)
/home/alastor/Builds/clipse/app/preview.go:87 +0x2f
github.com/savedra1/clipse/app.getImgPreview({0xc0001de0c0?, 0xc0001e6120?}, 0x10c, 0x0)
/home/alastor/Builds/clipse/app/preview.go:35 +0xf1
github.com/savedra1/clipse/app.Model.Update({{0x1, 0x1, 0x1, 0x1, 0x0, 0x1, {0x63fee0, 0x4}, {0x6401f2, 0x5}, ...}, ...}, ...)
/home/alastor/Builds/clipse/app/update.go:288 +0x2fd3
github.com/charmbracelet/bubbletea.(*Program).eventLoop(0xc0001e2280, {0x70ac80?, 0xc00020a000?}, 0xc0001b0540)
/home/alastor/go/pkg/mod/github.com/charmbracelet/bubbletea@v1.3.10/tea.go:494 +0x857
github.com/charmbracelet/bubbletea.(*Program).Run(0xc0001e2280)
/home/alastor/go/pkg/mod/github.com/charmbracelet/bubbletea@v1.3.10/tea.go:716 +0xae7
github.com/savedra1/clipse/cmd.launchTUI()
/home/alastor/Builds/clipse/cmd/root.go:165 +0x167
github.com/savedra1/clipse/cmd.Main()
/home/alastor/Builds/clipse/cmd/root.go:59 +0x105
main.main()
/home/alastor/Builds/clipse/main.go:10 +0x13
goroutine 1 [running]:
runtime/debug.Stack()
/usr/lib/go/src/runtime/debug/stack.go:26 +0x5e
runtime/debug.PrintStack()
/usr/lib/go/src/runtime/debug/stack.go:18 +0x13
github.com/savedra1/clipse/utils.HandleError({0x709de0, 0xc0001d37d0})
/home/alastor/Builds/clipse/utils/err.go:11 +0x2c
github.com/savedra1/clipse/cmd.launchTUI()
/home/alastor/Builds/clipse/cmd/root.go:166 +0x185
github.com/savedra1/clipse/cmd.Main()
/home/alastor/Builds/clipse/cmd/root.go:59 +0x105
main.main()
/home/alastor/Builds/clipse/main.go:10 +0x13

config:

{
"allowDuplicates": false,
"historyFile": "clipboard_history.json",
"maxHistory": 100,
"deleteAfter": 0,
"logFile": "clipse.log",
"pollInterval": 50,
"maxEntryLength": 65,
"themeFile": "custom_theme.json",
"tempDir": "tmp_files",
"keyBindings": {
"choose": "enter",
"clearSelected": "S",
"down": "down",
"end": "end",
"filter": "/",
"forceQuit": "Q",
"home": "home",
"more": "?",
"nextPage": "right",
"prevPage": "left",
"preview": "space",
"quit": "esc",
"remove": "backspace",
"selectDown": "shift+down",
"selectSingle": "s",
"selectUp": "shift+up",
"togglePin": "p",
"togglePinned": "tab",
"up": "up",
"yankFilter": "ctrl+s"
},
"imageDisplay": {
"type": "kitty",
"scaleX": 9,
"scaleY": 9,
"heightCut": 2
},
"excludedApps": [
"1Password",
"Bitwarden",
"KeePassXC",
"LastPass",
"Dashlane",
"Password Safe",
"Keychain Access"
],
"autoPaste": {
"enabled": false,
"keybind": "ctrl+v",
"buffer": 10
},
"enableMouse": true,
"enableDescription": true
}

  1. first time clicking space to view it.
Image 2. after doing it 2-3 times (same effect if i view other one - they will also be smaller) Image 3. last one before next one that will crash it. Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions