ui

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2023 License: ISC Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const Overlay = "/overlay"

Variables

This section is empty.

Functions

func IdentColor

func IdentColor(scheme ColorScheme, ident string, self bool) tcell.Color

func IsSplitRune

func IsSplitRune(r rune) bool

Types

type BufferList

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

func NewBufferList

func NewBufferList(colors ConfigColors, mergeLine func(*Line, Line)) BufferList

NewBufferList returns a new BufferList. Call Resize() once before using it.

func (*BufferList) Add

func (bs *BufferList) Add(netID, netName, title string) (i int, added bool)

func (*BufferList) AddLine

func (bs *BufferList) AddLine(netID, title string, line Line)

func (*BufferList) AddLines

func (bs *BufferList) AddLines(netID, title string, before, after []Line)

func (*BufferList) Buffer added in v0.3.0

func (bs *BufferList) Buffer(i int) (netID, title string, ok bool)

func (*BufferList) CloseOverlay

func (bs *BufferList) CloseOverlay()

func (*BufferList) Current

func (bs *BufferList) Current() (netID, title string)

func (*BufferList) DrawHorizontalBufferList

func (bs *BufferList) DrawHorizontalBufferList(screen tcell.Screen, x0, y0, width int, offset *int)

func (*BufferList) DrawTimeline

func (bs *BufferList) DrawTimeline(screen tcell.Screen, x0, y0, nickColWidth int)

func (*BufferList) DrawVerticalBufferList

func (bs *BufferList) DrawVerticalBufferList(screen tcell.Screen, x0, y0, width, height int, offset *int)

func (*BufferList) GetLeftMost

func (bs *BufferList) GetLeftMost(screenWidth int) int

func (*BufferList) HasOverlay

func (bs *BufferList) HasOverlay() bool

func (*BufferList) HorizontalBufferOffset

func (bs *BufferList) HorizontalBufferOffset(x int, offset int) int

func (*BufferList) IsAtTop

func (bs *BufferList) IsAtTop() bool

func (*BufferList) Next

func (bs *BufferList) Next()

func (*BufferList) NextUnread added in v0.3.0

func (bs *BufferList) NextUnread()

func (*BufferList) OpenOverlay

func (bs *BufferList) OpenOverlay()

func (*BufferList) Previous

func (bs *BufferList) Previous()

func (*BufferList) PreviousUnread added in v0.3.0

func (bs *BufferList) PreviousUnread()

func (*BufferList) Remove

func (bs *BufferList) Remove(netID, title string) bool

func (*BufferList) RemoveNetwork

func (bs *BufferList) RemoveNetwork(netID string)

func (*BufferList) ResizeTimeline

func (bs *BufferList) ResizeTimeline(tlInnerWidth, tlHeight, textWidth int)

func (*BufferList) ScrollDown

func (bs *BufferList) ScrollDown(n int)

func (*BufferList) ScrollDownHighlight

func (bs *BufferList) ScrollDownHighlight() bool

func (*BufferList) ScrollUp

func (bs *BufferList) ScrollUp(n int)

func (*BufferList) ScrollUpHighlight

func (bs *BufferList) ScrollUpHighlight() bool

func (*BufferList) SetRead

func (bs *BufferList) SetRead(netID, title string, timestamp time.Time)

func (*BufferList) SetTopic

func (bs *BufferList) SetTopic(netID, title string, topic string)

func (*BufferList) ShowBufferNumbers

func (bs *BufferList) ShowBufferNumbers(enabled bool)

func (*BufferList) To

func (bs *BufferList) To(i int) bool

func (*BufferList) UpdateRead

func (bs *BufferList) UpdateRead() (netID, title string, timestamp time.Time)

type ColorScheme added in v0.2.0

type ColorScheme struct {
	Type   ColorSchemeType
	Others tcell.Color
	Self   tcell.Color
}

type ColorSchemeType added in v0.3.0

type ColorSchemeType int
const (
	ColorSchemeBase ColorSchemeType = iota
	ColorSchemeExtended
	ColorSchemeFixed
)

type Completion

type Completion struct {
	Text      []rune
	CursorIdx int
}

type Config

type Config struct {
	NickColWidth     int
	ChanColWidth     int
	ChanColEnabled   bool
	MemberColWidth   int
	MemberColEnabled bool
	TextMaxWidth     int
	AutoComplete     func(cursorIdx int, text []rune) []Completion
	Mouse            bool
	MergeLine        func(former *Line, addition Line)
	Colors           ConfigColors
}

type ConfigColors

type ConfigColors struct {
	Status tcell.Color
	Prompt tcell.Color
	Unread tcell.Color
	Nicks  ColorScheme
}

type Editor

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

Editor is the text field where the user writes messages and commands.

func NewEditor

func NewEditor(autoComplete func(cursorIdx int, text []rune) []Completion) Editor

NewEditor returns a new Editor. Call Resize() once before using it.

func (*Editor) AutoComplete

