diff options
author | Leonardo Christino <leomilho@gmail.com> | 2021-04-03 12:17:51 -0300 |
---|---|---|
committer | Leonardo Christino <leomilho@gmail.com> | 2021-07-13 10:03:26 -0300 |
commit | 8b91828e4ff73fb3783b5fefcf9d150ce242907f (patch) | |
tree | a30843231851d637de9c5247b3d2e4c33e10ea9a /modules/text_server_adv | |
parent | 9e0e74e58e84374050a35ad33f60855bab6e9bdd (diff) |
Separate underscore from grapheme punctuation to enable doubleclick and caret jump over snakecase variables in editor
Diffstat (limited to 'modules/text_server_adv')
-rw-r--r-- | modules/text_server_adv/text_server_adv.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp index 72c5ccc699..2513039e8e 100644 --- a/modules/text_server_adv/text_server_adv.cpp +++ b/modules/text_server_adv/text_server_adv.cpp @@ -129,6 +129,10 @@ _FORCE_INLINE_ bool is_linebreak(char32_t p_char) { return (p_char >= 0x000a && p_char <= 0x000d) || (p_char == 0x0085) || (p_char == 0x2028) || (p_char == 0x2029); } +_FORCE_INLINE_ bool is_underscore(char32_t p_char) { + return (p_char == 0x005F); +} + /*************************************************************************/ String TextServerAdvanced::interface_name = "ICU / HarfBuzz / Graphite"; @@ -1883,7 +1887,10 @@ bool TextServerAdvanced::shaped_text_update_breaks(RID p_shaped) { if (is_whitespace(c)) { sd_glyphs[i].flags |= GRAPHEME_IS_SPACE; } - if (u_ispunct(c)) { + if (is_underscore(c)) { + sd_glyphs[i].flags |= GRAPHEME_IS_UNDERSCORE; + } + if (u_ispunct(c) && c != 0x005F) { sd_glyphs[i].flags |= GRAPHEME_IS_PUNCTUATION; } if (breaks.has(sd->glyphs[i].start)) { |