parent
b5232dd24d
commit
c4d6f5e584
2 changed files with 9 additions and 7 deletions
|
@ -98,6 +98,7 @@ func (m *Messenger) Error(msg ...interface{}) {
|
||||||
|
|
||||||
// YesNoPrompt asks the user a yes or no question (waits for y or n) and returns the result
|
// YesNoPrompt asks the user a yes or no question (waits for y or n) and returns the result
|
||||||
func (m *Messenger) YesNoPrompt(prompt string) (bool, bool) {
|
func (m *Messenger) YesNoPrompt(prompt string) (bool, bool) {
|
||||||
|
m.hasPrompt = true
|
||||||
m.Message(prompt)
|
m.Message(prompt)
|
||||||
|
|
||||||
_, h := screen.Size()
|
_, h := screen.Size()
|
||||||
|
@ -126,6 +127,7 @@ func (m *Messenger) YesNoPrompt(prompt string) (bool, bool) {
|
||||||
|
|
||||||
// LetterPrompt gives the user a prompt and waits for a one letter response
|
// LetterPrompt gives the user a prompt and waits for a one letter response
|
||||||
func (m *Messenger) LetterPrompt(prompt string, responses ...rune) (rune, bool) {
|
func (m *Messenger) LetterPrompt(prompt string, responses ...rune) (rune, bool) {
|
||||||
|
m.hasPrompt = true
|
||||||
m.Message(prompt)
|
m.Message(prompt)
|
||||||
|
|
||||||
_, h := screen.Size()
|
_, h := screen.Size()
|
||||||
|
@ -347,14 +349,14 @@ func (m *Messenger) DisplaySuggestions(suggestions []string) {
|
||||||
func (m *Messenger) Display() {
|
func (m *Messenger) Display() {
|
||||||
_, h := screen.Size()
|
_, h := screen.Size()
|
||||||
if m.hasMessage {
|
if m.hasMessage {
|
||||||
if !m.hasPrompt && !globalSettings["infobar"].(bool) {
|
if m.hasPrompt || globalSettings["infobar"].(bool) {
|
||||||
return
|
|
||||||
}
|
|
||||||
runes := []rune(m.message + m.response)
|
runes := []rune(m.message + m.response)
|
||||||
for x := 0; x < len(runes); x++ {
|
for x := 0; x < len(runes); x++ {
|
||||||
screen.SetContent(x, h-1, runes[x], nil, m.style)
|
screen.SetContent(x, h-1, runes[x], nil, m.style)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if m.hasPrompt {
|
if m.hasPrompt {
|
||||||
screen.ShowCursor(Count(m.message)+m.cursorx, h-1)
|
screen.ShowCursor(Count(m.message)+m.cursorx, h-1)
|
||||||
screen.Show()
|
screen.Show()
|
||||||
|
|
|
@ -360,7 +360,7 @@ func main() {
|
||||||
// If the user left clicked we check a couple things
|
// If the user left clicked we check a couple things
|
||||||
_, h := screen.Size()
|
_, h := screen.Size()
|
||||||
x, y := e.Position()
|
x, y := e.Position()
|
||||||
if y == h-1 && messenger.message != "" {
|
if y == h-1 && messenger.message != "" && globalSettings["infobar"].(bool) {
|
||||||
// If the user clicked in the bottom bar, and there is a message down there
|
// If the user clicked in the bottom bar, and there is a message down there
|
||||||
// we copy it to the clipboard.
|
// we copy it to the clipboard.
|
||||||
// Often error messages are displayed down there so it can be useful to easily
|
// Often error messages are displayed down there so it can be useful to easily
|
||||||
|
|
Loading…
Reference in a new issue