Skip to content
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

keep input after switch input schema #917

Open
Freed-Wu opened this issue Jul 17, 2024 · 8 comments
Open

keep input after switch input schema #917

Freed-Wu opened this issue Jul 17, 2024 · 8 comments

Comments

@Freed-Wu
Copy link
Contributor

Describe the solution you'd like
For example:

Input ni:
Screenshot from 2024-07-17 22-59-38

Now press a hotkey to switch input schema from Microsoft pinyin to japanese

Actual Behaviour:

Current context and ime is cleared.

Screenshot from 2024-07-17 22-59-49

Expected behaviour:

Keep original input

Screenshot from 2024-07-17 23-00-02

@scorpjke
Copy link

You can write a lua script to remember the current input. By the way, how do you switch between languages with a hotkey? How do you assign a hotkey?

@Freed-Wu
Copy link
Contributor Author

switch between languages with a hotkey? How do you assign a hotkey?

patch:
  key_binder/bindings/@before 6:
    accept: Control+backslash
    select: .next
    when: always

@Freed-Wu
Copy link
Contributor Author

write a lua

Perhaps it can be a builtin feature?

@ksqsf
Copy link
Member

ksqsf commented Jul 22, 2024

Surely it can. The problem here is how to expose it as an option. I do not have good ideas though.

@lotem
Copy link
Member

lotem commented Jul 23, 2024

有點兒意思。如果是 ascii 串串,應該不難。
怕的是類似宮保拼音加了特殊字符、tag 什麼的,別的輸入方案不認識。

@lotem
Copy link
Member

lotem commented Jul 23, 2024

如果已經半選,選過的字怎麼辦?
保持轉換結果是不可能的,候選詞背後的內存映射文件應該都不在了。
而且換了輸入方案,保存用戶詞的時候language對不上。
按 BackSpace 撤銷選詞更是崩潰。

@Freed-Wu
Copy link
Contributor Author

For nihao, select to get 你hao, then press BackSpace can get nihao again. if we switch input schema, perhaps we can use nihao as input, not 你hao?

保存用戶詞的時候language對不上

Do you mean user dictionary? Can we skip it?

@ksqsf
Copy link
Member

ksqsf commented Jul 23, 2024

如果是 ascii 串串,應該不難。

我覺得應該就是這個意思吧。

modified   src/rime/engine.cc
@@ -285,12 +285,14 @@ void ConcreteEngine::ApplySchema(Schema* schema) {
   if (!schema)
     return;
   schema_.reset(schema);
+  string input = context_->input();
   context_->Clear();
   context_->ClearTransientOptions();
   InitializeComponents();
   InitializeOptions();
   switcher_->SetActiveSchema(schema_->schema_id());
   message_sink_("schema", schema_->schema_id() + "/" + schema_->schema_name());
+  context_->set_input(input);
 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants