gizak / termui

Golang terminal dashboard
MIT License
13.14k stars 787 forks source link

Add option to autoscroll Paragraph when appending text #125

Open Chillance opened 7 years ago

Chillance commented 7 years ago

Hey,

I noticed there doesn't seem to be any kind of autoscroll feature when inserting new text with par.Text += "Text\n" and it is at the bottom. It would be nice to have this boolean available.

Also, it doesn't seem to be possible to not wrap text inside the par (when using the layout at least). Meaning, text will wrap as you decrease the width. This works fine with lists though.

Thanks

cjbassi commented 5 years ago

Just added the TextWrap option to the Paragraph widget that allows you to toggle line wrapping. So that leaves us with the autoscroll feature left to implement.

ibudisteanu commented 3 years ago

Any update to the auto scroll ? I have done something like this.

func message(color, text string) {
    ss := strings.Split(logs.Text, "\n")
    pos := len(ss) - 16
    if pos < 0 {
        pos = 0
    }
    logs.Text = strings.Join(ss[pos:], "\n") + "[" + text+ "]" + color + "\n"
    ui.Render(logs)
}