Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TextEdit cusor shape when mouse is held #102556

Merged
merged 1 commit into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions scene/gui/code_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,10 @@ Control::CursorShape CodeEdit::get_cursor_shape(const Point2 &p_pos) const {
return CURSOR_POINTING_HAND;
}

if (is_dragging_cursor()) {
return TextEdit::get_cursor_shape(p_pos);
}

if ((code_completion_active && code_completion_rect.has_point(p_pos)) || (!is_editable() && (!is_selecting_enabled() || get_line_count() == 0))) {
return CURSOR_ARROW;
}
Expand Down
9 changes: 9 additions & 0 deletions scene/gui/text_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1674,6 +1674,7 @@ void TextEdit::_notification(int p_what) {
selection_drag_attempt = false;
drag_action = false;
drag_caret_force_displayed = false;
dragging_selection = false;
} break;

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

Control::CursorShape TextEdit::get_cursor_shape(const Point2 &p_pos) const {
if (dragging_selection) {
return get_default_cursor_shape();
}

if (dragging_minimap) {
return CURSOR_ARROW;
}

Vector2i current_hovered_gutter = _get_hovered_gutter(p_pos);
if (current_hovered_gutter != Vector2i(-1, -1)) {
if (gutters[current_hovered_gutter.x].clickable || is_line_gutter_clickable(current_hovered_gutter.y, current_hovered_gutter.x)) {
Expand Down