Clearing value scrambles up cursor
dkundel opened this issue · 2 comments
dkundel commented
Hi there! I'm currently building something with the TextInput
component and when I'm clearing the value the behavior becomes odd and I couldn't really figure out why.
Here's what I'm doing:
const { default: InkTextInput } = require('ink-text-input');
const Example = () => {
const [content, setContent] = useState('');
useInput((_, key) => {
if (key.return) {
setContent('');
}
});
return (
<Box>
<InkTextInput value={content} onChange={setContent} />
</Box>
);
};
The first time when I type content into it, it works great. Then when I hit return and it clears it it will first capture the first character and then prepend everything else. For example if I type in 1234
it will the first time write 1234
. The second time it will write 2341
.
ink
: 3.0.3
ink-text-input
: 4.0.0
vadimdemedes commented
Reproduced, going to take a look.
vadimdemedes commented
Fix is released in 4.0.1. Thanks for reporting!