Fix redundant file loading and buffer insertion bugs

- Fix ChunkedBuffer.Insert to always update file length.
- Fix UpdateLineIndexAfterEdit to not shift the first line offset.
- Remove redundant ReadFileTask dispatch in HandleBrowserTap.
- Add end-to-end test for typing at start of buffer.
This commit is contained in:
gmp
2026-06-05 10:45:48 -04:00
parent 615957196e
commit be123cf48d
3 changed files with 164 additions and 9 deletions
+3 -4
View File
@@ -5,7 +5,6 @@ import (
"path/filepath"
"strings"
"pad/internal/io/pool"
"pad/internal/ui"
)
@@ -98,8 +97,8 @@ func HandleBrowserTap(bm *BrowserManager, s *BrowserState, index int) {
ui.OpenFile(entry.Path)
}
// Dispatch ReadFileTask to the worker pool
task := pool.NewReadFileTask(entry.Path, bm.fs)
fmt.Printf("HandleBrowserTap: Dispatching ReadFileTask for %s\n", entry.Path)
bm.workerPool.Dispatch(task)
// task := pool.NewReadFileTask(entry.Path, bm.fs)
// fmt.Printf("HandleBrowserTap: Dispatching ReadFileTask for %s\n", entry.Path)
// bm.workerPool.Dispatch(task)
}
}