Switch from Asuka to MyGo, keeping the API client and the feature set: - servers: saved servers, passwordless and password login, proxy, self-signed certificates, per-server device tokens (Keystore), connect form, instance list sheet with switch/disconnect - sessions: virtualized list, search, new session, rename/archive/delete, running indicator, event stream keeps it live - chat: pushed window with system back bar, streaming Markdown via ui/markdown, reasoning and tool rows with image previews, footer menu (read aloud via a Kotlin TTS plugin, copy, fork), user message menu (copy, revert, fork), context usage ring and detail sheet, attachments (photos/files via the document picker), permissions - release builds allow plain http:// LAN servers (Go's net/http dials directly, no cleartext manifest needed) - a local fork of MyGo (third_party/mygo) lowers the Android host's minSdk to 24 (Android 7.0); Go 1.27.4 via mise Version 0.3.0.
38 lines
1.1 KiB
Go
38 lines
1.1 KiB
Go
package editor
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/egoist/mygo/ui"
|
|
)
|
|
|
|
func TestTrailingInlayHoverHitTest(t *testing.T) {
|
|
st := &State{Buffer: NewBuffer("abc\n"), HoverDelay: time.Second}
|
|
st.SetInlays([]Inlay{{Offset: 3, Text: " You, 2 months ago • subject", Trailing: true}})
|
|
var requests []HoverRequest
|
|
st.OnHover = func(r HoverRequest) { requests = append(requests, r) }
|
|
tt := ui.NewTester(func(c *ui.Context) { View(c, st).Fill() }, 900, 300)
|
|
tt.Frame()
|
|
ed := &st.ed
|
|
caret, ok := ed.caretRect(3)
|
|
if !ok {
|
|
t.Fatal("the source line end is not visible")
|
|
}
|
|
y := float32(-ed.scrollY) + caret.Y + ed.view.lineHeight/2
|
|
tt.Move(ed.textX+caret.X+5*ed.view.charWidth, y)
|
|
tt.Advance(1500 * time.Millisecond)
|
|
tt.Frame()
|
|
if len(requests) != 1 || requests[0].Offset != 3 {
|
|
t.Fatalf("hover over trailing inlay requests = %#v", requests)
|
|
}
|
|
|
|
// The blank space after the decoration is still not source text.
|
|
tt.Move(ed.textX+caret.X+50*ed.view.charWidth, y)
|
|
tt.Advance(1500 * time.Millisecond)
|
|
tt.Frame()
|
|
if len(requests) != 1 {
|
|
t.Fatalf("blank space after trailing inlay requested hover: %#v", requests)
|
|
}
|
|
}
|