mirror of https://github.com/Hilbis/Hilbish
fix: don't refetch tab completion on refresh if its already open (closes #163)
parent
9d385efbfc
commit
3196f0dcb9
|
@ -96,6 +96,7 @@ type Instance struct {
|
||||||
tabCompletionSelect bool // We may have completions printed, but no selected candidate yet
|
tabCompletionSelect bool // We may have completions printed, but no selected candidate yet
|
||||||
tabCompletionReverse bool // Groups sometimes use this indicator to know how they should handle their index
|
tabCompletionReverse bool // Groups sometimes use this indicator to know how they should handle their index
|
||||||
tcUsedY int // Comprehensive offset of the currently built completions
|
tcUsedY int // Comprehensive offset of the currently built completions
|
||||||
|
completionOpen bool
|
||||||
|
|
||||||
// Candidate / virtual completion string / etc
|
// Candidate / virtual completion string / etc
|
||||||
currentComp []rune // The currently selected item, not yet a real part of the input line.
|
currentComp []rune // The currently selected item, not yet a real part of the input line.
|
||||||
|
|
|
@ -79,9 +79,8 @@ func (rl *Instance) RefreshPromptInPlace(prompt string) (err error) {
|
||||||
// Prompt data intependent
|
// Prompt data intependent
|
||||||
if !rl.modeTabCompletion {
|
if !rl.modeTabCompletion {
|
||||||
rl.tcUsedY = 1
|
rl.tcUsedY = 1
|
||||||
// Account for the info line
|
|
||||||
} else if rl.modeTabCompletion && rl.modeAutoFind {
|
} else if rl.modeTabCompletion && rl.modeAutoFind {
|
||||||
rl.tcUsedY = 0
|
rl.tcUsedY = -1 // idk man
|
||||||
} else {
|
} else {
|
||||||
rl.tcUsedY = 1
|
rl.tcUsedY = 1
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,7 +215,7 @@ func (rl *Instance) getCompletions() {
|
||||||
// moveTabCompletionHighlight - This function is in charge of
|
// moveTabCompletionHighlight - This function is in charge of
|
||||||
// computing the new position in the current completions liste.
|
// computing the new position in the current completions liste.
|
||||||
func (rl *Instance) moveTabCompletionHighlight(x, y int) {
|
func (rl *Instance) moveTabCompletionHighlight(x, y int) {
|
||||||
|
rl.completionOpen = true
|
||||||
g := rl.getCurrentGroup()
|
g := rl.getCurrentGroup()
|
||||||
|
|
||||||
// If there is no current group, we leave any current completion mode.
|
// If there is no current group, we leave any current completion mode.
|
||||||
|
|
|
@ -11,8 +11,10 @@ func (rl *Instance) updateHelpers() {
|
||||||
// Thus overwrites anything having been dirtily added/forced/modified, like rl.SetInfoText()
|
// Thus overwrites anything having been dirtily added/forced/modified, like rl.SetInfoText()
|
||||||
rl.getInfoText()
|
rl.getInfoText()
|
||||||
rl.getHintText()
|
rl.getHintText()
|
||||||
if rl.modeTabCompletion {
|
if rl.modeTabCompletion && !rl.completionOpen {
|
||||||
rl.getTabCompletion()
|
rl.getTabCompletion()
|
||||||
|
} else {
|
||||||
|
if rl.completionOpen { rl.completionOpen = false }
|
||||||
}
|
}
|
||||||
|
|
||||||
// We clear everything
|
// We clear everything
|
||||||
|
|
Loading…
Reference in New Issue