MCPcopy Create free account
hub / github.com/Effect-TS/effect / processTextBackspace

Function processTextBackspace

packages/effect/src/unstable/cli/Prompt.ts:3584–3597  ·  view source on GitHub ↗
(state: TextState)

Source from the content-addressed store, hash-verified

3582})
3583
3584const processTextBackspace = (state: TextState) => {
3585 if (state.cursor <= 0) {
3586 return Effect.succeed(Action.Beep())
3587 }
3588 const beforeCursor = state.value.slice(0, state.cursor - 1)
3589 const afterCursor = state.value.slice(state.cursor)
3590 const cursor = state.cursor - 1
3591 const value = `${beforeCursor}${afterCursor}`
3592 return Effect.succeed(
3593 Action.NextFrame({
3594 state: { ...state, cursor, value, error: Option.none() }
3595 })
3596 )
3597}
3598
3599const processTextClear = (state: TextState) =>
3600 Effect.succeed(

Callers 1

handleTextProcessFunction · 0.85

Calls 1

succeedMethod · 0.45

Tested by

no test coverage detected