elided

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package elided renders text that says when it has been cut short.

A packet list column that is too narrow simply stops drawing, so 192.0.2.10 in an eighty-column terminal appears as 192.0.2.1 - a different address, equally valid, with nothing to say a digit is missing. Somebody reading that writes down the wrong host. Every value in the list can be cut this way; addresses are only where it does the most damage.

Index

Constants

View Source
const Marker = '…'

Marker ends a value that did not fit. One cell wide, and distinct from anything that appears in an address, a protocol name or a length.

Variables

This section is empty.

Functions

func Clip

func Clip(s string, width int) string

Clip shortens s to fit width columns, ending it with Marker when anything was removed.

Width is counted in terminal cells rather than runes: a CJK hostname or an emoji in a payload occupies two, and counting runes would overflow the column and push the rest of the row sideways.

Types

type Widget

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

Widget is a text widget that clips to the width it is given, when it is given only one row to draw in.

func New

func New(txt string) *Widget

func (*Widget) Render

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

func (*Widget) RenderSize

func (w *Widget) RenderSize(size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) gowid.IRenderBox

func (*Widget) Selectable

func (w *Widget) Selectable() bool

func (*Widget) Text

func (w *Widget) Text() string

func (*Widget) UserInput

func (w *Widget) UserInput(ev interface{}, size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) bool

Jump to

Keyboard shortcuts

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