Can't exactly pin down the fix, but here's a test program that demonstrates it:
import { useState } from 'react'
import ReactCurse, { Text, useInput } from 'react-curse'
const App = () => {
const [counter, setCounter] = useState(0)
useInput(
input => {
if (input === 'q') ReactCurse.exit()
else setCounter(counter + 1)
},
[counter]
)
return <Text>
<Text block>{counter % 3 === 0 ? "x " : ""}test 1</Text>
<Text block>{counter % 3 === 1 ? "x " : ""}test 2</Text>
<Text block>{counter % 3 === 2 ? "x " : ""}test 3</Text>
</Text>
}
ReactCurse.render(<App />)
and I found that it can be worked around by changing
|
const diffLine = full |
|
? line |
|
: line |
|
.map((i: Char, x: number) => { |
|
const [prevChar, prevModifier] = prevLine && prevLine[x] ? prevLine[x] : [' ', {}] |
|
const [char, modifier] = i |
|
return prevChar !== char || JSON.stringify(prevModifier) !== JSON.stringify(modifier) ? i : null |
|
}) |
|
.filter(i => i !== undefined) |
to just:
so it's something about how diffLine is being used when it's null
Can't exactly pin down the fix, but here's a test program that demonstrates it:
and I found that it can be worked around by changing
react-curse/term.ts
Lines 197 to 205 in f4dc11e
to just:
so it's something about how
diffLineis being used when it'snull