-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chinese can be entered in the first position of text_editor, but not in other positions #4430
Comments
Check if it works by applying egui Master Version. It is expected that there will be no problems with the Master Version, |
Thank you for your reply. I test the master branch examples/hello_world: I modify crates/egui/src/widgets/text_edit/builder.rs like this, and it works.
Then run this test, got the print below:
But I don't know why state.ime_cursor_range.secondary.ccursor.index is allway 0 |
Please check if the following Pull Request has a problem in Ubuntu. If not, check if there is a problem in Windows as well and let us know the results. |
I test #4436 in Ubuntu. In text_edit/builder.rs fn events() The First enter,get bellow ImeEvent: The Second enter,get bellow ImeEvent: The First enter, do not trigger ImeEvent::Enabled event. |
Again, |
Test in Windows it works good,In text_edit/builder.rs fn events()
The above tests used SougoPinyin(a popular IME in China). Then I use MicrosoftPinyin(Windows default chinese IME) Test,get bellow ImeEvent:
This result may be due to SougoPinyin not following the IME rules well? |
Still #4436? I run "git pull" and test again, has the same problem. |
Please print the crates/egui-winit/src/lib.rs |
Because it is difficult to apply to all languages, there are no exact rules. |
crates/egui-winit/src/lib.rs 331 line, I add print:
When app run, print: Every time, I enter "你好", print:
So total print information is:
|
This is the problem When app run, print: |
Please check if it is possible as follows.
OR
|
@rustbasic |
Is it okay to call Or is there anything I need to change in |
Yes, I change egui-winit/src/lib.rs, add call ime_event_disable() as follows:
You need to consider the specific solution. I'm just testing whether calling ime_event_disable() once when the program starts can solve the problem. |
Do not modify Let's work together to get it in a usable condition. |
@rustbasic |
Again, |
@rustbasic
|
I expect this to work, and we've been told it will work, so we hope this gets approved. |
* Completed. * Closes #4430 IME for chinese
Fix: Changed the handling method of `Ime::Preedit(_, None)` Fix: backspace fail after ime input * Related #4358 * Related #4430 * Related #4436 * Related #4794 * Related #4896 * Closes #4908 Issues: backspace fail after ime input * #4908 (Chinese) Changed the handling method of `Ime::Preedit(_, None)`
Fix: Changed the handling method of `Ime::Preedit(_, None)` Fix: backspace fail after ime input * Related emilk#4358 * Related emilk#4430 * Related emilk#4436 * Related emilk#4794 * Related emilk#4896 * Closes emilk#4908 Issues: backspace fail after ime input * emilk#4908 (Chinese) Changed the handling method of `Ime::Preedit(_, None)`
Fix: Changed the handling method of `Ime::Preedit(_, None)` Fix: backspace fail after ime input * Related emilk#4358 * Related emilk#4430 * Related emilk#4436 * Related emilk#4794 * Related emilk#4896 * Closes emilk#4908 Issues: backspace fail after ime input * emilk#4908 (Chinese) Changed the handling method of `Ime::Preedit(_, None)`
* Completed. * Closes emilk#4430 IME for chinese
Fix: Changed the handling method of `Ime::Preedit(_, None)` Fix: backspace fail after ime input * Related emilk#4358 * Related emilk#4430 * Related emilk#4436 * Related emilk#4794 * Related emilk#4896 * Closes emilk#4908 Issues: backspace fail after ime input * emilk#4908 (Chinese) Changed the handling method of `Ime::Preedit(_, None)`
Describe the bug
Chinese can be entered in the first position of text_editor, but not in other positions
To Reproduce
Steps to reproduce the behavior:
git clone eframe_template
setup custom fonts:
fn setup_custom_fonts(ctx: &egui::Context) {
// Start with the default fonts (we will be adding to them rather than replacing them).
let mut fonts = egui::FontDefinitions::default();
// Install my own font (maybe supporting non-latin characters).
// .ttf and .otf files supported.
fonts.font_data.insert(
"my_font".to_owned(),
egui::FontData::from_static(include_bytes!(
"msyh.ttc"
)),
);
// Put my font first (highest priority) for proportional text:
fonts
.families
.entry(egui::FontFamily::Proportional)
.or_default()
.insert(0, "my_font".to_owned());
// Put my font as last fallback for monospace:
fonts
.families
.entry(egui::FontFamily::Monospace)
.or_default()
.push("my_font".to_owned());
// Tell egui to use these fonts:
ctx.set_fonts(fonts);
}
cargo run
Expected behavior
check this scrennshorts,“你好” can be entered in the first position, but can not entered after "test"
Screenshots
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: