mirror of
https://github.com/godotengine/godot.git
synced 2025-01-20 08:51:16 +00:00
Fix LineEdit selected text drag and drop behavior: move instead of duplicate selected text; maintain selection after drag and drop.
This commit is contained in:
parent
1024692041
commit
8090a4ebb1
@ -323,9 +323,12 @@ bool LineEdit::can_drop_data(const Point2& p_point,const Variant& p_data) const{
|
|||||||
void LineEdit::drop_data(const Point2& p_point,const Variant& p_data){
|
void LineEdit::drop_data(const Point2& p_point,const Variant& p_data){
|
||||||
|
|
||||||
if (p_data.get_type()==Variant::STRING) {
|
if (p_data.get_type()==Variant::STRING) {
|
||||||
|
|
||||||
set_cursor_at_pixel_pos(p_point.x);
|
set_cursor_at_pixel_pos(p_point.x);
|
||||||
|
int selected = selection.end - selection.begin;
|
||||||
|
text.erase(selection.begin, selected);
|
||||||
append_at_cursor(p_data);
|
append_at_cursor(p_data);
|
||||||
|
selection.begin = cursor_pos-selected;
|
||||||
|
selection.end = cursor_pos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user