aboutsummaryrefslogtreecommitdiff
path: root/xA/xA.go
diff options
context:
space:
mode:
Diffstat (limited to 'xA/xA.go')
-rw-r--r--xA/xA.go23
1 files changed, 16 insertions, 7 deletions
diff --git a/xA/xA.go b/xA/xA.go
index f61102e..2357711 100644
--- a/xA/xA.go
+++ b/xA/xA.go
@@ -219,6 +219,7 @@ var (
wRichText *widget.RichText
wRichScroll *container.Scroll
wPrompt *widget.Label
+ wDown *widget.Icon
wStatus *widget.Label
wEntry *customEntry
)
@@ -323,8 +324,8 @@ func bufferToggleUnimportant(name string) {
// --- Current buffer ----------------------------------------------------------
func bufferAtBottom() bool {
- // TODO(p): Figure out how to implement this.
- return false
+ return wRichScroll.Offset.Y >=
+ wRichScroll.Content.Size().Height-wRichScroll.Size().Height
}
func bufferScrollToBottom() {
@@ -396,12 +397,13 @@ func refreshPrompt() {
}
func refreshStatus() {
- var status string
- if !bufferAtBottom() {
- status += "🡇 "
+ if bufferAtBottom() {
+ wDown.Hide()
+ } else {
+ wDown.Show()
}
- status += bufferCurrent
+ status := bufferCurrent
if b := bufferByName(bufferCurrent); b != nil {
if b.modes != "" {
status += "(+" + b.modes + ")"
@@ -1119,9 +1121,14 @@ func main() {
wTopic = widget.NewRichText()
wTopic.Truncation = fyne.TextTruncateEllipsis
+
wRichText = widget.NewRichText()
wRichText.Wrapping = fyne.TextWrapWord
wRichScroll = container.NewVScroll(wRichText)
+ wRichScroll.OnScrolled = func(position fyne.Position) {
+ refreshStatus()
+ }
+
wPrompt = widget.NewLabelWithStyle(
"", fyne.TextAlignLeading, fyne.TextStyle{Bold: true})
wStatus = widget.NewLabelWithStyle(
@@ -1140,9 +1147,11 @@ func main() {
wTopic,
widget.NewSeparator(),
)
+ wDown = widget.NewIcon(theme.MoveDownIcon())
bottom := container.NewVBox(
widget.NewSeparator(),
- container.NewBorder(nil, nil, wPrompt, wStatus),
+ container.NewBorder(nil, nil,
+ wPrompt, container.NewHBox(wDown, wStatus)),
wEntry,
)
split := container.NewHSplit(wBufferList, wRichScroll)