mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-16 05:47:06 +09:00
Fix infobar prompt
This commit is contained in:
@@ -725,7 +725,7 @@ func (h *BufHandler) SelectAll() bool {
|
|||||||
|
|
||||||
// OpenFile opens a new file in the buffer
|
// OpenFile opens a new file in the buffer
|
||||||
func (h *BufHandler) OpenFile() bool {
|
func (h *BufHandler) OpenFile() bool {
|
||||||
InfoBar.Prompt("> open ", func(resp string, canceled bool) {
|
InfoBar.Prompt("> ", "open ", func(resp string, canceled bool) {
|
||||||
if !canceled {
|
if !canceled {
|
||||||
HandleCommand(resp)
|
HandleCommand(resp)
|
||||||
}
|
}
|
||||||
@@ -889,7 +889,7 @@ func (h *BufHandler) ShellMode() bool {
|
|||||||
|
|
||||||
// CommandMode lets the user enter a command
|
// CommandMode lets the user enter a command
|
||||||
func (h *BufHandler) CommandMode() bool {
|
func (h *BufHandler) CommandMode() bool {
|
||||||
InfoBar.Prompt("> ", func(resp string, canceled bool) {
|
InfoBar.Prompt("> ", "", func(resp string, canceled bool) {
|
||||||
if !canceled {
|
if !canceled {
|
||||||
HandleCommand(resp)
|
HandleCommand(resp)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ func DefaultCommands() map[string]StrCommand {
|
|||||||
// enter
|
// enter
|
||||||
func CommandEditAction(prompt string) BufKeyAction {
|
func CommandEditAction(prompt string) BufKeyAction {
|
||||||
return func(h *BufHandler) bool {
|
return func(h *BufHandler) bool {
|
||||||
InfoBar.Prompt("> "+prompt, func(resp string, canceled bool) {
|
InfoBar.Prompt("> ", prompt, func(resp string, canceled bool) {
|
||||||
if !canceled {
|
if !canceled {
|
||||||
HandleCommand(resp)
|
HandleCommand(resp)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,16 +62,17 @@ func (i *InfoBuf) Error(msg ...interface{}) {
|
|||||||
// TODO: add to log?
|
// TODO: add to log?
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *InfoBuf) Prompt(msg string, callback func(string, bool)) {
|
func (i *InfoBuf) Prompt(prompt string, msg string, callback func(string, bool)) {
|
||||||
// If we get another prompt mid-prompt we cancel the one getting overwritten
|
// If we get another prompt mid-prompt we cancel the one getting overwritten
|
||||||
if i.HasPrompt {
|
if i.HasPrompt {
|
||||||
i.DonePrompt(true)
|
i.DonePrompt(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
i.Msg = msg
|
i.Msg = prompt
|
||||||
i.HasPrompt = true
|
i.HasPrompt = true
|
||||||
i.HasMessage, i.HasError = false, false
|
i.HasMessage, i.HasError = false, false
|
||||||
i.PromptCallback = callback
|
i.PromptCallback = callback
|
||||||
|
i.Buffer.Insert(i.Buffer.Start(), msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *InfoBuf) DonePrompt(canceled bool) {
|
func (i *InfoBuf) DonePrompt(canceled bool) {
|
||||||
|
|||||||
Reference in New Issue
Block a user