info

package
v1.4.2-0...-d7b39fe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 1, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

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

These are the different types of messages

Variables

This section is empty.

Functions

This section is empty.

Types

type GutterMessage

type GutterMessage struct {
	// contains filtered or unexported fields
}

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

type InfoBuf

type InfoBuf struct {
	*buffer.Buffer

	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

func NewBuffer() *InfoBuf

NewBuffer returns a new infobuffer

func (*InfoBuf) ClearGutter

func (i *InfoBuf) ClearGutter()

ClearGutter clears the info bar and unmarks the message

func (*InfoBuf) Close

func (i *InfoBuf) Close()

Close performs any cleanup necessary when shutting down the infobuffer

func (*InfoBuf) DonePrompt

func (i *InfoBuf) DonePrompt(canceled bool)

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

func (*InfoBuf) DownHistory

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

DownHistory fetches the next item in the history

func (*InfoBuf) Error

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

Error sends an error message to the user

func (*InfoBuf) GutterMessage

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

GutterMessage displays a message and marks it as a gutter message

func (*InfoBuf) LoadHistory

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

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

Message sends a message to the user

func (*InfoBuf) PlugPrompt

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

PlugPrompt provides a plugin interface for calling "Prompt" with the appropriate Lua callbacks

func (*InfoBuf) PlugYNPrompt

func (i *InfoBuf) PlugYNPrompt(prompt string, donecb string)

PlugYNPrompt provides a plugin interface for calling "YNPrompt" with the appropriate Lua callbacks

func (*InfoBuf) Prompt

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

func (i *InfoBuf) Reset()

Reset resets the infobuffer's msg and info

func (*InfoBuf) SaveHistory

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

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

UpHistory fetches the previous item in the history

func (*InfoBuf) YNPrompt

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL