loadDataAsync starts async loading and waits for initial data
(loader func(*Buffer, chan<- bool, chan<- error), b *Buffer)
| 89 | |
| 90 | // loadDataAsync starts async loading and waits for initial data |
| 91 | func loadDataAsync(loader func(*Buffer, chan<- bool, chan<- error), b *Buffer) (chan bool, chan error, error) { |
| 92 | userMovedCursor = false // Reset cursor tracking |
| 93 | updateChan := make(chan bool, 10) |
| 94 | doneChan := make(chan error, 1) |
| 95 | |
| 96 | loader(b, updateChan, doneChan) |
| 97 | |
| 98 | // Wait for initial data or error |
| 99 | select { |
| 100 | case <-updateChan: |
| 101 | // Initial data ready |
| 102 | return updateChan, doneChan, nil |
| 103 | case err := <-doneChan: |
| 104 | // Error during initial loading |
| 105 | return nil, nil, err |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | // runApp starts the UI application if not in debug mode |
| 110 | func runApp() error { |
no outgoing calls
no test coverage detected