(
cursor: Cursor,
isReplay: boolean = false,
)
| 80 | }, [onModeChange, textInput, props.value]) |
| 81 | |
| 82 | function createOperatorContext( |
| 83 | cursor: Cursor, |
| 84 | isReplay: boolean = false, |
| 85 | ): OperatorContext { |
| 86 | return { |
| 87 | cursor, |
| 88 | text: props.value, |
| 89 | setText: (newText: string) => props.onChange(newText), |
| 90 | setOffset: (offset: number) => textInput.setOffset(offset), |
| 91 | enterInsert: (offset: number) => switchToInsertMode(offset), |
| 92 | getRegister: () => persistentRef.current.register, |
| 93 | setRegister: (content: string, linewise: boolean) => { |
| 94 | persistentRef.current.register = content |
| 95 | persistentRef.current.registerIsLinewise = linewise |
| 96 | }, |
| 97 | getLastFind: () => persistentRef.current.lastFind, |
| 98 | setLastFind: (type, char) => { |
| 99 | persistentRef.current.lastFind = { type, char } |
| 100 | }, |
| 101 | recordChange: isReplay |
| 102 | ? () => {} |
| 103 | : (change: RecordedChange) => { |
| 104 | persistentRef.current.lastChange = change |
| 105 | }, |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | function replayLastChange(): void { |
| 110 | const change = persistentRef.current.lastChange |
no outgoing calls
no test coverage detected