diff options
Diffstat (limited to 'xA')
| -rw-r--r-- | xA/xA.go | 29 | 
1 files changed, 29 insertions, 0 deletions
| @@ -919,6 +919,27 @@ func relayRun() {  	// TODO(p): Indicate in the UI that we're no longer connected.  } +// --- Input line -------------------------------------------------------------- + +func inputSubmit(text string) bool { +	b := bufferByName(bufferCurrent) +	if b == nil { +		return false +	} + +	b.history = append(b.history, text) +	b.historyAt = len(b.history) +	wEntry.SetText("") + +	relaySend(RelayCommandData{Variant: &RelayCommandDataBufferInput{ +		BufferName: b.bufferName, +		Text:       text, +	}}, nil) +	return true +} + +// --- General UI -------------------------------------------------------------- +  func main() {  	flag.Usage = func() {  		fmt.Fprintf(flag.CommandLine.Output(), @@ -977,6 +998,14 @@ func main() {  	wStatus = widget.NewLabelWithStyle(  		"", fyne.TextAlignTrailing, fyne.TextStyle{})  	wEntry = widget.NewMultiLineEntry() +	// TODO(p): Rather respond to all keypresses/similar activity. +	wEntry.OnChanged = func(text string) { +		relaySend(RelayCommandData{Variant: &RelayCommandDataActive{}}, nil) +	} +	// TODO(p): Make this submit on Enter rather than Shift+Enter. +	wEntry.OnSubmitted = func(text string) { +		inputSubmit(text) +	}  	top := container.NewVBox(  		wTopic, | 
