egui icon indicating copy to clipboard operation
egui copied to clipboard

Include punctuation when double-clicking words to select them

Open rustbasic opened this issue 1 year ago • 10 comments

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.

20240414-1

After : This is a double clicked on a word.

20240414-3

rustbasic avatar Apr 14 '24 04:04 rustbasic

This is not how mac works though - double-clicking a word does NOT include - or .

Screenshot 2024-05-11 at 00 39 52 Screenshot 2024-05-11 at 00 39 48

emilk avatar May 10 '24 22:05 emilk

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? )

rustbasic avatar May 11 '24 01:05 rustbasic

If the new code matches the behavior of native windows, then check if ctx.os() == OperatingSystem::Windows

emilk avatar May 11 '24 11:05 emilk

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.

rustbasic avatar May 11 '24 13:05 rustbasic

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.

emilk avatar May 11 '24 14:05 emilk

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.

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.

rustbasic avatar May 11 '24 15:05 rustbasic

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.

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.

Which Windows app works like that? Here is Notepad:

https://github.com/emilk/egui/assets/43298013/2f897e66-33a2-4470-b5eb-2a52e42e5037

YgorSouza avatar May 11 '24 16:05 YgorSouza

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.

rustbasic avatar May 11 '24 16:05 rustbasic

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.

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, '_')

YgorSouza avatar May 11 '24 16:05 YgorSouza

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.

rustbasic avatar May 12 '24 03:05 rustbasic