From bc5668ba7bb011e1aa33e4a998d600c8c5ea68fa Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 26 Mar 2026 22:09:05 +0200 Subject: Add viinput skeleton for task 530ac084-c699-4dd6-8abc-d35c852c2226 --- internal/viinput/edit.go | 3 +++ internal/viinput/model.go | 28 ++++++++++++++++++++++++++++ internal/viinput/motion.go | 3 +++ 3 files changed, 34 insertions(+) create mode 100644 internal/viinput/edit.go create mode 100644 internal/viinput/model.go create mode 100644 internal/viinput/motion.go diff --git a/internal/viinput/edit.go b/internal/viinput/edit.go new file mode 100644 index 0000000..375c397 --- /dev/null +++ b/internal/viinput/edit.go @@ -0,0 +1,3 @@ +package viinput + +// Editing helpers will live here in a later task. diff --git a/internal/viinput/model.go b/internal/viinput/model.go new file mode 100644 index 0000000..78e00f3 --- /dev/null +++ b/internal/viinput/model.go @@ -0,0 +1,28 @@ +package viinput + +// Mode represents the current vi-style input state. +type Mode int + +const ( + // ModeInsert accepts normal text entry and cursor editing keys. + ModeInsert Mode = iota + // ModeNormal accepts vi-style commands. + ModeNormal +) + +// Model is the state container for the vi-style input component. +type Model struct { + Prompt string + runes []rune + cursor int + mode Mode + focused bool + pending rune + history [][]rune + wantsExit bool +} + +// New returns a Model initialized for insert mode. +func New() Model { + return Model{mode: ModeInsert} +} diff --git a/internal/viinput/motion.go b/internal/viinput/motion.go new file mode 100644 index 0000000..43c8279 --- /dev/null +++ b/internal/viinput/motion.go @@ -0,0 +1,3 @@ +package viinput + +// Motion helpers will live here in a later task. -- cgit v1.2.3