| 360 | } |
| 361 | |
| 362 | func SliceViewportText(text string, offset, height int) string { |
| 363 | lines := strings.Split(text, "\n") |
| 364 | if text == "" { |
| 365 | return "" |
| 366 | } |
| 367 | start := maxInt(0, offset) |
| 368 | end := maxInt(start, start+maxInt(1, height)) |
| 369 | if start > len(lines) { |
| 370 | start = len(lines) |
| 371 | } |
| 372 | if end > len(lines) { |
| 373 | end = len(lines) |
| 374 | } |
| 375 | return strings.Join(lines[start:end], "\n") |
| 376 | } |
| 377 | |
| 378 | func (b *FullscreenRendererBackend) ScrollPane(pane, text string, delta, height int) { |
| 379 | lines := strings.Split(text, "\n") |