input

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Overview

Package input holds the pieces that sit between the terminal and the update loop (doc 02 section 14): a filter that coalesces high-rate mouse traffic so a wheel flick cannot starve the keyboard, and the external editor escape hatch for prompts that outgrow a textarea.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpenEditor

func OpenEditor(content string, line, col int) btea.Cmd

OpenEditor suspends the TUI, opens the user's editor on the prompt content with the cursor at line and col (both 1-based), and delivers EditorClosed with the edited text. The temp file is .md so the editor lights up markdown; it is removed after reading back.

Types

type CoalescedWheel

type CoalescedWheel struct {
	Delta int
	X, Y  int
}

CoalescedWheel is the message a burst of wheel events becomes. Delta is the summed step count, positive scrolling down, matching the sign ScrollBy takes. X and Y are from the latest event, for hit-testing which pane the wheel is over.

type EditorClosed

type EditorClosed struct {
	Content string
	Err     error
}

EditorClosed reports the external editor closing: the edited text, or the error that kept it from round-tripping.

type Filter

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

Filter coalesces mouse motion and wheel events before they reach Update. Wheel deltas accumulate so a fast scroll is one message with a summed delta, not a storm; everything else passes through untouched so coalescing can never cost a keystroke. Plug it in with tea.WithFilter(f.Filter).

func NewFilter

func NewFilter() *Filter

NewFilter returns a filter on the real clock.

func (*Filter) Filter

func (f *Filter) Filter(_ btea.Model, msg btea.Msg) btea.Msg

Filter implements the tea.WithFilter contract.

Jump to

Keyboard shortcuts

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