widget

package
v0.0.0-...-f3224d5 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2025 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearHighlightRange

func ClearHighlightRange(t *TermGrid, blockMode bool, startRow, startCol, endRow, endCol int)

ClearHighlightRange disables the highlight style for the given range

func GetTextRange

func GetTextRange(t *TermGrid, blockMode bool, startRow, startCol, endRow, endCol int) string

GetTextRange retrieves a text range from the TextGrid. It collects the text within the specified grid coordinates, starting from (startRow, startCol) and ending at (endRow, endCol), and returns it as a string. The behavior of the selection depends on the blockMode parameter. If blockMode is true, then startCol and endCol apply to each row in the range, creating a block selection. If blockMode is false, startCol applies only to the first row, and endCol applies only to the last row, resulting in a continuous range.

Parameters:

  • blockMode: A boolean flag indicating whether to use block mode.
  • startRow: The starting row index of the text range.
  • startCol: The starting column index of the text range.
  • endRow: The ending row index of the text range.
  • endCol: The ending column index of the text range.

Returns:

  • string: The text content within the specified range as a string.

func HighlightRange

func HighlightRange(t *TermGrid, blockMode bool, startRow, startCol, endRow, endCol int, bitmask byte)

HighlightRange highlight options to the given range if highlighting has previously been applied it is enabled

func NewTermTextGridStyle

func NewTermTextGridStyle(fg, bg color.Color, bitmask byte, blinkEnabled bool) widget.TextGridStyle

NewTermTextGridStyle creates a new TextGridStyle with the specified foreground (fg) and background (bg) colors, as well as a bitmask to control the inversion of colors. If fg or bg is nil, the function will use default foreground and background colors from the theme. The bitmask is used to determine which color channels should be inverted.

Parameters:

  • fg: The foreground color.
  • bg: The background color.
  • bitmask: The bitmask to control color inversion.
  • blinkEnabled: Should this cell blink when told to.

Returns:

A pointer to a TermTextGridStyle initialized with the provided colors and inversion settings.

Types

type HighlightOption

type HighlightOption func(h *TermTextGridStyle)

HighlightOption defines a function type that can modify a TermTextGridStyle.

type TermGrid

type TermGrid struct {
	widget.TextGrid
	// contains filtered or unexported fields
}

TermGrid is a monospaced grid of characters. This is designed to be used by our terminal emulator.

func NewTermGrid

func NewTermGrid() *TermGrid

NewTermGrid creates a new empty TextGrid widget.

func (*TermGrid) CreateRenderer

func (t *TermGrid) CreateRenderer() fyne.WidgetRenderer

CreateRenderer is a private method to Fyne which links this widget to it's renderer

func (*TermGrid) Refresh

func (t *TermGrid) Refresh()

Refresh will be called when this grid should update. We update our blinking status and then call the TextGrid we extended to refresh too.

type TermTextGridStyle

type TermTextGridStyle struct {
	TextStyle               fyne.TextStyle
	OriginalTextColor       color.Color
	OriginalBackgroundColor color.Color
	InvertedTextColor       color.Color
	InvertedBackgroundColor color.Color
	Highlighted             bool
	BlinkEnabled            bool
	// contains filtered or unexported fields
}

TermTextGridStyle defines a style that can be original or highlighted.

func (*TermTextGridStyle) BackgroundColor

func (h *TermTextGridStyle) BackgroundColor() color.Color

BackgroundColor returns the background color, depending on whether it is highlighted.

func (*TermTextGridStyle) Style

func (h *TermTextGridStyle) Style() fyne.TextStyle

Style is the text style a cell should use.

func (*TermTextGridStyle) TextColor

func (h *TermTextGridStyle) TextColor() color.Color

TextColor returns the color of the text, depending on whether it is highlighted.

Jump to

Keyboard shortcuts

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