IME · the candidate box clamps to the last layout: asked before the next one, it found nothing and macOS put it in the screen's corner (#7)
This commit is contained in:
1 parent
33df23c02a
commit
152d881f4f
3 files changed
+26
-11
No files matched your search
@@ -1,4 +1,4 @@
|
||||
use gpui::{AppContext, Context, IntoElement, Render, TestAppContext, Window};
|
||||
use gpui::{AppContext, Context, EntityInputHandler, IntoElement, Render, TestAppContext, Window};
|
||||
|
||||
use super::setup;
|
||||
use crate::forms::{TextInput, UnitInput};
|
||||
@@ -45,3 +45,24 @@ fn a_unit_gone_from_its_list_keeps_the_field(cx: &mut TestAppContext) {
|
||||
cx.run_until_parked();
|
||||
assert!(cx.debug_bounds("number-root").is_some());
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
fn an_ime_finds_its_composition_before_the_next_layout(cx: &mut TestAppContext) {
|
||||
let (fields, cx) = super::open(1, false, cx);
|
||||
let field = fields[0].clone();
|
||||
super::focus(&field, cx);
|
||||
field.update(cx, |input, cx| input.set_text("abc", cx));
|
||||
cx.run_until_parked();
|
||||
let laid = field
|
||||
.read_with(cx, |input, _| input.bounds_for(3))
|
||||
.expect("laid out");
|
||||
let asked = cx.update(|window, cx| {
|
||||
field.update(cx, |input, cx| {
|
||||
input.replace_and_mark_text_in_range(None, "n", None, window, cx);
|
||||
let at = gpui::Bounds::new(laid.origin, gpui::size(gpui::px(200.), laid.size.height));
|
||||
input.bounds_for_range(3..4, at, window, cx)
|
||||
})
|
||||
});
|
||||
let asked = asked.expect("the candidate box has a place");
|
||||
assert_eq!(asked.origin, laid.origin, "at the caret, on its line");
|
||||
}
|
||||
Reference in new issue
Block a user