diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-10-07 09:15:14 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-10-07 09:15:14 +0200 |
commit | aa20941e68a3d6399d6f740a5d5feaf5f04dc71a (patch) | |
tree | d33a1353d10a78ed6cf438ec6041a9ae58707de6 /scene/gui/line_edit.cpp | |
parent | 29f017378e37026b96b5ff552a180aebee18087e (diff) | |
parent | a750ca7ec113859d03d46189e554dc5ff8dd7411 (diff) |
Merge pull request #67016 from bruvzg/split_caret_dir_marker
Add split caret direction markers. Fix block/overtype caret size.
Diffstat (limited to 'scene/gui/line_edit.cpp')
-rw-r--r-- | scene/gui/line_edit.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index be94337c89..eb34559a14 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -971,7 +971,18 @@ void LineEdit::_notification(int p_what) { } else { if (caret.l_caret != Rect2() && caret.l_dir == TextServer::DIRECTION_AUTO) { // Draw extra marker on top of mid caret. - Rect2 trect = Rect2(caret.l_caret.position.x - 3 * caret_width, caret.l_caret.position.y, 6 * caret_width, caret_width); + Rect2 trect = Rect2(caret.l_caret.position.x - 2.5 * caret_width, caret.l_caret.position.y, 6 * caret_width, caret_width); + trect.position += ofs; + RenderingServer::get_singleton()->canvas_item_add_rect(ci, trect, caret_color); + } else if (caret.l_caret != Rect2() && caret.t_caret != Rect2() && caret.l_dir != caret.t_dir) { + // Draw extra direction marker on top of split caret. + float d = (caret.l_dir == TextServer::DIRECTION_LTR) ? 0.5 : -3; + Rect2 trect = Rect2(caret.l_caret.position.x + d * caret_width, caret.l_caret.position.y + caret.l_caret.size.y - caret_width, 3 * caret_width, caret_width); + trect.position += ofs; + RenderingServer::get_singleton()->canvas_item_add_rect(ci, trect, caret_color); + + d = (caret.t_dir == TextServer::DIRECTION_LTR) ? 0.5 : -3; + trect = Rect2(caret.t_caret.position.x + d * caret_width, caret.t_caret.position.y, 3 * caret_width, caret_width); trect.position += ofs; RenderingServer::get_singleton()->canvas_item_add_rect(ci, trect, caret_color); } |