summaryrefslogtreecommitdiffstats
path: root/scene/gui/text_edit.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-01-19 19:33:18 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-01-19 19:33:18 +0100
commit65883cc73b0bedb14760e97f59a2c58b83b2470c (patch)
tree2656e3735f4a1f33ddb8b8b6a18528946b5a5a55 /scene/gui/text_edit.cpp
parentab5c75b9ad9134cfca3952203042a9b5d87851b2 (diff)
parent5361ec9f43e454d0869c3ce0984fda34a95472a1 (diff)
downloadredot-engine-65883cc73b0bedb14760e97f59a2c58b83b2470c.tar.gz
Merge pull request #71598 from bruvzg/gdscript_bidi_override
Implement BiDi override mode for GDScript source.
Diffstat (limited to 'scene/gui/text_edit.cpp')
-rw-r--r--scene/gui/text_edit.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 108a533a74..8ffaa9e81f 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -1208,7 +1208,15 @@ void TextEdit::_notification(int p_what) {
char_ofs = 0;
}
for (int j = 0; j < gl_size; j++) {
- const Variant *color_data = color_map.getptr(glyphs[j].start);
+ int64_t color_start = -1;
+ for (const Variant *key = color_map.next(nullptr); key; key = color_map.next(key)) {
+ if (int64_t(*key) <= glyphs[j].start) {
+ color_start = *key;
+ } else {
+ break;
+ }
+ }
+ const Variant *color_data = (color_start >= 0) ? color_map.getptr(color_start) : nullptr;
if (color_data != nullptr) {
current_color = (color_data->operator Dictionary()).get("color", font_color);
if (!editable && current_color.a > font_readonly_color.a) {