runewidth

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2019 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package runewidth is a wrapper over github.com/mattn/go-runewidth which gives different treatment to certain runes with ambiguous width.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RuneWidth

func RuneWidth(r rune) int

RuneWidth returns the number of cells needed to draw r. Background in http://www.unicode.org/reports/tr11/.

Treats runes used internally by termdash as single-cell (half-width) runes regardless of the locale. I.e. runes that are used to draw lines, boxes, indicate resize or text trimming was needed and runes used by the braille canvas.

This should be safe, since even in locales where these runes have ambiguous width, we still place all the character content around them so they should have be half-width.

func StringWidth

func StringWidth(s string) int

StringWidth is like RuneWidth, but returns the number of cells occupied by all the runes in the string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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