regexstyle

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package regexstyle provides a widget that highlights the content of its subwidget according to a regular expression. The widget is also given an occurrence parameter which determines which instance of the regex match is highlighted, or if -1 is supplied, all instances are highlighted. The widget currently wraps a text widget only since it depends on that widget being able to clone its content.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContentWidget

type ContentWidget interface {
	gowid.IWidget
	Content() text.IContent
	SetContent(gowid.IApp, text.IContent)
}

This is the type of subwidget supported by regexstyle

type Highlight

type Highlight struct {
	Re    *regexp.Regexp
	Occ   int
	Style gowid.ICellStyler
}

type Widget

type Widget struct {
	ContentWidget
	Highlight
}

func New

func New(w ContentWidget, hl Highlight) *Widget

func (*Widget) RegexMatches

func (w *Widget) RegexMatches() int

func (*Widget) Render

func (w *Widget) Render(size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) gowid.ICanvas

func (*Widget) SetRegex

func (w *Widget) SetRegex(re *regexp.Regexp)

func (*Widget) SetRegexOccurrence

func (w *Widget) SetRegexOccurrence(i int)

Jump to

Keyboard shortcuts

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