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

Function processTextBackspace

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

Source from the content-addressed store, hash-verified

3846})
3847
3848const processTextBackspace = (state: TextState) => {
3849 if (state.cursor <= 0) {
3850 return Effect.succeed(Action.Beep())
3851 }
3852 const beforeCursor = state.value.slice(0, state.cursor - 1)
3853 const afterCursor = state.value.slice(state.cursor)
3854 const cursor = state.cursor - 1
3855 const value = `${beforeCursor}${afterCursor}`
3856 return Effect.succeed(
3857 Action.NextFrame({
3858 state: { ...state, cursor, value, error: Option.none() }
3859 })
3860 )
3861}
3862
3863const processTextClear = (state: TextState) =>
3864 Effect.succeed(

Callers 1

handleTextProcessFunction · 0.85

Calls 2

sliceMethod · 0.80
succeedMethod · 0.45

Tested by

no test coverage detected