Repository: godotengine/godot (language: cpp)

Issue:
When using Right-to-Left in Editor, the SceneTree Item's rename LineEdit's position is offset
### Tested versions

v4.4-stable_mono_win64
v4.5 dev

### System information

Windows 11 Intel(R) Core(TM) i7-11800H NVIDIA RTX3050

### Issue description

When using Right-to-Left in Editor, the SceneTree Item's rename LineEdit's position is offset.

![Image](https://github.com/user-attachments/assets/55b3597b-42b9-4c48-8078-eaa611b4e3b2)

### Steps to reproduce

1. Create a new project.
2. Add multi-level child items to the SceneTree.
3. Rename the item.

### Minimal reproduction project (MRP)

N/A


Discussion / hints:

Fix patch:
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 45984dc89a20..77498faed2f4 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -4107,13 +4107,18 @@ bool Tree::edit_selected(bool p_force_edit) {
 		// "floor()" centers vertically.
 		Vector2 ofs(0, Math::floor((MAX(line_editor->get_minimum_size().height, rect.size.height - value_editor_height) - rect.size.height) / 2));
 
-		popup_rect.position = get_screen_position() + rect.position - ofs;
-		popup_rect.size = rect.size;
-
 		// Account for icon.
 		Size2 icon_size = _get_cell_icon_size(c) * popup_scale;
-		popup_rect.position.x += icon_size.x;
-		popup_rect.size.x -= icon_size.x;
+
+		popup_rect.size = rect.size;
+		popup_rect.size.x -= icon_size.x + theme_cache.h_separation;
+
+		popup_rect.position = rect.position - ofs;
+		popup_rect.position.x += icon_size.x + theme_cache.h_separation;
+		if (cache.rtl) {
+			popup_rect.position.x = get_size().width - popup_rect.position.x - popup_rect.size.x;
+		}
+		popup_rect.position += get_screen_position();
 
 		line_editor->clear();
 		line_editor->set_text(c.mode == TreeItem::CELL_MODE_STRING ? c.text : String::num(c.val, Math::range_step_decimals(c.step)));


Test patch: