MCPcopy
hub / github.com/docker/docker-agent / editor

Struct editor

pkg/tui/components/editor/editor.go:114–163  ·  view source on GitHub ↗

editor implements [Editor]

Source from the content-addressed store, hash-verified

112
113// editor implements [Editor]
114type editor struct {
115 textarea textarea.Model
116 hist *history.History
117 width int
118 height int
119 working bool
120 // completions are the available completions
121 completions []completions.Completion
122
123 // completionWord stores the word being completed
124 completionWord string
125 currentCompletion completions.Completion
126
127 suggestion string
128 hasSuggestion bool
129 // userTyped tracks whether the user has manually typed content (vs loaded from history)
130 userTyped bool
131 // keyboardEnhancementsSupported tracks whether the terminal supports keyboard enhancements
132 keyboardEnhancementsSupported bool
133 // pendingFileRef tracks the current @word being typed (for manual file ref detection).
134 // Only set when cursor is in a word starting with @, cleared when cursor leaves.
135 pendingFileRef string
136 // banner renders pending attachments so the user can see what's queued.
137 banner *attachmentBanner
138 // attachments tracks all file attachments (pastes and file refs).
139 attachments []attachment
140 // pasteCounter tracks the next paste number for display purposes.
141 pasteCounter int
142 // recording tracks whether the editor is in recording mode (speech-to-text)
143 recording bool
144 // placeholder is the configured empty-editor placeholder, restored when
145 // transient placeholders (e.g. recording mode) end.
146 placeholder string
147 // recordingDotPhase tracks the animation phase for the recording dots cursor
148 recordingDotPhase int
149
150 // fileLoadID is incremented each time we start a new file load to ignore stale results
151 fileLoadID uint64
152 // fileLoadStarted tracks whether we've started initial loading for the current completion
153 fileLoadStarted bool
154 // fileFullLoadStarted tracks whether we've started full file loading (triggered by typing)
155 fileFullLoadStarted bool
156 // fileLoadCancel cancels any in-progress file loading
157 fileLoadCancel context.CancelFunc
158
159 // historySearch holds state for history search mode
160 historySearch historySearchState
161 // searchInput is the input field for history search queries
162 searchInput textinput.Model
163}
164
165// Option configures the Editor.
166type Option func(*editor)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected