Documentation ¶
Index ¶
- func ClearHighlightRange(t *widget.TextGrid, blockMode bool, startRow, startCol, endRow, endCol int)
- func GetTextRange(t *widget.TextGrid, blockMode bool, startRow, startCol, endRow, endCol int) string
- func HighlightRange(t *widget.TextGrid, blockMode bool, startRow, startCol, endRow, endCol int, ...)
- func NewTermTextGridStyle(fg, bg color.Color, bitmask byte) widget.TextGridStyle
- type HighlightOption
- type TermTextGridStyle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearHighlightRange ¶
func ClearHighlightRange(t *widget.TextGrid, blockMode bool, startRow, startCol, endRow, endCol int)
ClearHighlightRange disables the highlight style for the given range
func GetTextRange ¶
func GetTextRange(t *widget.TextGrid, 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 *widget.TextGrid, 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) 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.
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 TermTextGridStyle ¶
type TermTextGridStyle struct { OriginalTextColor color.Color OriginalBackgroundColor color.Color InvertedTextColor color.Color InvertedBackgroundColor color.Color Highlighted bool }
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) TextColor ¶
func (h *TermTextGridStyle) TextColor() color.Color
TextColor returns the color of the text, depending on whether it is highlighted.