micro: github.com/zyedidia/micro/internal/info Index | Files

package info

import "github.com/zyedidia/micro/internal/info"


Package Files

gutter.go history.go infobuffer.go


const (
    // GutterInfo represents a simple info message
    GutterInfo = iota
    // GutterWarning represents a compiler warning
    // GutterError represents a compiler error

These are the different types of messages

type GutterMessage Uses

type GutterMessage struct {
    // contains filtered or unexported fields

A GutterMessage is a message displayed on the side of the editor

type InfoBuf Uses

type InfoBuf struct {

    HasPrompt  bool
    HasMessage bool
    HasError   bool
    HasYN      bool

    PromptType string

    Msg    string
    YNResp bool

    // This map stores the history for all the different kinds of uses Prompt has
    // It's a map of history type -> history array
    History    map[string][]string
    HistoryNum int

    // Is the current message a message from the gutter
    HasGutter bool

    PromptCallback func(resp string, canceled bool)
    EventCallback  func(resp string)
    YNCallback     func(yes bool, canceled bool)

The InfoBuf displays messages and other info at the bottom of the screen. It is respresented as a buffer and a message with a style.

func NewBuffer Uses

func NewBuffer() *InfoBuf

NewBuffer returns a new infobuffer

func (*InfoBuf) ClearGutter Uses

func (i *InfoBuf) ClearGutter()

ClearGutter clears the info bar and unmarks the message

func (*InfoBuf) Close Uses

func (i *InfoBuf) Close()

Close performs any cleanup necessary when shutting down the infobuffer

func (*InfoBuf) DonePrompt Uses

func (i *InfoBuf) DonePrompt(canceled bool)

DonePrompt finishes the current prompt and indicates whether or not it was canceled

func (*InfoBuf) DownHistory Uses

func (i *InfoBuf) DownHistory(history []string)

DownHistory fetches the next item in the history

func (*InfoBuf) Error Uses

func (i *InfoBuf) Error(msg ...interface{})

Error sends an error message to the user

func (*InfoBuf) GutterMessage Uses

func (i *InfoBuf) GutterMessage(msg ...interface{})

GutterMessage displays a message and marks it as a gutter message

func (*InfoBuf) LoadHistory Uses

func (i *InfoBuf) LoadHistory()

LoadHistory attempts to load user history from configDir/buffers/history into the history map The savehistory option must be on

func (*InfoBuf) Message Uses

func (i *InfoBuf) Message(msg ...interface{})

Message sends a message to the user

func (*InfoBuf) Prompt Uses

func (i *InfoBuf) Prompt(prompt string, msg string, ptype string, eventcb func(string), donecb func(string, bool))

Prompt starts a prompt for the user, it takes a prompt, a possibly partially filled in msg and callbacks executed when the user executes an event and when the user finishes the prompt The eventcb passes the current user response as the argument and donecb passes the user's message and a boolean indicating if the prompt was canceled

func (*InfoBuf) Reset Uses

func (i *InfoBuf) Reset()

Reset resets the infobuffer's msg and info

func (*InfoBuf) SaveHistory Uses

func (i *InfoBuf) SaveHistory()

SaveHistory saves the user's command history to configDir/buffers/history only if the savehistory option is on

func (*InfoBuf) UpHistory Uses

func (i *InfoBuf) UpHistory(history []string)

UpHistory fetches the previous item in the history

func (*InfoBuf) YNPrompt Uses

func (i *InfoBuf) YNPrompt(prompt string, donecb func(bool, bool))

YNPrompt creates a yes or no prompt, and the callback returns the yes/no result and whether the prompt was canceled

Package info imports 6 packages (graph) and is imported by 2 packages. Updated 2020-02-14. Refresh now. Tools for package owners.