summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarynate <mary.w.nate@gmail.com>2014-05-11 12:14:33 +0800
committermarynate <mary.w.nate@gmail.com>2014-05-11 12:16:08 +0800
commit8090a4ebb1c1c7a970f57b46d1df526bf12c2c37 (patch)
tree52a4bb13c7f0855e3dcdcc4d28324023d25b5895
parent10246920418110ccb006d538490e098b1ec2a413 (diff)
Fix LineEdit selected text drag and drop behavior: move instead of duplicate selected text; maintain selection after drag and drop.
-rw-r--r--scene/gui/line_edit.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 6c9db7484b..e822cfef13 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -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){
if (p_data.get_type()==Variant::STRING) {
-
set_cursor_at_pixel_pos(p_point.x);
+ int selected = selection.end - selection.begin;
+ text.erase(selection.begin, selected);
append_at_cursor(p_data);
+ selection.begin = cursor_pos-selected;
+ selection.end = cursor_pos;
}
}