Help us shape the future of Go! Take the 2026 Go Developer Survey

commitmsg

package
v0.4.0 Latest Latest
Warning

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

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

Documentation

Overview

Package commitmsg prompts for the commit message of one split tag during a multi-split. The parent model owns the prompt, routes keys to it while it is visible, and reads the finished message back out when the user confirms.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

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

Model is the commit message prompt. Keystrokes reach it through the parent model, which must copy it back into its own state because every mutator takes a pointer receiver.

func New

func New() Model

New returns a hidden prompt aimed at tag 'A' with an empty message.

func (*Model) AppendChar

func (m *Model) AppendChar(ch rune)

AppendChar adds one character to the end of the message with no length limit.

func (*Model) Backspace

func (m *Model) Backspace()

Backspace drops the final byte of the message, so a multi-byte rune is removed one byte at a time. An empty message is left alone.

func (Model) GetMessage

func (m Model) GetMessage() string

GetMessage returns the text typed so far, empty when the user has entered nothing.

func (Model) GetTag

func (m Model) GetTag() SplitTag

GetTag returns the split tag the current message belongs to.

func (*Model) Hide

func (m *Model) Hide()

Hide takes the prompt off screen and keeps the typed message, which stays readable through GetMessage until the next SetTag.

func (*Model) IsVisible

func (m *Model) IsVisible() bool

IsVisible reports whether keys belong to the prompt rather than the main view.

func (*Model) SetTag

func (m *Model) SetTag(tag SplitTag)

SetTag points the prompt at a split tag and clears any message typed for the previous one.

func (*Model) Show

func (m *Model) Show()

Show reveals the prompt. While it is visible the parent model routes every key here, so call SetTag first to avoid collecting text against a stale tag.

func (Model) View

func (m Model) View(width, _ int) string

View centers the prompt in a terminal of the given cell dimensions, returning an empty string while hidden so the caller can fall through to the view underneath.

type SplitTag

type SplitTag rune

SplitTag names one destination of a multi-split by its display letter ('A', 'B', ...).

Jump to

Keyboard shortcuts

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