Open de4db1ff opened 4 months ago
I've just confirmed that this is not a bug on the iamb side. It’s actually a bug in ratatui.
Sorry for the confusion. I've just confirmed that it’s actually a bug on the iamb side. I was able to create a small PoC and patch for it.
Diff: (40d92a2
)
@@ -28,7 +28,7 @@ impl State {
}
fn cursor(&self) -> u16 {
- self.idx_chars as u16
+ self.input[..self.idx_bytes()].width_cjk() as u16
}
}
Before:
After:
@ulyssa I’m willing to fix this issue on my own, but I’m not familiar with the iamb codebase. Could you give me a rough hint on where I should start?
Thanks for the guide :) Fixed it
The cursor does not align correctly with user input when typing certain Unicode characters, such as Chinese characters or emojis. This issue appears to be caused by the presence of certain Unicode characters in the buffer, which results in get_term_cursor() returning an incorrect value.