-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
interactive filtering results in Found 0 note
#331
Comments
i believe the issue will occur with any document larger than for files with content beyond this limit, |
this patch solves the problem for me. for files which are larger than 2MB, shows an error to the user. i'm not sure using 2MB for every string split makes sense, but the error checking code at least i think should be incorporated: diff --git a/internal/util/strings/strings.go b/internal/util/strings/strings.go
index be5f406..4db54c4 100644
--- a/internal/util/strings/strings.go
+++ b/internal/util/strings/strings.go
@@ -2,6 +2,7 @@ package strings
import (
"bufio"
+ "log"
"net/url"
"regexp"
"strconv"
@@ -37,9 +38,15 @@ func Pluralize(word string, count int) string {
func SplitLines(s string) []string {
var lines []string
scanner := bufio.NewScanner(strings.NewReader(s))
+ // increase the buffer size to 2Mb
+ buf := []byte{}
+ scanner.Buffer(buf, 2048*1024)
for scanner.Scan() {
lines = append(lines, scanner.Text())
}
+ if err := scanner.Err(); err != nil {
+ log.Fatalf("error while scanning text: %v", err)
+ }
return lines
} |
Thanks @khimaros, feel free to open a PR with your patch. |
i traced the issue down to
fzf.parseSelection()
the call to
stringsutil.SplitLines()
returns an empty array, despite theoutput
parameter containing many bytes.reproduction
when i
zk edit -i -m <name>
it shows up as the top resultwhen i press enter to select the note, it says
Found 0 note
the same outcome when using
zk list -i
this file i'm attempting to open is
153,335
bytes largenotes
editing the note with
zk edit -m "<name>" -n 1
works fineediting the note by name
zk edit <name>
works finethe problem appears to be restricted to fzf integration
The text was updated successfully, but these errors were encountered: