mirror of
https://github.com/junegunn/fzf.git
synced 2025-08-24 08:53:50 -07:00
@@ -1724,6 +1724,9 @@ func (t *Terminal) updatePromptOffset() ([]rune, []rune) {
|
|||||||
func (t *Terminal) promptLine() int {
|
func (t *Terminal) promptLine() int {
|
||||||
if t.headerFirst {
|
if t.headerFirst {
|
||||||
max := t.window.Height() - 1
|
max := t.window.Height() - 1
|
||||||
|
if max <= 0 { // Extremely short terminal
|
||||||
|
return 0
|
||||||
|
}
|
||||||
if !t.noSeparatorLine() {
|
if !t.noSeparatorLine() {
|
||||||
max--
|
max--
|
||||||
}
|
}
|
||||||
@@ -1759,9 +1762,14 @@ func (t *Terminal) trimMessage(message string, maxWidth int) string {
|
|||||||
func (t *Terminal) printInfo() {
|
func (t *Terminal) printInfo() {
|
||||||
pos := 0
|
pos := 0
|
||||||
line := t.promptLine()
|
line := t.promptLine()
|
||||||
move := func(y int, x int, clear bool) {
|
maxHeight := t.window.Height()
|
||||||
|
move := func(y int, x int, clear bool) bool {
|
||||||
|
if y < 0 || y >= maxHeight {
|
||||||
|
return false
|
||||||
|
}
|
||||||
t.move(y, x, clear)
|
t.move(y, x, clear)
|
||||||
t.markOtherLine(y)
|
t.markOtherLine(y)
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
printSpinner := func() {
|
printSpinner := func() {
|
||||||
if t.reading {
|
if t.reading {
|
||||||
@@ -1800,7 +1808,9 @@ func (t *Terminal) printInfo() {
|
|||||||
|
|
||||||
if t.infoStyle == infoHidden {
|
if t.infoStyle == infoHidden {
|
||||||
if t.separatorLen > 0 {
|
if t.separatorLen > 0 {
|
||||||
move(line+1, 0, false)
|
if !move(line+1, 0, false) {
|
||||||
|
return
|
||||||
|
}
|
||||||
printSeparator(t.window.Width()-1, false)
|
printSeparator(t.window.Width()-1, false)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
@@ -1844,12 +1854,16 @@ func (t *Terminal) printInfo() {
|
|||||||
|
|
||||||
switch t.infoStyle {
|
switch t.infoStyle {
|
||||||
case infoDefault:
|
case infoDefault:
|
||||||
move(line+1, 0, t.separatorLen == 0)
|
if !move(line+1, 0, t.separatorLen == 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
printSpinner()
|
printSpinner()
|
||||||
t.window.Print(" ") // Margin
|
t.window.Print(" ") // Margin
|
||||||
pos = 2
|
pos = 2
|
||||||
case infoRight:
|
case infoRight:
|
||||||
move(line+1, 0, false)
|
if !move(line+1, 0, false) {
|
||||||
|
return
|
||||||
|
}
|
||||||
case infoInlineRight:
|
case infoInlineRight:
|
||||||
pos = t.promptLen + t.queryLen[0] + t.queryLen[1] + 1
|
pos = t.promptLen + t.queryLen[0] + t.queryLen[1] + 1
|
||||||
case infoInline:
|
case infoInline:
|
||||||
@@ -1921,7 +1935,9 @@ func (t *Terminal) printInfo() {
|
|||||||
|
|
||||||
if t.infoStyle == infoInlineRight {
|
if t.infoStyle == infoInlineRight {
|
||||||
if t.separatorLen > 0 {
|
if t.separatorLen > 0 {
|
||||||
move(line+1, 0, false)
|
if !move(line+1, 0, false) {
|
||||||
|
return
|
||||||
|
}
|
||||||
printSeparator(t.window.Width()-1, false)
|
printSeparator(t.window.Width()-1, false)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
Reference in New Issue
Block a user