summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorBernhard Liebl <Bernhard.Liebl@gmx.org>2017-12-17 16:24:23 +0100
committerBernhard Liebl <Bernhard.Liebl@gmx.org>2017-12-17 16:24:23 +0100
commitabfcce0067c0652729ec9129d3c1d910470c0f50 (patch)
treed20248fb432ed819e129893b4304e07d6df823a0 /scene
parentcacab4ba6204aa36ddbc85d55705ab82b45e7930 (diff)
Fix cut-copy-line breaking paste (issue 14539)
Diffstat (limited to 'scene')
-rw-r--r--scene/gui/text_edit.cpp10
-rw-r--r--scene/gui/text_edit.h2
2 files changed, 6 insertions, 6 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 83aee5ca30..07f1bdf8e5 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -4084,7 +4084,7 @@ void TextEdit::cut() {
backspace_at_cursor();
update();
cursor_set_line(cursor.line + 1);
- cut_copy_line = true;
+ cut_copy_line = clipboard;
} else {
@@ -4098,7 +4098,7 @@ void TextEdit::cut() {
selection.active = false;
selection.selecting_mode = Selection::MODE_NONE;
update();
- cut_copy_line = false;
+ cut_copy_line = "";
}
}
@@ -4107,11 +4107,11 @@ void TextEdit::copy() {
if (!selection.active) {
String clipboard = _base_get_text(cursor.line, 0, cursor.line, text[cursor.line].length());
OS::get_singleton()->set_clipboard(clipboard);
- cut_copy_line = true;
+ cut_copy_line = clipboard;
} else {
String clipboard = _base_get_text(selection.from_line, selection.from_column, selection.to_line, selection.to_column);
OS::get_singleton()->set_clipboard(clipboard);
- cut_copy_line = false;
+ cut_copy_line = "";
}
}
@@ -4127,7 +4127,7 @@ void TextEdit::paste() {
cursor_set_line(selection.from_line);
cursor_set_column(selection.from_column);
- } else if (cut_copy_line) {
+ } else if (!cut_copy_line.empty() && cut_copy_line == clipboard) {
cursor_set_column(0);
String ins = "\n";
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index edef28cc25..836d5c7388 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -270,7 +270,7 @@ class TextEdit : public Control {
bool brace_matching_enabled;
bool highlight_current_line;
bool auto_indent;
- bool cut_copy_line;
+ String cut_copy_line;
bool insert_mode;
bool select_identifiers_enabled;