-
Notifications
You must be signed in to change notification settings - Fork 121
added functionality for delete_word_left, delete_word_right and move_left/right_by_word for text_input #1
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
Conversation
…left/right_by_word for text_input
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thanks for sending in your PR! You chose a good piece of work to do.
Unfortunately there are some issues - you could either fix them yourself or if you want I could fix them - just let me know.
Text input was designed originally in a way that cursor.pos and cursor.sel represent character offsets (not byte offsets like in the main editor). Your changes now treat them as byte offsets, which is good, but the drawing code isn't aware of this yet.
You can try this utf-8 string to trigger a crash: "водка_vodka борис_ельцин".
Thanks!
Hi, that explains a lot 😅 |
I think byte offsets is the way to go. I haven't touched that code in a long time, but I think there may be a couple of auxiliary functions for dealing with char offsets in the drawing code - feel free to remove them if they are no longer used elsewhere. Thanks for your work! 💪 |
I think I fixed all the issues with multi byte characters. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks much better now! That temporary limit of 5000 has been bothering me and now we can get rid of it.
I think the only thing left to do it the text_input_type_char
function, which still uses char offsets and causes crashes when you type non-ascii chars.
Would you be able to make that change? And delete the decode_utf8_string_to_temp_chars
and get_char_offset
while you're at it?
} | ||
|
||
select_word :: (using input: *Text_Input) { | ||
// Decode the characters on the line for scanning | ||
chars := decode_utf8_string_to_temp_chars(to_string(text), max_char = 5000); // arbitrary number |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So glad to see it gone - this function can finally retire.
… removing characters when the text contains multi byte characters
Fixed the issue with typing non-ascii characters. |
Well done, thank you very much! 💪 I noticed that the alt-delete shortcuts don't yet work, perhaps we should also add them later |
Now checks command-line args for directories to add to workspace_dirs array
Properly merge keymaps
No description provided.