+
Skip to content

A example of autoscrolling for line wrapping scene #325

@7yyo

Description

@7yyo
x := list.Size().X
text := splitByNChars(s, x-2)
for _, t := range text {
	list = append(list, t)
	list.ScrollDown()
}
ui.Render(w.L)
func splitByNChars(s string, n int) []string {
	var result []string
	for i := 0; i < len(s); i += n {
		end := i + n
		if end > len(s) {
			end = len(s)
		}
		result = append(result, s[i:end])
	}
	return result
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载