Shrink the text area while the find bar is open
The find bar (32..72) used to be drawn over the top of the text area, covering the first visible line. EditorLayout now lowers the text area top by FindBarHeight (new shared constant) while the find bar is visible; it snaps back on close. e2e: assert the editor region top moves to 32+FindBarHeight while open.
This commit is contained in:
@@ -80,6 +80,12 @@ func TestRealFile_FindBarAndNavigation(t *testing.T) {
|
||||
if focus.(string) != "find_bar" {
|
||||
t.Fatalf("focus %q, want find_bar", focus)
|
||||
}
|
||||
// The text area must shrink from the top while the find bar is open so
|
||||
// the first line is not covered: region top = top bar (32) + FindBarHeight.
|
||||
reg, _ := h.Inspect(func(st *editor.State) any { return st.EditorRegion })
|
||||
if got := reg.(ui.Region); got.Y != ui.Dp(32)+editor.FindBarHeight {
|
||||
t.Fatalf("editor region top %d, want %d (find bar must not cover text)", int(got.Y), int(ui.Dp(32)+editor.FindBarHeight))
|
||||
}
|
||||
|
||||
// Type the query through the same channel main uses.
|
||||
h.Logic().FindQueryChan() <- "NEEDLE" // case-insensitive
|
||||
|
||||
Reference in New Issue
Block a user