func (e *Editor) AutoComplete(offset int) (ok bool)

func (*Editor) BackSearch

func (e *Editor) BackSearch()

func (*Editor) Clear

func (e *Editor) Clear() bool

func (*Editor) Content

func (e *Editor) Content() []rune

Content result must not be modified.

func (*Editor) Down

func (e *Editor) Down()

func (*Editor) Draw

func (e *Editor) Draw(screen tcell.Screen, x0, y int)

func (*Editor) End

func (e *Editor) End()

func (*Editor) Flush

func (e *Editor) Flush() string

func (*Editor) Home

func (e *Editor) Home()

func (*Editor) Left

func (e *Editor) Left()

func (*Editor) LeftWord

func (e *Editor) LeftWord()

func (*Editor) PutRune

func (e *Editor) PutRune(r rune)

func (*Editor) RemRune

func (e *Editor) RemRune() (ok bool)

func (*Editor) RemRuneForward

func (e *Editor) RemRuneForward() (ok bool)

func (*Editor) RemWord

func (e *Editor) RemWord() (ok bool)

func (*Editor) Resize

func (e *Editor) Resize(width int)

func (*Editor) Right

func (e *Editor) Right()

func (*Editor) RightWord

func (e *Editor) RightWord()

func (*Editor) Set

func (e *Editor) Set(text string)

func (*Editor) TextLen

func (e *Editor) TextLen() int

func (*Editor) Up

func (e *Editor) Up()

type Line

type Line struct {
	At        time.Time
	Head      string
	Body      StyledString
	HeadColor tcell.Color
	Notify    NotifyType
	Highlight bool
	Readable  bool
	Mergeable bool
	Data      interface{}
	// contains filtered or unexported fields
}

func (*Line) IsZero

func (l *Line) IsZero() bool

func (*Line) NewLines

func (l *Line) NewLines(width int) []int

type NotifyType

type NotifyType int
const (
	NotifyNone NotifyType = iota
	NotifyUnread
	NotifyHighlight
)

type StyledString

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

func IRCString

func IRCString(raw string) StyledString

func IdentString

func IdentString(scheme ColorScheme, ident string, self bool) StyledString

func PlainSprintf

func PlainSprintf(format string, a ...interface{}) StyledString

func PlainString

func PlainString(s string) StyledString

func Styled

func Styled(s string, style tcell.Style) StyledString

func (StyledString) ParseURLs

func (s StyledString) ParseURLs() StyledString

func (StyledString) String

func (s StyledString) String() string

func (StyledString) Truncate

func (s StyledString) Truncate(w int, tail StyledString) StyledString

type StyledStringBuilder

type StyledStringBuilder struct {
	strings.Builder
	// contains filtered or unexported fields
}

func (*StyledStringBuilder) AddStyle

func (sb *StyledStringBuilder) AddStyle(start int, style tcell.Style)

func (*StyledStringBuilder) Reset

func (sb *StyledStringBuilder) Reset()

func (*StyledStringBuilder) SetStyle

func (sb *StyledStringBuilder) SetStyle(style tcell.Style)

func (*StyledStringBuilder) StyledString

func (sb *StyledStringBuilder) StyledString() StyledString

func (*StyledStringBuilder) WriteStyledString

func (sb *StyledStringBuilder) WriteStyledString(s StyledString)

type UI

type UI struct {
	Events chan tcell.Event
	// contains filtered or unexported fields
}

func New

func New(config Config) (ui *UI, err error)

func (*UI) AddBuffer

func (ui *UI) AddBuffer(netID, netName, title string) (i int, added bool)

func (*UI) AddLine

func (ui *UI) AddLine(netID, buffer string, line Line)

func (*UI) AddLines

func (ui *UI) AddLines(netID, buffer string, before, after []Line)

func (*UI) Beep

func (ui *UI) Beep()

func (*UI) Buffer added in v0.3.0

func (ui *UI) Buffer(i int) (netID, title string, ok bool)

func (*UI) ChannelOffset

func (ui *UI) ChannelOffset() int

func (*UI) ChannelWidth

func (ui *UI) ChannelWidth() int

func (*UI) ClickBuffer

func (ui *UI) ClickBuffer(i int)

func (*UI) ClickMember

func (ui *UI) ClickMember(i int)

func (*UI) ClickedBuffer

func (ui *UI) ClickedBuffer() int

func (*UI) ClickedMember

func (ui *UI) ClickedMember() int

func (*UI) Close

func (ui *UI) Close()

func (*UI) CloseOverlay

func (ui *UI) CloseOverlay()

func (*UI) CurrentBuffer

func (ui *UI) CurrentBuffer() (netID, title string)

func (*UI) Draw

func (ui *UI) Draw(members []irc.Member)

func (*UI) Exit

func (ui *UI) Exit()

func (*UI) GoToBufferNo

func (ui *UI) GoToBufferNo(i int)

func (*UI) HasOverlay

func (ui *UI) HasOverlay() bool

