Skip to content
Myr

input.go

This file

Path

input.go

56 lines · 1.4 KiB · Go

Last changed by

feat: OSC 7501 (#1841)Drew Smirnoffbefore adoption41bc626

History of this file

Take it

1package tea23import (4	uv "github.com/charmbracelet/ultraviolet"5)67// translateInputEvent translates an input event into a Bubble Tea Msg.8func (p *Program) translateInputEvent(e uv.Event) Msg {9	switch e := e.(type) {10	case uv.ClipboardEvent:11		return ClipboardMsg(e)12	case uv.ForegroundColorEvent:13		return ForegroundColorMsg(e)14	case uv.BackgroundColorEvent:15		return BackgroundColorMsg(e)16	case uv.CursorColorEvent:17		return CursorColorMsg(e)18	case uv.CursorPositionEvent:19		return CursorPositionMsg(e)20	case uv.FocusEvent:21		return FocusMsg(e)22	case uv.BlurEvent:23		return BlurMsg(e)24	case uv.KeyPressEvent:25		return KeyPressMsg(e)26	case uv.KeyReleaseEvent:27		return KeyReleaseMsg(e)28	case uv.MouseClickEvent:29		return MouseClickMsg(e)30	case uv.MouseMotionEvent:31		return MouseMotionMsg(e)32	case uv.MouseReleaseEvent:33		return MouseReleaseMsg(e)34	case uv.MouseWheelEvent:35		return MouseWheelMsg(e)36	case uv.PasteEvent:37		return PasteMsg(e)38	case uv.PasteStartEvent:39		return PasteStartMsg(e)40	case uv.PasteEndEvent:41		return PasteEndMsg(e)42	case uv.WindowSizeEvent:43		return WindowSizeMsg(e)44	case uv.CapabilityEvent:45		return CapabilityMsg(e)46	case uv.TerminalVersionEvent:47		return TerminalVersionMsg(e)48	case uv.KeyboardEnhancementsEvent:49		return KeyboardEnhancementsMsg(e)50	case uv.ModeReportEvent:51		return ModeReportMsg(e)52	case uv.ProgramStatusSupportEvent:53		return ProgramStatusSupportMsg{}54	}55	return e56}