sqlite-backed shell history

Slow (~1s) history application when using Ctrl-R on M4 MBP #3

Closed oppi.li
Closed opened by oppi.li

Hey, am coming from Atuin and like how minimal stinkpot is!

I tested on x86_64 Linux w/ zsh 5.9.2, everything works great!

Tested on arm64 M4 MBP w/ zsh 5.9, ./stinkpot search is extremely responsive, as expected, but using Ctrl-R and then selecting (as in, pressing enter) results in a ~1s delay before the command is written to the shell.

I am unable to put up a PR due to some strange tangled bug not acknowledging my SSH keys, but here is a patch that fixes the bug.

diff --git a/main.go b/main.go
index 3f6d97e..21d1a7a 100644
--- a/main.go
+++ b/main.go
@@ -175,7 +175,7 @@ func search(args []string) {
        m := &model{textinput: ti, all: cands}
        m.filter()

-       p := tea.NewProgram(m, tea.WithOutput(os.Stderr), tea.WithInput(os.Stdin))
+       p := tea.NewProgram(m, tea.WithOutput(os.Stderr))
        res, err := p.Run()
        if err != nil {
                fmt.Fprintln(os.Stderr, "stinkpot:", err)
@@ -488,7 +488,7 @@ const zshInitScript = `if command -v stinkpot >/dev/null 2>&1; then
     # Ctrl+R -> stinkpot search
     __stinkpot_search() {
         local out
-        out=$(stinkpot search -- "$BUFFER" </dev/tty) || return
+        out=$(stinkpot search -- "$BUFFER") || return
         if [ -n "$out" ]; then
             BUFFER="$out"
             CURSOR=${#BUFFER}

You may well be aware, but bubbletea already handles the input appropriately if unspecified.

Cheers!

so strange, thanks for the patch!

I am unable to put up a PR due to some strange tangled bug not acknowledging my SSH keys, but here is a patch that fixes the bug.

oh dear! do you have any keys added (any keys showing up in settings?), if not, you can also submit a PR without making a fork! just paste the above patch in the textbox provided in the https://tangled.org/oppi.li/stinkpot/pulls/new page.

thanks again!

Yeah I do have keys added. I’ve tried a few different types of keys too but no dice

I was able to submit a patch with the fix here.

thanks, merged!

Sign up or Sign in to add to the discussion.