Comments (20)
Check if it works by applying egui Master Version.
It is expected that there will be no problems with the Master Version, and it will be corrected in the next egui Version (0.27.3 ?) update.
Thank you for your reply.
I test the master branch examples/hello_world:
1. In my window 11, it works good !!
2. But I test in ubuntu, the problem has not been resolved.
I modify crates/egui/src/widgets/text_edit/builder.rs like this, and it works.
ImeEvent::Commit(prediction) => {
println!("ImeEvent::Commit( {}", prediction);
if prediction == "\n" || prediction == "\r" {
None
} else {
state.ime_enabled = false;
if !prediction.is_empty()
//&& cursor_range.secondary.ccursor.index
// == state.ime_cursor_range.secondary.ccursor.index
{
println!(
"cursor_range.secondary.ccursor.index:{}",
cursor_range.secondary.ccursor.index
);
println!(
"state.ime_cursor_range.secondary.ccursor.index:{}",
state.ime_cursor_range.secondary.ccursor.index
);
let mut ccursor = text.delete_selected(&cursor_range);
text.insert_text_at(&mut ccursor, prediction, char_limit);
Some(CCursorRange::one(ccursor))
} else {
let ccursor = cursor_range.primary.ccursor;
Some(CCursorRange::one(ccursor))
}
}
}
Then run this test, got the print below:
ImeEvent::Commit( **
cursor_range.secondary.ccursor.index:6
**state.ime_cursor_range.secondary.ccursor.index:0**
ImeEvent::Commit( 你好
cursor_range.secondary.ccursor.index:8
**state.ime_cursor_range.secondary.ccursor.index:0**
But I don't know why state.ime_cursor_range.secondary.ccursor.index is allway 0
from egui.
I test #4436 in Ubuntu.
The first time I entered "你好", it was not displayed in the text_edit box.
When I enter "你好" again, it's normal. Then every input is normal.
It looks like it's the first time that the control status is abnormal.
In text_edit/builder.rs fn events()
The First enter,get bellow ImeEvent:
ImeEvent::Commit: prediction=你好
ImeEvent::Disabled
The Second enter,get bellow ImeEvent:
ImeEvent::Enabled
ImeEvent::Commit: prediction=你好
ImeEvent::Disabled
The First enter, do not trigger ImeEvent::Enabled event.
from egui.
Test in Windows it works good,In text_edit/builder.rs fn events()
Every input get bellow ImeEvent:
ImeEvent::Enabled
ImeEvent::Enabled
ImeEvent::Commit prediction=你好
ImeEvent::Disabled
ImeEvent::Disabled
The above tests used SougoPinyin(a popular IME in China).
Then I use MicrosoftPinyin(Windows default chinese IME) Test,get bellow ImeEvent:
ImeEvent::Enabled
ImeEvent::Preedit text_mark=n
ImeEvent::Preedit text_mark=ni
ImeEvent::Preedit text_mark=ni'h
ImeEvent::Preedit text_mark=ni'ha
ImeEvent::Preedit text_mark=ni'hao
ImeEvent::Enabled
ImeEvent::Commit prediction=你好
ImeEvent::Disabled
ImeEvent::Disabled
This result may be due to SougoPinyin not following the IME rules well?
And In Ubuntu system, I test GooglePinyin again, it has the same problem like SougoPinyin.
from egui.
Again, 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.
Still #4436? I run "git pull" and test again, has the same problem.
from egui.
crates/egui-winit/src/lib.rs 331 line, I add print:
WindowEvent::Ime(ime) => {
println!("ime event is: {:?}", ime);
When app run, print:
ime event is: Enabled
Every time, I enter "你好", print:
ime event is: Preedit("", None)
ime event is: Commit("你好")
So total print information is:
ime event is: Enabled
ime event is: Preedit("", None)
ime event is: Commit("你好")
ime event is: Preedit("", None)
ime event is: Commit("你好")
ime event is: Preedit("", None)
ime event is: Commit("你好")
ime event is: Preedit("", None)
ime event is: Commit("你好")
ime event is: Preedit("", None)
ime event is: Commit("你好")
from egui.
This is the problem
When app run, print:
ime event is: Enabled
from egui.
@rustbasic
I call ime_event_disable() once time, and it works.
Here is my test code:
from egui.
Yes, I change egui-winit/src/lib.rs, add call ime_event_disable() as follows:
match ime {
winit::event::Ime::Enabled | winit::event::Ime::Preedit(_, None) => {
self.ime_event_enable();
}
winit::event::Ime::Preedit(text, Some(_cursor)) => {
self.ime_event_enable();
self.egui_input
.events
.push(egui::Event::Ime(egui::ImeEvent::Preedit(text.clone())));
}
winit::event::Ime::Commit(text) => {
self.egui_input
.events
.push(egui::Event::Ime(egui::ImeEvent::Commit(text.clone())));
self.ime_event_disable();
}
winit::event::Ime::Disabled => {
self.ime_event_disable();
}
};
///////////////////////////////////////////////////////////////
//following is my test code:
static DISABLE_IME_ENABLE_AT_START: OnceLock<i32> = OnceLock::new();
DISABLE_IME_ENABLE_AT_START.get_or_init(|| {
self.ime_event_disable();
println!("ime_event_disable");
return 0;
});
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.
from egui.
@rustbasic
Sorry, I have just been using egui for a few days and I am still not familiar with it. So I don't understand how to call ime_event_disable() in my program.
Is something can do in raw_input_hook() function ?
from egui.
Again,
Please check if the following Pull Request has a problem in Ubuntu and Windows.
Please test various IMEs.
let us know the results.
from egui.
@rustbasic
I tested the following scenarios and all of them worked properly !
- Windows + MicrosoftPinyin
- Windows + SougouPinyin
- Ubuntu + SougouPinyin
- Ubuntu + GooglePinyin
from egui.
Check if it works by applying egui Master Version.
It is expected that there will be no problems with the Master Version,
and it will be corrected in the next egui Version (0.27.3 ?) update.
from egui.
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.
from egui.
Again,
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.
from egui.
Please print the winit::event::Ime::
event details at the following location and let us know.
I'll check tomorrow.
crates/egui-winit/src/lib.rs
330 line
WindowEvent::Ime(ime) => {
from egui.
Because it is difficult to apply to all languages, there are no exact rules.
However, it is true that SougoPinyin
has a unique behavior.
from egui.
Please check if it is possible as follows.
let me know result, please.
-
Apply new #4436.
-
Find a way to prevent
winit::event::Ime::Enabled
from occurring when the program starts.
OR
- Call
ime_event_disable()
inegui-winit/src/lib.rs
only once when the program starts.
(Alternatively, it is expected to operate normally even if you callime_event_disable()
every time before inputting.)
from egui.
Is it okay to call ime_event_disable()
from your program without changing egui-winit/src/lib.rs
?
Or is there anything I need to change in egui-winit/src/lib.rs
to use ime_event_disable()
?
from egui.
Do not modify egui-winit/src/lib.rs
,
Make sure your program can call ime_event_disable()
.
Let's work together to get it in a usable condition.
Ultimately, approval from 'emilk' is required.
from egui.
I expect this to work, and we've been told it will work, so we hope this gets approved.
from egui.
Related Issues (20)
- Phantom key presses when focusing an egui/winit window HOT 3
- Configurable plot cursor "snap" radius HOT 1
- TableBuilder / available_width() HOT 1
- Smooth zooming
- High CPU usage when accesskit enabled HOT 11
- Crashing on startup HOT 4
- Zoom out the plot with right mouse drag
- Store a Ui/Frame-stack
- Sizing-pass flag
- Wayland dependencies are pulled in for eframe, even when `wayland` feature is disabled. HOT 1
- egui_plot legend: add shortcut to hide all series but this one
- Grid layout for windows HOT 3
- Input not focused when selecting text
- Tooltips jitter when first shown
- On iOS safari, clicking a text field won't always bring up the on-screen keyboard
- Focus tracking for input on web is janky
- Text field is covered by keyboard on mobile web
- Mobile keyboard should not behave like IME
- windows系统中使用自定义窗口实现拖动效果但是右键后无法再次拖动 HOT 1
- Skip `tooltip_delay` if a tooltip was recently open.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from egui.