display

package
v2.0.13 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetStatusInfoFnLua

func SetStatusInfoFnLua(fn string)

Types

type BWindow

type BWindow interface {
	Window
	SoftWrap
	SetBuffer(b *buffer.Buffer)
	BufView() View
}

type BufWindow

type BufWindow struct {
	*View

	// Buffer being shown in this window
	Buf *buffer.Buffer
	// contains filtered or unexported fields
}

The BufWindow provides a way of displaying a certain section of a buffer.

func NewBufWindow

func NewBufWindow(x, y, width, height int, buf *buffer.Buffer) *BufWindow

NewBufWindow creates a new window at a location in the screen with a width and height

func (*BufWindow) BufView added in v2.0.9

func (w *BufWindow) BufView() View

BufView returns the width, height and x,y location of the actual buffer. It is not exactly the same as the whole window which also contains gutter, ruler, scrollbar and statusline.

func (*BufWindow) Clear

func (w *BufWindow) Clear()

Clear resets all cells in this window to the default style

func (*BufWindow) Diff added in v2.0.9

func (w *BufWindow) Diff(s1, s2 SLoc) int

Diff returns the difference (the vertical distance) between two SLocs.

func (*BufWindow) Display

func (w *BufWindow) Display()

Display displays the buffer and the statusline

func (*BufWindow) GetView

func (w *BufWindow) GetView() *View

GetView gets the view.

func (*BufWindow) IsActive

func (w *BufWindow) IsActive() bool

IsActive returns true if this window is active.

func (*BufWindow) LocFromVLoc added in v2.0.9

func (w *BufWindow) LocFromVLoc(vloc VLoc) buffer.Loc

LocFromVLoc takes a visual location in the linewrapped buffer and returns the position in the buffer corresponding to this visual location.

func (*BufWindow) LocFromVisual

func (w *BufWindow) LocFromVisual(svloc buffer.Loc) buffer.Loc

LocFromVisual takes a visual location (x and y position) and returns the position in the buffer corresponding to the visual location If the requested position does not correspond to a buffer location it returns the nearest position

func (*BufWindow) Relocate

func (w *BufWindow) Relocate() bool

Relocate moves the view window so that the cursor is in view This is useful if the user has scrolled far away, and then starts typing Returns true if the window location is moved

func (*BufWindow) Resize

func (w *BufWindow) Resize(width, height int)

Resize resizes this window.

func (*BufWindow) SLocFromLoc added in v2.0.9

func (w *BufWindow) SLocFromLoc(loc buffer.Loc) SLoc

SLocFromLoc takes a position in the buffer and returns the location of the visual line containing this position.

func (*BufWindow) Scroll added in v2.0.9

func (w *BufWindow) Scroll(s SLoc, n int) SLoc

Scroll returns the location which is n visual lines below the location s i.e. the result of scrolling n lines down. n can be negative, which means scrolling up. The returned location is guaranteed to be within the buffer boundaries.

func (*BufWindow) SetActive

func (w *BufWindow) SetActive(b bool)

SetActive marks the window as active.

func (*BufWindow) SetBuffer

func (w *BufWindow) SetBuffer(b *buffer.Buffer)

SetBuffer sets this window's buffer.

func (*BufWindow) SetView

func (w *BufWindow) SetView(view *View)

GetView sets the view.

func (*BufWindow) VLocFromLoc added in v2.0.9

func (w *BufWindow) VLocFromLoc(loc buffer.Loc) VLoc

VLocFromLoc takes a position in the buffer and returns the corresponding visual location in the linewrapped buffer.

type InfoWindow

type InfoWindow struct {
	*info.InfoBuf
	*View
	// contains filtered or unexported fields
}

func NewInfoWindow

func NewInfoWindow(b *info.InfoBuf) *InfoWindow

func (*InfoWindow) BufView added in v2.0.9

func (i *InfoWindow) BufView() View

func (*InfoWindow) Clear

func (i *InfoWindow) Clear()

func (*InfoWindow) Diff added in v2.0.9

func (i *InfoWindow) Diff(s1, s2 SLoc) int

func (*InfoWindow) Display

func (i *InfoWindow) Display()

func (*InfoWindow) GetView

func (i *InfoWindow) GetView() *View

func (*InfoWindow) IsActive

func (i *InfoWindow) IsActive() bool

func (*InfoWindow) LocFromVLoc added in v2.0.9

func (i *InfoWindow) LocFromVLoc(vloc VLoc) buffer.Loc

func (*InfoWindow) LocFromVisual

func (i *InfoWindow) LocFromVisual(vloc buffer.Loc) buffer.Loc

func (*InfoWindow) Relocate

func (i *InfoWindow) Relocate() bool

func (*InfoWindow) Resize

func (i *InfoWindow) Resize(w, h int)

func (*InfoWindow) SLocFromLoc added in v2.0.9

func (i *InfoWindow) SLocFromLoc(loc buffer.Loc) SLoc

func (*InfoWindow) Scroll added in v2.0.9

func (i *InfoWindow) Scroll(s SLoc, n int) SLoc

func (*InfoWindow) SetActive

func (i *InfoWindow) SetActive(b bool)

func (*InfoWindow) SetBuffer

func (i *InfoWindow) SetBuffer(b *buffer.Buffer)

func (*InfoWindow) SetView

