widget: simplify Editor.offsetToScreenPos

It used to return an iterator function, now it just takes the result
of a previous call.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2022-02-04 16:54:14 +01:00
parent d0869ef457
commit 3614782e0d
2 changed files with 37 additions and 47 deletions
+1 -1
View File
@@ -151,7 +151,7 @@ func TestEditorCaretConsistency(t *testing.T) {
t.Helper()
gotLine, gotCol := e.CaretPos()
gotCoords := e.CaretCoords()
want, _ := e.offsetToScreenPos(e.caret.start.ofs)
want := e.offsetToScreenPos(combinedPos{}, e.caret.start.ofs)
wantCoords := f32.Pt(float32(want.x)/64, float32(want.y))
if want.lineCol.Y != gotLine || want.lineCol.X != gotCol || gotCoords != wantCoords {
return fmt.Errorf("caret (%d,%d) pos %s, want (%d,%d) pos %s",