Skip to content

Commit 5f7ea83

Browse files
committed
Merge pull request #102556 from kitbdev/fix-te-cursor-shape-held
Fix TextEdit cusor shape when mouse is held
2 parents 449c84f + 65b7e1c commit 5f7ea83

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

scene/gui/code_edit.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,10 @@ Control::CursorShape CodeEdit::get_cursor_shape(const Point2 &p_pos) const {
660660
return CURSOR_POINTING_HAND;
661661
}
662662

663+
if (is_dragging_cursor()) {
664+
return TextEdit::get_cursor_shape(p_pos);
665+
}
666+
663667
if ((code_completion_active && code_completion_rect.has_point(p_pos)) || (!is_editable() && (!is_selecting_enabled() || get_line_count() == 0))) {
664668
return CURSOR_ARROW;
665669
}

scene/gui/text_edit.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1674,6 +1674,7 @@ void TextEdit::_notification(int p_what) {
16741674
selection_drag_attempt = false;
16751675
drag_action = false;
16761676
drag_caret_force_displayed = false;
1677+
dragging_selection = false;
16771678
} break;
16781679

16791680
case NOTIFICATION_MOUSE_EXIT_SELF: {
@@ -3112,6 +3113,14 @@ void TextEdit::drop_data(const Point2 &p_point, const Variant &p_data) {
31123113
}
31133114

31143115
Control::CursorShape TextEdit::get_cursor_shape(const Point2 &p_pos) const {
3116+
if (dragging_selection) {
3117+
return get_default_cursor_shape();
3118+
}
3119+
3120+
if (dragging_minimap) {
3121+
return CURSOR_ARROW;
3122+
}
3123+
31153124
Vector2i current_hovered_gutter = _get_hovered_gutter(p_pos);
31163125
if (current_hovered_gutter != Vector2i(-1, -1)) {
31173126
if (gutters[current_hovered_gutter.x].clickable || is_line_gutter_clickable(current_hovered_gutter.y, current_hovered_gutter.x)) {

0 commit comments

Comments
 (0)