hintbar

package
v0.0.13 Latest Latest
Warning

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

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

Documentation

Overview

Package hintbar renders the frame's bottom chrome row: context-sensitive key hints on the left, counters on the right.

It replaces the old status bar's hint strip. Connection state moved to the top bar, so this row is purely "what can I press here" plus "how much is there", and it changes with the interaction mode rather than only with focus.

Index

Constants

View Source
const MinGap = 5

MinGap is the smallest space allowed between the last hint and the right group. Derived from the goldens: at 80 columns the bar keeps four hints and exactly five cells of gap, and a fifth hint would not fit.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hint

type Hint struct {
	Key   string
	Label string
}

Hint is one "key label" pair. Key is rendered in the accent colour and label in faint, so the eye can scan keys without reading the labels.

func (Hint) String

func (h Hint) String() string

type Model

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

Model is the hint bar.

func New

func New(roles theme.Roles) Model

func (*Model) ClearNotice

func (m *Model) ClearNotice()

func (*Model) SetHints

func (m *Model) SetHints(h []Hint)

func (*Model) SetNotice

func (m *Model) SetNotice(text, kind string)

SetNotice hands the row to a transient message. kind selects the colour: "error" is red, anything else amber for progress.

func (*Model) SetRight

func (m *Model) SetRight(s string)

func (*Model) SetWidth

func (m *Model) SetWidth(w int)

func (Model) View

func (m Model) View() string

View renders the row at exactly the configured width.

The layout is: one leading space, hints joined by two spaces, padding, the right group, one trailing space. Hints are taken IN ORDER and the bar keeps the longest prefix that still leaves MinGap cells before the right group — so a hint is dropped whole, from the right, and never truncated mid-word.

Because it is a prefix, removing a hint from the middle of the set lets the next one in at narrow widths. That is the intended behaviour and it is what the goldens show: dropping "t thread" gained "e edit" at 100 columns rather than just widening the gap.

Jump to

Keyboard shortcuts

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