MCPcopy Create free account
hub / github.com/alecthomas/devtodo2 / printWrappedText

Function printWrappedText

consoleview.go:94–109  ·  view source on GitHub ↗
(text string, width, subsequentIndent int)

Source from the content-addressed store, hash-verified

92}
93
94func printWrappedText(text string, width, subsequentIndent int) {
95 tokens := strings.Split(text, " ")
96 offset := 0
97 for i, token := range tokens {
98 if i > 0 && offset+len(token) > width {
99 fmt.Printf("\n%s", strings.Repeat(" ", subsequentIndent))
100 offset = 0
101 }
102 fmt.Printf("%s", token)
103 offset += len(token)
104 if offset < width && i != len(tokens)-1 {
105 fmt.Print(" ")
106 offset++
107 }
108 }
109}
110
111func formatTask(width, depth int, task Task, options *ViewOptions) {
112 indent := depth*4 + 4

Callers 3

formatTaskFunction · 0.85
ShowTreeMethod · 0.85
ShowTaskInfoMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected