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

Use Space key in simple table input method #84

Open
githubforced2fabad opened this issue Nov 23, 2024 · 7 comments
Open

Use Space key in simple table input method #84

githubforced2fabad opened this issue Nov 23, 2024 · 7 comments

Comments

@githubforced2fabad
Copy link

Summary

How can I use space key in the left side of the a simple table input method. I imagine it needs to be in KeyCode somehow and also in the table itself. Is there some escape sequence for space since it is used as the table column separator?

@wengxt wengxt transferred this issue from fcitx/fcitx5 Nov 23, 2024
@wengxt
Copy link
Member

wengxt commented Nov 23, 2024

I don't think there's currently a way to allow this in the text file format, though binary data format wise, it is allowed.

Right now, if you create a table with a line (Do not put space in the end otherwise it will be trimmed), key code will be containing space.

KeyCode=a bcd

Then, if you just use code to insert data one by one, then you should be able to get a table with space in the key.

On adding support to the libime_tabledict, it's a little bit tricky introduce this with compatibility on existing files. How can we support this since every line is pre-trimmed for any white space character. since we allow quotation mark " to be valid key code.

Maybe, we can change the code to avoid consume white space character in the KeyCode.

@githubforced2fabad
Copy link
Author

githubforced2fabad commented Nov 24, 2024

I am currently using libime_tabledict, and I am not sure how to edit the binary directly; I think that something I do not want to do anyway.

Perhaps one way to get around this is to add an Escape which would work similar to Prompt. The creator of the table can choose the Escape character to not conflict with the other input chars. Whatever comes right after the escape char will be in its place.

A silly example

Escape=@
Prompt="
[Data]
"@  _
@  _
@" ❞
@@ ﹫

Another option which might be easier is just add some special Space option.

Space=@
[Data]
"@ _
@ _

@githubforced2fabad
Copy link
Author

I tried to do the Space= way on my fork. It compiles and prints that it is doing the replacement, but when I try it out, space still just inserts a space.

my fork: https://git.sr.ht/~charje/libime.

@wengxt
Copy link
Member

wengxt commented Nov 29, 2024

@githubforced2fabad adding a new field would require you to serialize a new field to binary

@githubforced2fabad
Copy link
Author

By new field, do you mean Space=? It would only be used in parsing. Does that still need to be saved to the binary table?

@wengxt
Copy link
Member

wengxt commented Nov 29, 2024

Because libime_tabledict -d should still produce a usable text format dict.

Without that, it is possible you're printing out a dict that can not be converted back.

@githubforced2fabad
Copy link
Author

githubforced2fabad commented Nov 30, 2024

Okay. I tried to add the serialization for both text and binary as well as parsing binary. I am getting this error in test #1 though: "file has phrase section but no rule". It seems to not be related to anything I did. I was getting this error before I added my test part. It must have something to do with the way I am serializing or de-serializing, but I can't figure it out. My latest code is pushed to my branch.

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

No branches or pull requests

2 participants