fix: update tests and fix SetCursorFromPoint panic

- Rewrite cursor_test.go to use the current GlyphLayout-based API
  instead of the deleted byteOffsetToLineCol function
- Add guard for empty/missing layout slices in SetCursorFromPoint
  to prevent index-out-of-range panic on empty documents
- Add missing Advance field to e2e test GlyphLayout initialization
- Add cmd/pad/pad binary to .gitignore
This commit is contained in:
gmp
2026-06-04 07:24:44 -04:00
parent dbe822d3f6
commit bef3929f40
4 changed files with 84 additions and 14 deletions
@@ -29,6 +29,7 @@ func TestEditorClickToMoveCursor(t *testing.T) {
ByteOffsets: []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11},
X: []ui.Dp{10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120},
Y: []ui.Dp{70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70},
Advance: []ui.Dp{10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10},
}
// Initial cursor position should be 0 (or end of text, depending on implementation)