Merge pull request #649 from peco/extraoffset-to-const

Move variable to platform specific const
This commit is contained in:
lestrrat 2026-02-17 12:02:57 +09:00 committed by GitHub
commit 785f8e264d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 6 deletions

View file

@ -14,7 +14,10 @@ import (
"github.com/peco/peco/line"
)
var extraOffset int = 0
// extraOffset is a platform-specific constant that adds extra vertical
// space to layout anchors. On Windows, terminals need an additional line
// reserved at the bottom. Set per-platform via layout_windows.go and
// layout_notwindows.go.
// ansiLiner is an optional interface for lines that carry ANSI color attributes.
type ansiLiner interface {

5
layout_any.go Normal file
View file

@ -0,0 +1,5 @@
//go:build !windows
package peco
const extraOffset = 0

View file

@ -1,7 +1,5 @@
package peco
func init() {
// This is the value we pass to anchor offset when we're running
// on windows platform
extraOffset = 1
}
// extraOffset reserves one additional line at the bottom on Windows
// to account for platform-specific terminal rendering behavior.
const extraOffset = 1