Include punctuation when double-clicking words to select them
Determines whether a character is a component of a word.
This is In general, it feels good to use.
This works well even when using UTF8 characters rather than English-speaking characters.
Before : This is a double clicked on a word.
After : This is a double clicked on a word.
This is not how mac works though - double-clicking a word does NOT include - or .
This is not how mac works though - double-clicking a word does NOT include
-or.
I can only test Windows.
This function is_word_char() works fine.
The problem on mac does not seem to be an issue with is_word_char().
( It looks like changes to 'is_word_char()' were not applied at compile time. Wouldn't the changed to 'is_word_char()' have been applied at compile time? )
If the new code matches the behavior of native windows, then check if ctx.os() == OperatingSystem::Windows
If the new code matches the behavior of native windows, then check if
ctx.os() == OperatingSystem::Windows
The is_word_char() function simply returns a bool value, so I think it's a good idea to keep it that way.
I think it would be better to fix the mac issue later.
Otherwise, please edit as you wish.
I want to match how text editing works natively on whatever platform egui runs on.
If double-clicking foo-bar selects both foo and bar on windows, then let's make it work like that, but only on Windows (because on Mac, words don't extend across hyphen on double-click).
I don't know how Windows works though.
I want to match how text editing works natively on whatever platform egui runs on.
If double-clicking
foo-barselects bothfooandbaron windows, then let's make it work like that, but only on Windows (because on Mac, words don't extend across hyphen on double-click).I don't know how Windows works though.
yes. In windows everything works fine.
Not only foo-bar, but also URL, e-mail, path, UTF8 characters (Korean), etc. all work well.
I think the reason it doesn't work on mac has nothing to do with this function.
I want to match how text editing works natively on whatever platform egui runs on. If double-clicking
foo-barselects bothfooandbaron windows, then let's make it work like that, but only on Windows (because on Mac, words don't extend across hyphen on double-click). I don't know how Windows works though.yes. In
windowseverything works fine. Not onlyfoo-bar, but also URL, e-mail, path, UTF8 characters (Korean), etc. all work well. I think the reason it doesn't work onmachas nothing to do with this function.
Which Windows app works like that? Here is Notepad:
https://github.com/emilk/egui/assets/43298013/2f897e66-33a2-4470-b5eb-2a52e42e5037
Which Windows app works like that? Here is Notepad:
This was a response to egui_demo_app that applied this commit.
I don't understand the nuances of English.
Which Windows app works like that? Here is Notepad:
This was a response to
egui_demo_appthat applied this commit. I don't understand the nuances of English.
What emilk is saying is that egui should work exactly like other programs in each operating system. So you should probably change:
if matches!(
c,
'_' | '-' | ':' | '/' | '.' | '\\' | '@' | '#' | '?' | '='
)
to
if matches!(c, '_')
What emilk is saying is that egui should work exactly like other programs in each operating system.
In Notepad on Windows 10, many things such as ., _, -, ;, (, ) are selected together when double-clicked.
And what is selected when double-clicking is unique to egui and does not need to be copied by other programs.