MCPcopy Index your code
hub / github.com/Effect-TS/effect / processBackspace

Function processBackspace

packages/cli/src/internal/prompt/text.ts:179–192  ·  view source on GitHub ↗
(state: State)

Source from the content-addressed store, hash-verified

177}
178
179function processBackspace(state: State) {
180 if (state.cursor <= 0) {
181 return Effect.succeed(Action.Beep())
182 }
183 const beforeCursor = state.value.slice(0, state.cursor - 1)
184 const afterCursor = state.value.slice(state.cursor)
185 const cursor = state.cursor - 1
186 const value = `${beforeCursor}${afterCursor}`
187 return Effect.succeed(
188 Action.NextFrame({
189 state: { ...state, cursor, value, error: Option.none() }
190 })
191 )
192}
193
194function processCursorLeft(state: State) {
195 if (state.cursor <= 0) {

Callers 1

handleProcessFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected