runeutil

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: MIT Imports: 2 Imported by: 18

Documentation

Overview

Package runeutil provides a utility function for use in Bubbles that can process Key messages containing runes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(sanitizer) sanitizer

Option is the type of option that can be passed to Sanitize().

func ReplaceNewlines

func ReplaceNewlines(nlRepl string) Option

ReplaceNewlines replaces newline characters by the specified string.

func ReplaceTabs

func ReplaceTabs(tabRepl string) Option

ReplaceTabs replaces tabs by the specified string.

type Sanitizer

type Sanitizer interface {
	// Sanitize removes control characters from runes in a KeyRunes
	// message, and optionally replaces newline/carriage return/tabs by a
	// specified character.
	//
	// The rune array is modified in-place if possible. In that case, the
	// returned slice is the original slice shortened after the control
	// characters have been removed/translated.
	Sanitize(runes []rune) []rune
}

Sanitizer is a helper for bubble widgets that want to process Runes from input key messages.

func NewSanitizer

func NewSanitizer(opts ...Option) Sanitizer

NewSanitizer constructs a rune sanitizer.

Jump to

Keyboard shortcuts

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