Skip to content
This repository has been archived by the owner on Nov 26, 2023. It is now read-only.

Breaks when pressing <delete> on empty query #31

Open
pmf-ids opened this issue Jan 18, 2022 · 0 comments
Open

Breaks when pressing <delete> on empty query #31

pmf-ids opened this issue Jan 18, 2022 · 0 comments

Comments

@pmf-ids
Copy link

pmf-ids commented Jan 18, 2022

When calling jiq with

echo 1 | jiq

it opens up fine, displaying

[jq]> .

1

with the cursor being next to the dot. Hitting backspace removes the dot (which is expected behaviour). Hitting backspace again does nothing (also as expected). Now, hitting delete makes jiq crash with the message

panic: runtime error: slice bounds out of range [1:0]

goroutine 1 [running]:
github.com/fiatjaf/jiq.(*Query).Delete(0xc0002a6030, 0x0, 0x0, 0x0, 0x0)
	/home/fiatjaf/comp/jiq/query.go:58 +0x238
github.com/fiatjaf/jiq.(*Engine).Run(0xc0002d2000, 0x0)
	/home/fiatjaf/comp/jiq/engine.go:126 +0xaa8
main.run(0xc0002d2000, 0xc0002a6000, 0xc00028c1f0)
	/home/fiatjaf/comp/jiq/cmd/jiq/jiq.go:59 +0x32
main.main()
	/home/fiatjaf/comp/jiq/cmd/jiq/jiq.go:55 +0x18d

This does not happen when hitting delete while the dot (or any other filter) is still visible.

Tested on jiq version 0.7.1-3-g5dec899

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

No branches or pull requests

1 participant