func (*UI) HorizontalBufferOffset

func (ui *UI) HorizontalBufferOffset(x int) int

func (*UI) InputAutoComplete

func (ui *UI) InputAutoComplete(offset int) (ok bool)

func (*UI) InputBackSearch

func (ui *UI) InputBackSearch()

func (*UI) InputBackspace

func (ui *UI) InputBackspace() (ok bool)

func (*UI) InputClear

func (ui *UI) InputClear() bool

func (*UI) InputContent

func (ui *UI) InputContent() []rune

InputContent result must not be modified.

func (*UI) InputDelete

func (ui *UI) InputDelete() (ok bool)

func (*UI) InputDeleteWord

func (ui *UI) InputDeleteWord() (ok bool)

func (*UI) InputDown

func (ui *UI) InputDown()

func (*UI) InputEnd

func (ui *UI) InputEnd()

func (*UI) InputFlush added in v0.3.0

func (ui *UI) InputFlush() (content string)

func (*UI) InputHome

func (ui *UI) InputHome()

func (*UI) InputLeft

func (ui *UI) InputLeft()

func (*UI) InputLeftWord

func (ui *UI) InputLeftWord()

func (*UI) InputRight

func (ui *UI) InputRight()

func (*UI) InputRightWord

func (ui *UI) InputRightWord()

func (*UI) InputRune

func (ui *UI) InputRune(r rune)

func (*UI) InputSet

func (ui *UI) InputSet(text string)

func (*UI) InputUp

func (ui *UI) InputUp()

func (*UI) IsAtTop

func (ui *UI) IsAtTop() bool

func (*UI) JumpBuffer

func (ui *UI) JumpBuffer(sub string) bool

func (*UI) JumpBufferIndex

func (ui *UI) JumpBufferIndex(i int) bool

func (*UI) JumpBufferNetwork

func (ui *UI) JumpBufferNetwork(netID, sub string) bool

func (*UI) MemberOffset

func (ui *UI) MemberOffset() int

func (*UI) MemberWidth

func (ui *UI) MemberWidth() int

func (*UI) NextBuffer

func (ui *UI) NextBuffer()

func (*UI) NextUnreadBuffer added in v0.3.0

func (ui *UI) NextUnreadBuffer()

func (*UI) Notify added in v0.3.0

func (ui *UI) Notify(title string, body string)

func (*UI) OpenOverlay

func (ui *UI) OpenOverlay()

func (*UI) PreviousBuffer

func (ui *UI) PreviousBuffer()

func (*UI) PreviousUnreadBuffer added in v0.3.0

func (ui *UI) PreviousUnreadBuffer()

func (*UI) RemoveBuffer

func (ui *UI) RemoveBuffer(netID, title string)

func (*UI) RemoveNetworkBuffers

func (ui *UI) RemoveNetworkBuffers(netID string)

func (*UI) Resize

func (ui *UI) Resize()

func (*UI) ScrollChannelDownBy

func (ui *UI) ScrollChannelDownBy(n int)

func (*UI) ScrollChannelUpBy

func (ui *UI) ScrollChannelUpBy(n int)

func (*UI) ScrollDown

func (ui *UI) ScrollDown()

func (*UI) ScrollDownBy

func (ui *UI) ScrollDownBy(n int)

func (*UI) ScrollDownHighlight

func (ui *UI) ScrollDownHighlight() bool

func (*UI) ScrollMemberDownBy

func (ui *UI) ScrollMemberDownBy(n int)

func (*UI) ScrollMemberUpBy

func (ui *UI) ScrollMemberUpBy(n int)

func (*UI) ScrollToBuffer added in v0.3.0

func (ui *UI) ScrollToBuffer()

func (*UI) ScrollUp

func (ui *UI) ScrollUp()

func (*UI) ScrollUpBy

func (ui *UI) ScrollUpBy(n int)

func (*UI) ScrollUpHighlight

func (ui *UI) ScrollUpHighlight() bool

func (*UI) SetPrompt

func (ui *UI) SetPrompt(prompt StyledString)

func (*UI) SetRead

func (ui *UI) SetRead(netID, buffer string, timestamp time.Time)

func (*UI) SetStatus

func (ui *UI) SetStatus(status string)

func (*UI) SetTitle added in v0.3.0

func (ui *UI) SetTitle(title string)

func (*UI) SetTopic

func (ui *UI) SetTopic(netID, buffer string, topic string)

func (*UI) ShouldExit

func (ui *UI) ShouldExit() bool

func (*UI) ShowBufferNumbers

func (ui *UI) ShowBufferNumbers(enable bool)

func (*UI) Size

func (ui *UI) Size() (int, int)

func (*UI) ToggleChannelList

func (ui *UI) ToggleChannelList()

func (*UI) ToggleMemberList

func (ui *UI) ToggleMemberList()

func (*UI) UpdateRead

func (ui *UI) UpdateRead() (netID, buffer string, timestamp time.Time)

Jump to

Keyboard shortcuts

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