Documentation

Index

Constants

View Source
const (
	NoLineNumbers = LineNumberMode(iota)
	RelativeLineNumbers
	AbsoluteLineNumbers
)
View Source
const (
	// Background is context-sensitive
	DefaultBackground = BackgroundMode(iota)
	// background does not change colour
	StableBackground
)

Variables

View Source
var ErrInvalidViewport = errors.New("Invalid viewport")
View Source
var ErrKBLocked = errors.New("Keyboard mode is locked")

Functions

This section is empty.

Types

type BackgroundMode

type BackgroundMode uint8

BackgroundMode represents whether or not the viewport background should change colour depending on the mode. It can be disabled by setting the viewport mode to StableBackground.

type LineNumberMode

type LineNumberMode int

type RequestRerender

type RequestRerender struct{}

type Viewport

type Viewport struct {
	demodel.Map
	demodel.Renderer
	Location image.Point

	Window screen.Window

	BackgroundMode BackgroundMode

	// contains filtered or unexported fields

}

func (*Viewport) DeregisterMouseListener

func (v *Viewport) DeregisterMouseListener(callback chan interface{})

func (*Viewport) GetImageMap

func (v *Viewport) GetImageMap(buf *demodel.CharBuffer, viewport image.Rectangle) demodel.ImageMap

func (*Viewport) GetKeyboardMode

func (v *Viewport) GetKeyboardMode() demodel.Map

func (*Viewport) HandleMouseWheel

func (v *Viewport) HandleMouseWheel(e mouse.Event, buff *demodel.CharBuffer, wSize image.Point) bool

Handles a mousewheel event. Returns true if the event did something that should result in a repainting of the screen.

func (*Viewport) LockKeyboardMode

func (v *Viewport) LockKeyboardMode(m demodel.Map) error

Sets the keyboard mode in a way that future requests to SetKeyboardMode will fail.

func (*Viewport) NotifyMouseListeners

func (v *Viewport) NotifyMouseListeners(event interface{})

func (*Viewport) RegisterMouseListener

func (v *Viewport) RegisterMouseListener(callback chan interface{})

func (*Viewport) RenderInto

func (v *Viewport) RenderInto(dst draw.Image, buffer *demodel.CharBuffer, viewport image.Rectangle) error

func (*Viewport) Rerender

func (v *Viewport) Rerender()

func (*Viewport) ResetLocation

func (v *Viewport) ResetLocation() error

func (*Viewport) SetKeyboardMode

func (v *Viewport) SetKeyboardMode(m demodel.Map) error

func (*Viewport) SetOption

func (v *Viewport) SetOption(opt string, val interface{}) error

func (*Viewport) SetRenderer

func (v *Viewport) SetRenderer(r demodel.Renderer) error

func (*Viewport) UnlockKeyboardMode

func (v *Viewport) UnlockKeyboardMode(d demodel.Map) error

Unlocks a locked keyboard mode. The locked mode must be passed as a parameter to ensure that it's the same caller that locked it. It's not secure, but it prevents plugins from accidentally unlocking someone else's locked keyboard. Returns ErrKBLocked if d doesn't equal the mode that it's locked to.