textinput

package
v0.27.2 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package textinput provides implementations for text input targets and focus tracking.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FocusProvider

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

FocusProvider tracks which text input target currently has focus. It implements port.FocusedInputProvider.

func NewFocusProvider

func NewFocusProvider() *FocusProvider

NewFocusProvider creates a new focus provider.

func (*FocusProvider) GetFocusedInput

func (fp *FocusProvider) GetFocusedInput() port.TextInputTarget

GetFocusedInput returns the currently focused text input target. Returns nil if no text input has focus.

func (*FocusProvider) SetFocusedInput

func (fp *FocusProvider) SetFocusedInput(target port.TextInputTarget)

SetFocusedInput sets the currently focused text input target. Pass nil to clear focus.

type GTKEntryTarget

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

GTKEntryTarget implements TextInputTarget for GTK SearchEntry widgets. It uses the Editable interface methods to insert and delete text.

func NewGTKEntryTarget

func NewGTKEntryTarget(entry *gtk.SearchEntry) *GTKEntryTarget

NewGTKEntryTarget creates a new GTK entry target for a SearchEntry.

func (*GTKEntryTarget) DeleteBeforeCursor

func (t *GTKEntryTarget) DeleteBeforeCursor(ctx context.Context, n int) error

DeleteBeforeCursor deletes n characters before the cursor position.

func (*GTKEntryTarget) InsertText

func (t *GTKEntryTarget) InsertText(ctx context.Context, text string) error

InsertText inserts text at the current cursor position.

type WebViewTarget

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

WebViewTarget implements TextInputTarget for WebView text fields. It uses the clipboard-paste pattern to insert text: 1. Save current clipboard 2. Write text to clipboard 3. Execute paste command 4. Restore original clipboard after a short delay

func NewWebViewTarget

func NewWebViewTarget(webView *webkit.WebView, clipboard port.Clipboard) *WebViewTarget

NewWebViewTarget creates a new WebView target.

func (*WebViewTarget) DeleteBeforeCursor

func (t *WebViewTarget) DeleteBeforeCursor(ctx context.Context, n int) error

DeleteBeforeCursor deletes n characters before the cursor in the WebView. Uses JavaScript to manipulate the focused input element.

func (*WebViewTarget) InsertText

func (t *WebViewTarget) InsertText(ctx context.Context, text string) error

InsertText inserts text at the current cursor position in the WebView. Uses clipboard-paste pattern since WebView doesn't expose direct text insertion.

Jump to

Keyboard shortcuts

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