diff options
Diffstat (limited to 'xA')
| -rw-r--r-- | xA/xA.go | 47 | 
1 files changed, 41 insertions, 6 deletions
| @@ -141,7 +141,6 @@ type buffer struct {  	kind            RelayBufferKind  	serverName      string  	lines           []bufferLine -	// TODO(p): Server by name or by pointer?  	// Channel: @@ -189,6 +188,8 @@ var (  	wTopic      *widget.RichText  	wRichText   *widget.RichText  	wRichScroll *container.Scroll +	wPrompt     *widget.Label +	wStatus     *widget.Label  	wEntry      *widget.Entry  ) @@ -332,11 +333,38 @@ func refreshBufferList() {  }  func refreshPrompt() { -	// TODO(p): First off, add a prompt, second, refresh it. +	var prompt string +	if b := bufferByName(bufferCurrent); b == nil { +		prompt = "Synchronizing..." +	} else if server, ok := servers[b.serverName]; ok { +		prompt = server.user +		if server.userModes != "" { +			prompt += "(" + server.userModes + ")" +		} +		if prompt == "" { +			prompt = "(" + server.state.String() + ")" +		} +	} +	wPrompt.SetText(prompt)  }  func refreshStatus() { -	// TODO(p): First off, add a status, second, refresh it. +	var status string +	if !bufferAtBottom() { +		status += "🡇 " +	} + +	status += bufferCurrent +	if b := bufferByName(bufferCurrent); b != nil { +		if b.modes != "" { +			status += "(+" + b.modes + ")" +		} +		if b.hideUnimportant { +			status += "<H>" +		} +	} + +	wStatus.SetText(status)  }  // --- RichText formatting ----------------------------------------------------- @@ -890,16 +918,23 @@ func main() {  	a.Settings().SetTheme(&customTheme{})  	wWindow = a.NewWindow(projectName) -	// TODO(p): There should also be a widget.NewLabel() next to the entry. -	//  - Probably another Border, even though this seems odd. +	// TODO(p): Consider using data bindings.  	wTopic = widget.NewRichText()  	wTopic.Truncation = fyne.TextTruncateEllipsis  	wRichText = widget.NewRichText()  	wRichText.Wrapping = fyne.TextWrapWord  	wRichScroll = container.NewVScroll(wRichText) +	wPrompt = widget.NewLabelWithStyle( +		"", fyne.TextAlignLeading, fyne.TextStyle{Bold: true}) +	wStatus = widget.NewLabelWithStyle( +		"", fyne.TextAlignTrailing, fyne.TextStyle{})  	wEntry = widget.NewMultiLineEntry() +	bottom := container.NewVBox( +		container.NewBorder(nil, nil, wPrompt, wStatus), +		wEntry, +	)  	wWindow.SetContent(container.NewBorder( -		wTopic, wEntry, nil, nil, wRichScroll)) +		wTopic, bottom, nil, nil, wRichScroll))  	go relayRun() | 
