go-prompt icon indicating copy to clipboard operation
go-prompt copied to clipboard

no way to get selected suggestion after user input enter

Open chinglinwen opened this issue 6 years ago • 0 comments

Bug reports

completer := func(d prompt.Document) []prompt.Suggest {
		s := []prompt.Suggest{}
		for i, v := range loglist {
			s = append(s, prompt.Suggest{
				Text: strconv.Itoa(i+1) + " " + v, Description: "",
			})
		}
		s = append(s, prompt.Suggest{
			Text: "0 quit", Description: "",
		})
		return prompt.FilterFuzzy(s, d.GetWordBeforeCursor(), true)
	}

	t := prompt.Input("> ", completer)

Expected Behavior

expect t is the full text of selected text, not what user has input

Current Behavior and Steps to Reproduce

got user input text only

Context

The prompt is meant for less input, I think

  • Operating System: centos 7.4.1708

  • Terminal Emulator: (i.e. iTerm2) I used gotty

  • tag of go-prompt or commit revision:

commit f9c45ac43c0c3b5a991ded39517f9648afe92b60 Author: c-bata [email protected] Date: Thu Feb 7 12:21:20 2019 +0900

Fix logger of completer/file.go

chinglinwen avatar Feb 20 '19 09:02 chinglinwen