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:
@@ -1857,6 +1857,10 @@ func markDirty() {
|
||||
}
|
||||
|
||||
// EditorLayout computes the element tree for the editor page.
|
||||
// FindBarHeight is the find bar's height; buildFindBar and EditorLayout
|
||||
// (which shrinks the text area to make room) both use it.
|
||||
const FindBarHeight = ui.Dp(40)
|
||||
|
||||
// buildFindBar lays out the in-file search bar: [input][counter][prev][next]
|
||||
// [close], full screen width, directly below the margin-free top bar (the
|
||||
// bars merge, so this one does too; inner content keeps the margin). The
|
||||
@@ -1866,7 +1870,7 @@ func markDirty() {
|
||||
func buildFindBar(screenWidth ui.Dp) ui.Element {
|
||||
margin := ui.Dp(10)
|
||||
gap := ui.Dp(8)
|
||||
h := ui.Dp(40)
|
||||
h := FindBarHeight
|
||||
topY := ui.Dp(32) // top bar height (see EditorLayout)
|
||||
|
||||
// Right-hand button column: prev, next, close.
|
||||
@@ -1988,7 +1992,12 @@ func EditorLayout(screenWidth, screenHeight ui.Dp, wordWrap bool) []ui.Element {
|
||||
}
|
||||
|
||||
// --- Editor text area ---
|
||||
// While the find bar is open it sits in [32, 32+FindBarHeight); shrink the
|
||||
// text area from the top so the first visible line is not covered.
|
||||
editorY := statusBarRegion.Y + statusBarRegion.H
|
||||
if TheState.Editor.Find.Visible {
|
||||
editorY += FindBarHeight
|
||||
}
|
||||
editorH := bottomBarRegion.Y - editorY
|
||||
editorRegion := ui.Region{
|
||||
X: margin, Y: editorY,
|
||||
|
||||
Reference in New Issue
Block a user