func (i *InfoWindow) SetView(v *View)

func (*InfoWindow) VLocFromLoc added in v2.0.9

func (i *InfoWindow) VLocFromLoc(loc buffer.Loc) VLoc

type SLoc added in v2.0.9

type SLoc struct {
	Line, Row int
}

SLoc represents a vertical scrolling location, i.e. a location of a visual line in the buffer. When softwrap is enabled, a buffer line may be displayed as multiple visual lines (rows). So SLoc stores a number of a line in the buffer and a number of a row within this line.

func (SLoc) GreaterEqual added in v2.0.12

func (s SLoc) GreaterEqual(b SLoc) bool

GreaterEqual returns true if s is bigger than or equal to b

func (SLoc) GreaterThan added in v2.0.9

func (s SLoc) GreaterThan(b SLoc) bool

GreaterThan returns true if s is bigger than b

func (SLoc) LessEqual added in v2.0.12

func (s SLoc) LessEqual(b SLoc) bool

LessEqual returns true if s is less than or equal to b

func (SLoc) LessThan added in v2.0.9

func (s SLoc) LessThan(b SLoc) bool

LessThan returns true if s is less b

type SoftWrap added in v2.0.9

type SoftWrap interface {
	Scroll(s SLoc, n int) SLoc
	Diff(s1, s2 SLoc) int
	SLocFromLoc(loc buffer.Loc) SLoc
	VLocFromLoc(loc buffer.Loc) VLoc
	LocFromVLoc(vloc VLoc) buffer.Loc
}

type StatusLine

type StatusLine struct {
	Info map[string]func(*buffer.Buffer) string
	// contains filtered or unexported fields
}

StatusLine represents the information line at the bottom of each window It gives information such as filename, whether the file has been modified, filetype, cursor location

func NewStatusLine

func NewStatusLine(win *BufWindow) *StatusLine

NewStatusLine returns a statusline bound to a window

func (*StatusLine) Display

func (s *StatusLine) Display()

Display draws the statusline to the screen

func (*StatusLine) FindOpt

func (s *StatusLine) FindOpt(opt string) interface{}

FindOpt finds a given option in the current buffer's settings

type TabWindow

type TabWindow struct {
	Names []string

	Y     int
	Width int
	// contains filtered or unexported fields
}

func NewTabWindow

func NewTabWindow(w int, y int) *TabWindow

func (*TabWindow) Active

func (w *TabWindow) Active() int

func (*TabWindow) Display

func (w *TabWindow) Display()

func (*TabWindow) LocFromVisual

func (w *TabWindow) LocFromVisual(vloc buffer.Loc) int

func (*TabWindow) Resize

func (w *TabWindow) Resize(width, height int)

func (*TabWindow) Scroll

func (w *TabWindow) Scroll(amt int)

func (*TabWindow) SetActive

func (w *TabWindow) SetActive(a int)

func (*TabWindow) TotalSize

func (w *TabWindow) TotalSize() int

type TermWindow

type TermWindow struct {
	*View
	*shell.Terminal
	// contains filtered or unexported fields
}

func NewTermWindow

func NewTermWindow(x, y, w, h int, term *shell.Terminal) *TermWindow

func (*TermWindow) Clear

func (w *TermWindow) Clear()

func (*TermWindow) Display

func (w *TermWindow) Display()

Display displays this terminal in a view

func (*TermWindow) GetView

func (w *TermWindow) GetView() *View

func (*TermWindow) IsActive

func (w *TermWindow) IsActive() bool

func (*TermWindow) LocFromVisual

func (w *TermWindow) LocFromVisual(vloc buffer.Loc) buffer.Loc

func (*TermWindow) Relocate

func (w *TermWindow) Relocate() bool

func (*TermWindow) Resize

func (w *TermWindow) Resize(width, height int)

Resize informs the terminal of a resize event

func (*TermWindow) SetActive

func (w *TermWindow) SetActive(b bool)

func (*TermWindow) SetView

func (w *TermWindow) SetView(v *View)

type UIWindow

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

func NewUIWindow

func NewUIWindow(n *views.Node) *UIWindow

func (*UIWindow) Display

func (w *UIWindow) Display()

func (*UIWindow) GetMouseSplitNode added in v2.0.7

func (w *UIWindow) GetMouseSplitNode(vloc buffer.Loc) *views.Node

func (*UIWindow) Resize

func (w *UIWindow) Resize(width, height int)

func (*UIWindow) SetActive

func (w *UIWindow) SetActive(b bool)

type VLoc added in v2.0.9

type VLoc struct {
	SLoc
	VisualX int
}

VLoc represents a location in the buffer as a visual location in the linewrapped buffer.

type View

type View struct {
	X, Y          int // X,Y location of the view
	Width, Height int // Width and height of the view

	// Start line of the view (for vertical scroll)
	StartLine SLoc

	// Start column of the view (for horizontal scroll)
	// note that since the starting column of every line is different if the view
	// is scrolled, StartCol is a visual index (will be the same for every line)
	StartCol int
}

type Window

type Window interface {
	Display()
	Clear()
	Relocate() bool
	GetView() *View
	SetView(v *View)
	LocFromVisual(vloc buffer.Loc) buffer.Loc
	Resize(w, h int)
	SetActive(b bool)
	IsActive() bool
}

Jump to

Keyboard shortcuts

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