(area *cursor.Area)
| 272 | } |
| 273 | |
| 274 | func (p InteractiveTextInputPrinter) updateArea(area *cursor.Area) string { |
| 275 | if !p.MultiLine { |
| 276 | p.cursorYPos = 0 |
| 277 | } |
| 278 | areaText := p.text |
| 279 | |
| 280 | for i, s := range p.input { |
| 281 | if i < len(p.input)-1 { |
| 282 | areaText += s + "\n" |
| 283 | } else { |
| 284 | areaText += s |
| 285 | } |
| 286 | } |
| 287 | |
| 288 | if p.Mask != "" { |
| 289 | areaText = p.text + strings.Repeat(p.Mask, internal.GetStringMaxWidth(areaText)-internal.GetStringMaxWidth(p.text)) |
| 290 | } |
| 291 | |
| 292 | if p.cursorXPos+internal.GetStringMaxWidth(p.input[p.cursorYPos]) < 1 { |
| 293 | p.cursorXPos = -internal.GetStringMaxWidth(p.input[p.cursorYPos]) |
| 294 | } |
| 295 | |
| 296 | area.Update(areaText) |
| 297 | area.Top() |
| 298 | area.Down(p.cursorYPos + 1) |
| 299 | area.StartOfLine() |
| 300 | if p.MultiLine { |
| 301 | cursor.Right(internal.GetStringMaxWidth(p.input[p.cursorYPos]) + p.cursorXPos) |
| 302 | } else { |
| 303 | cursor.Right(internal.GetStringMaxWidth(areaText) + p.cursorXPos) |
| 304 | } |
| 305 | return areaText |
| 306 | } |
no test coverage detected