dont print if newer input
This commit is contained in:
parent
bd4620369d
commit
4cd09e4fc1
11
ddg.go
11
ddg.go
@ -11,6 +11,10 @@ import (
|
|||||||
"./rofi"
|
"./rofi"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
serial = 0
|
||||||
|
)
|
||||||
|
|
||||||
func getSuggestions(query string) []string {
|
func getSuggestions(query string) []string {
|
||||||
param := url.Values{}
|
param := url.Values{}
|
||||||
param.Add("q", query)
|
param.Add("q", query)
|
||||||
@ -45,9 +49,16 @@ func handleSelect(input rofi.Input) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func handleInputChange(input rofi.Input) {
|
func handleInputChange(input rofi.Input) {
|
||||||
|
serial++
|
||||||
|
go genOutput(input, serial)
|
||||||
|
}
|
||||||
|
|
||||||
|
func genOutput(input rofi.Input, mySerial int) {
|
||||||
output := rofi.NewOutput()
|
output := rofi.NewOutput()
|
||||||
output.Lines = rofi.ConvertStringsToLine(getSuggestions(input.Value))
|
output.Lines = rofi.ConvertStringsToLine(getSuggestions(input.Value))
|
||||||
|
if serial == mySerial {
|
||||||
rofi.SendOutput(output)
|
rofi.SendOutput(output)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
Loading…
Reference in New Issue
Block a user